[Qemu-devel] [PATCH] Makefile: Don't add -dirty to pkgversion when tree is not dirty

Lucas Eriksson posted 1 patch 7 years, 3 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20180803125736.GA3476@SEJKG-L-LAN04.air5.flaktwoods.net
Test checkpatch passed
Test docker-mingw@fedora passed
Test docker-clang@ubuntu passed
Test docker-quick@centos7 passed
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[Qemu-devel] [PATCH] Makefile: Don't add -dirty to pkgversion when tree is not dirty
Posted by Lucas Eriksson 7 years, 3 months ago
On a clean just-cloned repo, git-diff-index has no local index to
compare with, leading to all files being marked as new on some systems.
git-diff on the other hand actually compares the files contents with the
repository tree and then updates said local index.
This problem was found when trying to automate xqemu builds (an xbox
emulator based on qemu) through the use of AppVeyor.

Signed-off-by: Lucas Eriksson <dracc@dracc.se>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 2da686be33..7b48c43734 100644
--- a/Makefile
+++ b/Makefile
@@ -446,7 +446,7 @@ qemu-version.h: FORCE
 		else \
 			if test -d .git; then \
 				pkgvers=$$(git describe --match 'v*' 2>/dev/null | tr -d '\n');\
-				if ! git diff-index --quiet HEAD &>/dev/null; then \
+				if ! git diff --quiet HEAD >/dev/null 2>&1; then \
 					pkgvers="$${pkgvers}-dirty"; \
 				fi; \
 			fi; \
--
2.18.0