kbuild: fix scripts/setlocalversion to avoid erroneous -dirty tag
authorTheodore Ts'o <tytso@mit.edu>
Sat, 3 Nov 2007 01:53:00 +0000 (21:53 -0400)
committerSam Ravnborg <sam@ravnborg.org>
Mon, 28 Jan 2008 22:14:37 +0000 (23:14 +0100)
If git's index file is out of date, and some files have been touched
such that their timestamp doesn't what is in the index, "git
diff-index HEAD" may show that a particular file is dirty, when in
fact it really isn't.  Running "git update-index" will update the
index to avoid these false positives.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
scripts/setlocalversion

index 1b31da843672ab43adcfbca270f673f34a63258d..acce8ebc5d405931343638d8747d05231ec97535 100644 (file)
@@ -16,6 +16,7 @@ if head=`git rev-parse --verify HEAD 2>/dev/null`; then
        fi
 
        # Are there uncommitted changes?
+       git update-index --refresh --unmerged > /dev/null
        if git diff-index HEAD | read dummy; then
                printf '%s' -dirty
        fi