git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthias Andree <matthias.andree@gmx.de>
To: git@vger.kernel.org, "Junio C. Hamano" <gitster@pobox.com>
Cc: Matthias Andree <matthias.andree@gmx.de>
Subject: [PATCH] To make GIT-VERSION-FILE, search for git more widely
Date: Thu,  7 May 2009 10:24:26 +0200	[thread overview]
Message-ID: <1241684666-18956-1-git-send-email-matthias.andree@gmx.de> (raw)

Problem: when git is installed into /usr/local/bin, running 'sudo make
install' won't find git in $PATH (because sudo strips PATH, for instance
on openSUSE 11.1, and doesn't include /usr/local/whatever).

This causes GIT-VERSION-FILE to not find git for git describe, and fall
back to DEF_VER.

This in turn causes rebuilds of major parts of the system.

This patch passes GIT through to the shell script, and additionally
looks for the current version and in ${prefix}/bin.

Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
---
 GIT-VERSION-GEN |    7 ++++---
 Makefile        |    6 +++++-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 39cde78..66c171e 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -2,6 +2,7 @@
 
 GVF=GIT-VERSION-FILE
 DEF_VER=v1.6.3.GIT
+test -x "$GIT" || GIT=git
 
 LF='
 '
@@ -12,12 +13,12 @@ if test -f version
 then
 	VN=$(cat version) || VN="$DEF_VER"
 elif test -d .git -o -f .git &&
-	VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
+	VN=$(${GIT} describe --abbrev=4 HEAD 2>/dev/null) &&
 	case "$VN" in
 	*$LF*) (exit 1) ;;
 	v[0-9]*)
-		git update-index -q --refresh
-		test -z "$(git diff-index --name-only HEAD --)" ||
+		${GIT} update-index -q --refresh
+		test -z "$(${GIT} diff-index --name-only HEAD --)" ||
 		VN="$VN-dirty" ;;
 	esac
 then
diff --git a/Makefile b/Makefile
index 6e21643..8e34877 100644
--- a/Makefile
+++ b/Makefile
@@ -177,7 +177,11 @@ all::
 # away (some NTFS drivers seem to zero the contents in that scenario).
 
 GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
-	@$(SHELL_PATH) ./GIT-VERSION-GEN
+	@{ GIT=./git$X ; type $$GIT >/dev/null 2>&1 ; } \
+	    || { GIT=$(prefix)/bin/git$X ; type $$GIT >/dev/null 2>&1 ; }\
+	    || GIT=git ; \
+	    export GIT ; \
+	    $(SHELL_PATH) ./GIT-VERSION-GEN
 -include GIT-VERSION-FILE
 
 uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
-- 
1.6.3.rc2.9.g97ad0

             reply	other threads:[~2009-05-07  8:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-07  8:24 Matthias Andree [this message]
2009-05-07  8:28 ` [PATCH] To make GIT-VERSION-FILE, search for git more widely Johannes Sixt
2009-05-07  8:33 ` Junio C Hamano
2009-05-07  8:40   ` Matthias Andree
2009-05-07  8:54     ` [PATCH] " Nicolas Sebrecht
2009-05-07  8:56       ` Matthias Andree
2009-05-07  9:02         ` Nicolas Sebrecht
2009-05-07  8:47   ` [PATCH] " Johannes Sixt
2009-05-07  9:02     ` Michael J Gruber
2009-05-07  9:13       ` Matthias Andree
2009-05-07  9:02     ` Matthias Andree
2009-05-07  8:35 ` Johannes Sixt
2009-05-07  8:58   ` [PATCH v2] " Matthias Andree
  -- strict thread matches above, loose matches on Subject: below --
2009-04-26 11:59 [PATCH] " Matthias Andree

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1241684666-18956-1-git-send-email-matthias.andree@gmx.de \
    --to=matthias.andree@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).