From b6afa228f4974f4af1e8938911e35150aa2991c8 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 22 Aug 2016 09:04:15 +0100 Subject: [PATCH] update: make GIT_EXECUTABLE an absolute path. Otherwise it can end up as e.g. `bin/git` which then breaks when we `cd` to another directory and try to run it. --- Library/Homebrew/cmd/update.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh index dbd1a4de83..7b57bde246 100644 --- a/Library/Homebrew/cmd/update.sh +++ b/Library/Homebrew/cmd/update.sh @@ -17,7 +17,10 @@ source "$HOMEBREW_LIBRARY/Homebrew/utils/lock.sh" git() { if [[ -z "$GIT_EXECUTABLE" ]] then - GIT_EXECUTABLE="$("$HOMEBREW_LIBRARY/Homebrew/shims/scm/git" --homebrew=print-path)" + GIT_EXECUTABLE_RELATIVE="$("$HOMEBREW_LIBRARY/Homebrew/shims/scm/git" --homebrew=print-path)" + GIT_EXECUTABLE_BASE="$(basename "$GIT_EXECUTABLE_RELATIVE")" + GIT_EXECUTABLE_DIR="$(cd "$(dirname "$GIT_EXECUTABLE_RELATIVE")" && pwd)" + GIT_EXECUTABLE="$GIT_EXECUTABLE_DIR/$GIT_EXECUTABLE_BASE" fi "$GIT_EXECUTABLE" "$@" }