{"thread":{"id":"19080","subject":"[PATCH] To make GIT-VERSION-FILE, search for git more widely","startedAt":"2009-04-26T11:59:50Z","lastAt":"2009-04-26T11:59:50Z","messageCount":1,"participants":["Matthias Andree"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"112392","messageId":"1240747190-12005-1-git-send-email-matthias.andree@gmx.de","threadId":"19080","inReplyTo":null,"subject":"[PATCH] To make GIT-VERSION-FILE, search for git more widely","fromName":"Matthias Andree","fromEmail":"matthias.andree@gmx.de","sentAt":"2009-04-26T11:59:50Z","receivedAt":"2009-04-26T11:59:50Z","isPatch":true,"sender":{"key":"matthias.andree@gmx.de","avatar":null},"body":"Problem: when git is installed into /usr/local/bin, running 'sudo make\ninstall' won't find git in $PATH (because sudo strips PATH, for instance\non openSUSE 11.1, and doesn't include /usr/local/whatever).\n\nThis causes GIT-VERSION-FILE to not find git for git describe, and fall\nback to DEF_VER.\n\nThis in turn causes rebuilds of major parts of the system.\n\nThis patch passes GIT through to the shell script, and additionally\nlooks for the current version and in ${prefix}/bin.\n\nSigned-off-by: Matthias Andree <matthias.andree@gmx.de>\n---\n GIT-VERSION-GEN |    7 ++++---\n Makefile        |    6 +++++-\n 2 files changed, 9 insertions(+), 4 deletions(-)\n\ndiff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN\nindex 97fc1e0..22661c0 100755\n--- a/GIT-VERSION-GEN\n+++ b/GIT-VERSION-GEN\n@@ -2,6 +2,7 @@\n \n GVF=GIT-VERSION-FILE\n DEF_VER=v1.6.2.GIT\n+test -x \"$GIT\" || GIT=git\n \n LF='\n '\n@@ -12,12 +13,12 @@ if test -f version\n then\n \tVN=$(cat version) || VN=\"$DEF_VER\"\n elif test -d .git -o -f .git &&\n-\tVN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&\n+\tVN=$(${GIT} describe --abbrev=4 HEAD 2>/dev/null) &&\n \tcase \"$VN\" in\n \t*$LF*) (exit 1) ;;\n \tv[0-9]*)\n-\t\tgit update-index -q --refresh\n-\t\ttest -z \"$(git diff-index --name-only HEAD --)\" ||\n+\t\t${GIT} update-index -q --refresh\n+\t\ttest -z \"$(${GIT} diff-index --name-only HEAD --)\" ||\n \t\tVN=\"$VN-dirty\" ;;\n \tesac\n then\ndiff --git a/Makefile b/Makefile\nindex 5c8e83a..408228e 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -177,7 +177,11 @@ all::\n # away (some NTFS drivers seem to zero the contents in that scenario).\n \n GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE\n-\t@$(SHELL_PATH) ./GIT-VERSION-GEN\n+\t@{ GIT=./git$X ; type $$GIT >/dev/null 2>&1 ; } \\\n+\t    || { GIT=$(prefix)/bin/git$X ; type $$GIT >/dev/null 2>&1 ; }\\\n+\t    || GIT=git ; \\\n+\t    export GIT ; \\\n+\t    $(SHELL_PATH) ./GIT-VERSION-GEN\n -include GIT-VERSION-FILE\n \n uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')\n-- \n1.6.3.rc2.9.g97ad0\n"}]}