kbuild: fix delay in setlocalversion on readonly source
authorNico Schottelius <nico-linuxsetlocalversion@schottelius.org>
Fri, 12 Jun 2009 07:59:52 +0000 (09:59 +0200)
committerSam Ravnborg <sam@ravnborg.org>
Sun, 14 Jun 2009 20:26:00 +0000 (22:26 +0200)
Do not update index on read only media.
Idea published by Christian Kujau <lists@nerdbynature.de>.

Cc: Nico Schottelius <nico@ikn.schottelius.org>
Cc: Christian Kujau <lists@nerdbynature.de>
scripts/setlocalversion

index 00790472f641b8cd5990033a4162b0120aa1453e..46989b88d7345d233ce5d734e2ed9845784df4d0 100755 (executable)
@@ -39,8 +39,10 @@ if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
                printf -- '-svn%s' "`git svn find-rev $head`"
        fi
 
-       # Are there uncommitted changes?
-       git update-index --refresh --unmerged > /dev/null
+       # Update index only on r/w media
+       [ -w . ] && git update-index --refresh --unmerged > /dev/null
+
+       # Check for uncommitted changes
        if git diff-index --name-only HEAD | grep -v "^scripts/package" \
            | read dummy; then
                printf '%s' -dirty