From 4f3b3f7d61a24c46bd6e7ea6cc288fd5adb56655 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Mon, 16 Dec 2019 19:13:32 -0800 Subject: [PATCH] Rename GIT_DIR to FISH_BASE_DIR in git_version_gen.sh $GIT_DIR is interpreted by git as an environment variable, pointing at the .git directory. If git_version_gen.sh is run in an environment with an exported GIT_DIR, it will re-export GIT_DIR to point at the fish source directory. This will cause git operations to fail. This could be reproduced as building fish as part of an interactive rebase 'exec' command. git_version_gen.sh would always fail! --- build_tools/git_version_gen.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build_tools/git_version_gen.sh b/build_tools/git_version_gen.sh index 34966ab5c..49a15c108 100755 --- a/build_tools/git_version_gen.sh +++ b/build_tools/git_version_gen.sh @@ -6,8 +6,8 @@ set -e -# Find the fish git directory as two levels up from script directory. -GIT_DIR="$( cd "$( dirname "$( dirname "$0" )" )" && pwd )" +# Find the fish directory as two levels up from script directory. +FISH_BASE_DIR="$( cd "$( dirname "$( dirname "$0" )" )" && pwd )" DEF_VER=unknown # First see if there is a version file (included in release tarballs), @@ -15,7 +15,7 @@ DEF_VER=unknown if test -f version then VN=$(cat version) || VN="$DEF_VER" -elif ! VN=$(git -C "$GIT_DIR" describe --always --dirty 2>/dev/null); then +elif ! VN=$(git -C "$FISH_BASE_DIR" describe --always --dirty 2>/dev/null); then VN="$DEF_VER" fi