Use type -p / -P to determine git binary

This commit is contained in:
Nathan Broadbent
2012-11-13 12:45:01 +13:00
parent 7375597407
commit 992b1866b2
2 changed files with 10 additions and 6 deletions

View File

@@ -20,11 +20,11 @@
# # groups => 1: staged, 2: unmerged, 3: unstaged, 4: untracked
# --------------------------------------------------------------------
@project_root = File.exist?(".git") ? Dir.pwd : `git rev-parse --git-dir 2> /dev/null`.sub(/\/\.git$/, '').strip
@project_root = File.exist?(".git") ? Dir.pwd : `\git rev-parse --git-dir 2> /dev/null`.sub(/\/\.git$/, '').strip
@git_status = `git status --porcelain 2> /dev/null`
@git_status = `\git status --porcelain 2> /dev/null`
git_branch = `git branch -v 2> /dev/null`
git_branch = `\git branch -v 2> /dev/null`
@branch = git_branch[/^\* (\(no branch\)|[^ ]*)/, 1]
@ahead = git_branch[/^\* [^ ]* *[^ ]* *\[ahead ?(\d+)\]/, 1]

View File

@@ -12,7 +12,11 @@ disable_nullglob() { if [ $shell = "zsh" ]; then unsetopt NULL_GLOB; else shopt
# Alias wrapper that ignores errors if alias is not defined.
_alias(){ alias "$@" 2> /dev/null; }
export GIT_BINARY=$(which git)
if [ $shell = "zsh" ]; then
export GIT_BINARY=$(type -p git | sed 's/git is //')
else
export GIT_BINARY=$(type -P git)
fi
# Updates SCM Breeze from GitHub.
update_scm_breeze() {