From b09848cd25e7e1757e15aeb7e7d7ad699aa76f9d Mon Sep 17 00:00:00 2001 From: Vasilis Tsiligiannis Date: Wed, 13 Apr 2016 20:52:26 +0000 Subject: [PATCH] scripts/getver.sh: Use 'git-rev-parse' to detect if tree lies in Git repository Path to the Git repository directory can be overriden by using the '$GIT_DIR' environment variable. This patch improves detection of Git repository by using 'git-rev-parse', which respects '$GIT_DIR' environment variable, instead of just checking the existence of '.git' directory. Signed-off-by: Vasilis Tsiligiannis SVN-Revision: 49165 --- scripts/getver.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/getver.sh b/scripts/getver.sh index 4643ca63ff..6cf7797519 100755 --- a/scripts/getver.sh +++ b/scripts/getver.sh @@ -17,7 +17,7 @@ try_svn() { } try_git() { - [ -e .git ] || return 1 + git rev-parse --git-dir >/dev/null 2>&1 || return 1 REV="$(git log | grep -m 1 git-svn-id | awk '{ gsub(/.*@/, "", $0); print $1 }')" REV="${REV:+r$REV}" [ -n "$REV" ]