Prefixed all git calls with command so alias git=hub won't affect shell performance

This commit is contained in:
Jozef Izso 2013-07-24 11:45:28 +02:00
parent 16aa48baeb
commit 82b63bf4d0
18 changed files with 32 additions and 32 deletions

View file

@ -8,7 +8,7 @@
# Sorin Ionescu <sorin.ionescu@gmail.com> # Sorin Ionescu <sorin.ionescu@gmail.com>
# #
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
return 1 return 1
fi fi
@ -21,7 +21,7 @@ _arguments -C -s -S \
case "$state" in case "$state" in
(remote) (remote)
remotes=($(git config --get-regexp 'remote.*.url' | cut -d. -f2)) remotes=($(command git config --get-regexp 'remote.*.url' | cut -d. -f2))
_describe -t branch 'remotes' remotes && ret=0 _describe -t branch 'remotes' remotes && ret=0
;; ;;

View file

@ -8,7 +8,7 @@
# Sorin Ionescu <sorin.ionescu@gmail.com> # Sorin Ionescu <sorin.ionescu@gmail.com>
# #
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
return 1 return 1
fi fi

View file

@ -8,7 +8,7 @@
# Sorin Ionescu <sorin.ionescu@gmail.com> # Sorin Ionescu <sorin.ionescu@gmail.com>
# #
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
return 1 return 1
fi fi

View file

@ -8,7 +8,7 @@
# Sorin Ionescu <sorin.ionescu@gmail.com> # Sorin Ionescu <sorin.ionescu@gmail.com>
# #
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
return 1 return 1
fi fi

View file

@ -10,7 +10,7 @@ if ! git rev-parse 2> /dev/null; then
return 1 return 1
fi fi
local ref="$(git symbolic-ref HEAD 2> /dev/null)" local ref="$(command git symbolic-ref HEAD 2> /dev/null)"
if [[ -n "$ref" ]]; then if [[ -n "$ref" ]]; then
print "${ref#refs/heads/}" print "${ref#refs/heads/}"

View file

@ -5,7 +5,7 @@
# Sorin Ionescu <sorin.ionescu@gmail.com> # Sorin Ionescu <sorin.ionescu@gmail.com>
# #
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
print "$0: not a repository work tree: $PWD" >&2 print "$0: not a repository work tree: $PWD" >&2
return 1 return 1
fi fi

View file

@ -5,7 +5,7 @@
# Sorin Ionescu <sorin.ionescu@gmail.com> # Sorin Ionescu <sorin.ionescu@gmail.com>
# #
local git_dir="${$(git rev-parse --git-dir):A}" local git_dir="${$(command git rev-parse --git-dir):A}"
if [[ -n "$git_dir" ]]; then if [[ -n "$git_dir" ]]; then
print "$git_dir" print "$git_dir"

View file

@ -5,7 +5,7 @@
# Sorin Ionescu <sorin.ionescu@gmail.com> # Sorin Ionescu <sorin.ionescu@gmail.com>
# #
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
print "$0: not a repository work tree: $PWD" >&2 print "$0: not a repository work tree: $PWD" >&2
return 1 return 1
fi fi
@ -13,7 +13,7 @@ fi
local remotes remote references reference file url local remotes remote references reference file url
remote="${1:-origin}" remote="${1:-origin}"
remotes=($(git config --get-regexp 'remote.*.url' | cut -d. -f2)) remotes=($(command git config --get-regexp 'remote.*.url' | cut -d. -f2))
if (( $remotes[(i)$remote] == $#remotes + 1 )); then if (( $remotes[(i)$remote] == $#remotes + 1 )); then
print "$0: remote not found: $remote" >&2 print "$0: remote not found: $remote" >&2
@ -28,7 +28,7 @@ url=$(
reference="${${2:-$(git-branch-current)}:-HEAD}" reference="${${2:-$(git-branch-current)}:-HEAD}"
references=( references=(
HEAD HEAD
${$(git ls-remote --heads --tags "$remote" | awk '{print $2}')##refs/(heads|tags)/} ${$(command git ls-remote --heads --tags "$remote" | awk '{print $2}')##refs/(heads|tags)/}
) )
if (( $references[(i)$reference] == $#references + 1 )); then if (( $references[(i)$reference] == $#references + 1 )); then
@ -37,7 +37,7 @@ if (( $references[(i)$reference] == $#references + 1 )); then
fi fi
if [[ "$reference" == 'HEAD' ]]; then if [[ "$reference" == 'HEAD' ]]; then
reference="$(git rev-parse HEAD 2>/dev/null)" reference="$(command git rev-parse HEAD 2>/dev/null)"
fi fi
file="$3" file="$3"

View file

@ -164,7 +164,7 @@ function git-info {
typeset -gA git_info typeset -gA git_info
# Return if not inside a Git repository work tree. # Return if not inside a Git repository work tree.
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
return 1 return 1
fi fi
@ -180,7 +180,7 @@ function git-info {
fi fi
# Return if git-info is disabled. # Return if git-info is disabled.
if ! is-true "${$(git config --bool prompt.showinfo):-true}"; then if ! is-true "${$(command git config --bool prompt.showinfo):-true}"; then
return 1 return 1
fi fi
@ -190,7 +190,7 @@ function git-info {
# Format commit. # Format commit.
zstyle -s ':prezto:module:git:info:commit' format 'commit_format' zstyle -s ':prezto:module:git:info:commit' format 'commit_format'
if [[ -n "$commit_format" ]]; then if [[ -n "$commit_format" ]]; then
commit="$(git rev-parse HEAD 2> /dev/null)" commit="$(command git rev-parse HEAD 2> /dev/null)"
if [[ -n "$commit" ]]; then if [[ -n "$commit" ]]; then
zformat -f commit_formatted "$commit_format" "c:$commit" zformat -f commit_formatted "$commit_format" "c:$commit"
fi fi
@ -199,7 +199,7 @@ function git-info {
# Format stashed. # Format stashed.
zstyle -s ':prezto:module:git:info:stashed' format 'stashed_format' zstyle -s ':prezto:module:git:info:stashed' format 'stashed_format'
if [[ -n "$stashed_format" && -f "$(git-dir)/refs/stash" ]]; then if [[ -n "$stashed_format" && -f "$(git-dir)/refs/stash" ]]; then
stashed="$(git stash list 2> /dev/null | wc -l | awk '{print $1}')" stashed="$(command git stash list 2> /dev/null | wc -l | awk '{print $1}')"
if [[ -n "$stashed" ]]; then if [[ -n "$stashed" ]]; then
zformat -f stashed_formatted "$stashed_format" "S:$stashed" zformat -f stashed_formatted "$stashed_format" "S:$stashed"
fi fi
@ -215,7 +215,7 @@ function git-info {
fi fi
# Get the branch. # Get the branch.
branch="${$(git symbolic-ref HEAD 2> /dev/null)#refs/heads/}" branch="${$(command git symbolic-ref HEAD 2> /dev/null)#refs/heads/}"
# Format branch. # Format branch.
zstyle -s ':prezto:module:git:info:branch' format 'branch_format' zstyle -s ':prezto:module:git:info:branch' format 'branch_format'
@ -226,7 +226,7 @@ function git-info {
# Format position. # Format position.
zstyle -s ':prezto:module:git:info:position' format 'position_format' zstyle -s ':prezto:module:git:info:position' format 'position_format'
if [[ -z "$branch" && -n "$position_format" ]]; then if [[ -z "$branch" && -n "$position_format" ]]; then
position="$(git describe --contains --all HEAD 2> /dev/null)" position="$(command git describe --contains --all HEAD 2> /dev/null)"
if [[ -n "$position" ]]; then if [[ -n "$position" ]]; then
zformat -f position_formatted "$position_format" "p:$position" zformat -f position_formatted "$position_format" "p:$position"
fi fi
@ -236,7 +236,7 @@ function git-info {
zstyle -s ':prezto:module:git:info:remote' format 'remote_format' zstyle -s ':prezto:module:git:info:remote' format 'remote_format'
if [[ -n "$branch" && -n "$remote_format" ]]; then if [[ -n "$branch" && -n "$remote_format" ]]; then
# Gets the remote name. # Gets the remote name.
remote_cmd='git rev-parse --symbolic-full-name --verify HEAD@{upstream}' remote_cmd='command git rev-parse --symbolic-full-name --verify HEAD@{upstream}'
remote="${$(${(z)remote_cmd} 2> /dev/null)##refs/remotes/}" remote="${$(${(z)remote_cmd} 2> /dev/null)##refs/remotes/}"
if [[ -n "$remote" ]]; then if [[ -n "$remote" ]]; then
zformat -f remote_formatted "$remote_format" "R:$remote" zformat -f remote_formatted "$remote_format" "R:$remote"
@ -247,7 +247,7 @@ function git-info {
zstyle -s ':prezto:module:git:info:behind' format 'behind_format' zstyle -s ':prezto:module:git:info:behind' format 'behind_format'
if [[ -n "$branch" && ( -n "$ahead_format" || -n "$behind_format" ) ]]; then if [[ -n "$branch" && ( -n "$ahead_format" || -n "$behind_format" ) ]]; then
# Gets the commit difference counts between local and remote. # Gets the commit difference counts between local and remote.
ahead_and_behind_cmd='git rev-list --count --left-right HEAD...@{upstream}' ahead_and_behind_cmd='command git rev-list --count --left-right HEAD...@{upstream}'
# Get ahead and behind counts. # Get ahead and behind counts.
ahead_and_behind="$(${(z)ahead_and_behind_cmd} 2> /dev/null)" ahead_and_behind="$(${(z)ahead_and_behind_cmd} 2> /dev/null)"

View file

@ -5,7 +5,7 @@
# Sorin Ionescu <sorin.ionescu@gmail.com> # Sorin Ionescu <sorin.ionescu@gmail.com>
# #
local root="$(git rev-parse --show-toplevel 2> /dev/null)" local root="$(command git rev-parse --show-toplevel 2> /dev/null)"
if [[ -n "$root" ]]; then if [[ -n "$root" ]]; then
print "$root" print "$root"

View file

@ -5,7 +5,7 @@
# Sorin Ionescu <sorin.ionescu@gmail.com> # Sorin Ionescu <sorin.ionescu@gmail.com>
# #
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
print "$0: not a repository work tree: $PWD" >&2 print "$0: not a repository work tree: $PWD" >&2
return 1 return 1
fi fi
@ -13,7 +13,7 @@ fi
local stashed local stashed
if [[ -f "$(git-dir)/refs/stash" ]]; then if [[ -f "$(git-dir)/refs/stash" ]]; then
stashed="$(git stash list 2> /dev/null | wc -l | awk '{print $1}')" stashed="$(command git stash list 2> /dev/null | wc -l | awk '{print $1}')"
if (( $stashed > 0 )); then if (( $stashed > 0 )); then
if read -q "?Clear $stashed stashed state(s) [y/N]? "; then if read -q "?Clear $stashed stashed state(s) [y/N]? "; then
git stash clear git stash clear

View file

@ -5,7 +5,7 @@
# Sorin Ionescu <sorin.ionescu@gmail.com> # Sorin Ionescu <sorin.ionescu@gmail.com>
# #
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
print "$0: not a repository work tree: $PWD" >&2 print "$0: not a repository work tree: $PWD" >&2
return 1 return 1
fi fi

View file

@ -5,7 +5,7 @@
# Sorin Ionescu <sorin.ionescu@gmail.com> # Sorin Ionescu <sorin.ionescu@gmail.com>
# #
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
print "$0: not a repository work tree: $PWD" >&2 print "$0: not a repository work tree: $PWD" >&2
return 1 return 1
fi fi
@ -14,6 +14,6 @@ local commit
for commit in "$@"; do for commit in "$@"; do
git update-ref \ git update-ref \
-m "$(git log -1 --pretty="format:%s" "$commit")" refs/stash "$commit" -m "$(command git log -1 --pretty="format:%s" "$commit")" refs/stash "$commit"
done done

View file

@ -5,7 +5,7 @@
# Sorin Ionescu <sorin.ionescu@gmail.com> # Sorin Ionescu <sorin.ionescu@gmail.com>
# #
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
print "$0: not a repository work tree: $PWD" >&2 print "$0: not a repository work tree: $PWD" >&2
return 1 return 1
elif [[ "$PWD" != "$(git-root)" ]]; then elif [[ "$PWD" != "$(git-root)" ]]; then
@ -17,7 +17,7 @@ local src="$1"
local dst="$2" local dst="$2"
local url local url
url="$(git config --file "$(git-root)/.gitmodules" --get "submodule.${src}.url")" url="$(command git config --file "$(git-root)/.gitmodules" --get "submodule.${src}.url")"
if [[ -z "$url" ]]; then if [[ -z "$url" ]]; then
print "$0: submodule not found: $src" >&2 print "$0: submodule not found: $src" >&2

View file

@ -5,7 +5,7 @@
# Sorin Ionescu <sorin.ionescu@gmail.com> # Sorin Ionescu <sorin.ionescu@gmail.com>
# #
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
print "$0: not a repository work tree: $PWD" >&2 print "$0: not a repository work tree: $PWD" >&2
return 1 return 1
elif [[ "$PWD" != "$(git-root)" ]]; then elif [[ "$PWD" != "$(git-root)" ]]; then

View file

@ -11,7 +11,7 @@
function +vi-git-status() { function +vi-git-status() {
# Check for untracked files or updated submodules since vcs_info does not. # Check for untracked files or updated submodules since vcs_info does not.
if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then if [[ -n $(command git ls-files --other --exclude-standard 2> /dev/null) ]]; then
hook_com[unstaged]='%F{red}●%f' hook_com[unstaged]='%F{red}●%f'
fi fi
} }

View file

@ -12,7 +12,7 @@
function +vi-git-status() { function +vi-git-status() {
# Check for untracked files or updated submodules since vcs_info does not. # Check for untracked files or updated submodules since vcs_info does not.
if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then if [[ -n $(command git ls-files --other --exclude-standard 2> /dev/null) ]]; then
hook_com[unstaged]=' %F{8}✗%f' hook_com[unstaged]=' %F{8}✗%f'
fi fi
} }

View file

@ -14,7 +14,7 @@
function prompt_steeef_precmd { function prompt_steeef_precmd {
# Check for untracked files or updated submodules since vcs_info does not. # Check for untracked files or updated submodules since vcs_info does not.
if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then if [[ -n $(command git ls-files --other --exclude-standard 2> /dev/null) ]]; then
branch_format="(${_prompt_steeef_colors[1]}%b%f%u%c${_prompt_steeef_colors[4]}●%f)" branch_format="(${_prompt_steeef_colors[1]}%b%f%u%c${_prompt_steeef_colors[4]}●%f)"
else else
branch_format="(${_prompt_steeef_colors[1]}%b%f%u%c)" branch_format="(${_prompt_steeef_colors[1]}%b%f%u%c)"