From 6aa7b47ae194a02f5b6e8cda2ce3c69e161ee5c9 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Wed, 5 Sep 2018 15:49:00 +0800 Subject: [PATCH] scm shim: handle edge case Since #4748 `HOMEBREW_GIT` is set by the `brew.sh`, whose value is default to be `git`. As a result, it completely bypasses the logic of the shims/scm/git. This fixes the issue by checking whether `HOMEBREW_GIT` and `HOMEBREW_SVN` are set to be `git` and `svn` respectively. Fixes #4825. --- Library/Homebrew/shims/scm/git | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/shims/scm/git b/Library/Homebrew/shims/scm/git index e1ef6c6a59..7306268fda 100755 --- a/Library/Homebrew/shims/scm/git +++ b/Library/Homebrew/shims/scm/git @@ -85,10 +85,16 @@ fi case "$(lowercase "$SCM_FILE")" in git) - [[ -n "$HOMEBREW_GIT" ]] && safe_exec "$(type -P "$HOMEBREW_GIT")" "$@" + if [[ -n "$HOMEBREW_GIT" && "$HOMEBREW_GIT" != git ]] + then + safe_exec "$(type -P "$HOMEBREW_GIT")" "$@" + fi ;; svn) - [[ -n "$HOMEBREW_SVN" ]] && safe_exec "$(type -P "$HOMEBREW_SVN")" "$@" + if [[ -n "$HOMEBREW_SVN" && "$HOMEBREW_SVN" != svn ]] + then + safe_exec "$(type -P "$HOMEBREW_SVN")" "$@" + fi ;; esac