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.
This commit is contained in:
Xu Cheng 2018-09-05 15:49:00 +08:00
parent 3a4914664e
commit 6aa7b47ae1
No known key found for this signature in database
GPG Key ID: B19F15830AB4E690

View File

@ -85,10 +85,16 @@ fi
case "$(lowercase "$SCM_FILE")" in case "$(lowercase "$SCM_FILE")" in
git) 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) 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 esac