From 82b63bf4d0f62ac78dfb7d30673774f2e41339a4 Mon Sep 17 00:00:00 2001 From: Jozef Izso Date: Wed, 24 Jul 2013 11:45:28 +0200 Subject: [PATCH] Prefixed all git calls with `command` so `alias git=hub` won't affect shell performance --- modules/git/functions/_git-hub-browse | 4 ++-- modules/git/functions/_git-info | 2 +- modules/git/functions/_git-submodule-move | 2 +- modules/git/functions/_git-submodule-remove | 2 +- modules/git/functions/git-branch-current | 2 +- modules/git/functions/git-commit-lost | 2 +- modules/git/functions/git-dir | 2 +- modules/git/functions/git-hub-browse | 8 ++++---- modules/git/functions/git-info | 16 ++++++++-------- modules/git/functions/git-root | 2 +- .../git/functions/git-stash-clear-interactive | 4 ++-- modules/git/functions/git-stash-dropped | 2 +- modules/git/functions/git-stash-recover | 4 ++-- modules/git/functions/git-submodule-move | 4 ++-- modules/git/functions/git-submodule-remove | 2 +- modules/prompt/functions/prompt_minimal_setup | 2 +- modules/prompt/functions/prompt_peepcode_setup | 2 +- modules/prompt/functions/prompt_steeef_setup | 2 +- 18 files changed, 32 insertions(+), 32 deletions(-) diff --git a/modules/git/functions/_git-hub-browse b/modules/git/functions/_git-hub-browse index 0085c188..5f117814 100644 --- a/modules/git/functions/_git-hub-browse +++ b/modules/git/functions/_git-hub-browse @@ -8,7 +8,7 @@ # Sorin Ionescu # -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 fi @@ -21,7 +21,7 @@ _arguments -C -s -S \ case "$state" in (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 ;; diff --git a/modules/git/functions/_git-info b/modules/git/functions/_git-info index c1467e84..f9aa4e39 100644 --- a/modules/git/functions/_git-info +++ b/modules/git/functions/_git-info @@ -8,7 +8,7 @@ # Sorin Ionescu # -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 fi diff --git a/modules/git/functions/_git-submodule-move b/modules/git/functions/_git-submodule-move index ab8cd1ba..45e68860 100644 --- a/modules/git/functions/_git-submodule-move +++ b/modules/git/functions/_git-submodule-move @@ -8,7 +8,7 @@ # Sorin Ionescu # -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 fi diff --git a/modules/git/functions/_git-submodule-remove b/modules/git/functions/_git-submodule-remove index 1460dd0e..f5b668e5 100644 --- a/modules/git/functions/_git-submodule-remove +++ b/modules/git/functions/_git-submodule-remove @@ -8,7 +8,7 @@ # Sorin Ionescu # -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 fi diff --git a/modules/git/functions/git-branch-current b/modules/git/functions/git-branch-current index c731958d..fd8593cc 100644 --- a/modules/git/functions/git-branch-current +++ b/modules/git/functions/git-branch-current @@ -10,7 +10,7 @@ if ! git rev-parse 2> /dev/null; then return 1 fi -local ref="$(git symbolic-ref HEAD 2> /dev/null)" +local ref="$(command git symbolic-ref HEAD 2> /dev/null)" if [[ -n "$ref" ]]; then print "${ref#refs/heads/}" diff --git a/modules/git/functions/git-commit-lost b/modules/git/functions/git-commit-lost index e4075c9b..bf201e53 100644 --- a/modules/git/functions/git-commit-lost +++ b/modules/git/functions/git-commit-lost @@ -5,7 +5,7 @@ # Sorin Ionescu # -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 return 1 fi diff --git a/modules/git/functions/git-dir b/modules/git/functions/git-dir index 2e40e9ea..e054fe20 100644 --- a/modules/git/functions/git-dir +++ b/modules/git/functions/git-dir @@ -5,7 +5,7 @@ # Sorin Ionescu # -local git_dir="${$(git rev-parse --git-dir):A}" +local git_dir="${$(command git rev-parse --git-dir):A}" if [[ -n "$git_dir" ]]; then print "$git_dir" diff --git a/modules/git/functions/git-hub-browse b/modules/git/functions/git-hub-browse index 80fddca0..486e9e33 100644 --- a/modules/git/functions/git-hub-browse +++ b/modules/git/functions/git-hub-browse @@ -5,7 +5,7 @@ # Sorin Ionescu # -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 return 1 fi @@ -13,7 +13,7 @@ fi local remotes remote references reference file url 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 print "$0: remote not found: $remote" >&2 @@ -28,7 +28,7 @@ url=$( reference="${${2:-$(git-branch-current)}:-HEAD}" references=( 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 @@ -37,7 +37,7 @@ if (( $references[(i)$reference] == $#references + 1 )); then fi if [[ "$reference" == 'HEAD' ]]; then - reference="$(git rev-parse HEAD 2>/dev/null)" + reference="$(command git rev-parse HEAD 2>/dev/null)" fi file="$3" diff --git a/modules/git/functions/git-info b/modules/git/functions/git-info index 1c163962..57919f7b 100644 --- a/modules/git/functions/git-info +++ b/modules/git/functions/git-info @@ -164,7 +164,7 @@ function git-info { typeset -gA git_info # 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 fi @@ -180,7 +180,7 @@ function git-info { fi # 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 fi @@ -190,7 +190,7 @@ function git-info { # Format commit. zstyle -s ':prezto:module:git:info:commit' format 'commit_format' 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 zformat -f commit_formatted "$commit_format" "c:$commit" fi @@ -199,7 +199,7 @@ function git-info { # Format stashed. zstyle -s ':prezto:module:git:info:stashed' format 'stashed_format' 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 zformat -f stashed_formatted "$stashed_format" "S:$stashed" fi @@ -215,7 +215,7 @@ function git-info { fi # 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. zstyle -s ':prezto:module:git:info:branch' format 'branch_format' @@ -226,7 +226,7 @@ function git-info { # Format position. zstyle -s ':prezto:module:git:info:position' format 'position_format' 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 zformat -f position_formatted "$position_format" "p:$position" fi @@ -236,7 +236,7 @@ function git-info { zstyle -s ':prezto:module:git:info:remote' format 'remote_format' if [[ -n "$branch" && -n "$remote_format" ]]; then # 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/}" if [[ -n "$remote" ]]; then 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' if [[ -n "$branch" && ( -n "$ahead_format" || -n "$behind_format" ) ]]; then # 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. ahead_and_behind="$(${(z)ahead_and_behind_cmd} 2> /dev/null)" diff --git a/modules/git/functions/git-root b/modules/git/functions/git-root index 82b74385..6ca975ea 100644 --- a/modules/git/functions/git-root +++ b/modules/git/functions/git-root @@ -5,7 +5,7 @@ # Sorin Ionescu # -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 print "$root" diff --git a/modules/git/functions/git-stash-clear-interactive b/modules/git/functions/git-stash-clear-interactive index effd038f..f2c42d40 100644 --- a/modules/git/functions/git-stash-clear-interactive +++ b/modules/git/functions/git-stash-clear-interactive @@ -5,7 +5,7 @@ # Sorin Ionescu # -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 return 1 fi @@ -13,7 +13,7 @@ fi local stashed 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 read -q "?Clear $stashed stashed state(s) [y/N]? "; then git stash clear diff --git a/modules/git/functions/git-stash-dropped b/modules/git/functions/git-stash-dropped index 26229263..e6aba6bb 100644 --- a/modules/git/functions/git-stash-dropped +++ b/modules/git/functions/git-stash-dropped @@ -5,7 +5,7 @@ # Sorin Ionescu # -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 return 1 fi diff --git a/modules/git/functions/git-stash-recover b/modules/git/functions/git-stash-recover index 07094406..3d862ec8 100644 --- a/modules/git/functions/git-stash-recover +++ b/modules/git/functions/git-stash-recover @@ -5,7 +5,7 @@ # Sorin Ionescu # -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 return 1 fi @@ -14,6 +14,6 @@ local commit for commit in "$@"; do 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 diff --git a/modules/git/functions/git-submodule-move b/modules/git/functions/git-submodule-move index c3db972d..51251ee7 100644 --- a/modules/git/functions/git-submodule-move +++ b/modules/git/functions/git-submodule-move @@ -5,7 +5,7 @@ # Sorin Ionescu # -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 return 1 elif [[ "$PWD" != "$(git-root)" ]]; then @@ -17,7 +17,7 @@ local src="$1" local dst="$2" 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 print "$0: submodule not found: $src" >&2 diff --git a/modules/git/functions/git-submodule-remove b/modules/git/functions/git-submodule-remove index 3f72fb6d..3b69d3b5 100644 --- a/modules/git/functions/git-submodule-remove +++ b/modules/git/functions/git-submodule-remove @@ -5,7 +5,7 @@ # Sorin Ionescu # -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 return 1 elif [[ "$PWD" != "$(git-root)" ]]; then diff --git a/modules/prompt/functions/prompt_minimal_setup b/modules/prompt/functions/prompt_minimal_setup index a86c04e8..7793b778 100644 --- a/modules/prompt/functions/prompt_minimal_setup +++ b/modules/prompt/functions/prompt_minimal_setup @@ -11,7 +11,7 @@ function +vi-git-status() { # 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' fi } diff --git a/modules/prompt/functions/prompt_peepcode_setup b/modules/prompt/functions/prompt_peepcode_setup index 58f4f8b4..a367c1ac 100644 --- a/modules/prompt/functions/prompt_peepcode_setup +++ b/modules/prompt/functions/prompt_peepcode_setup @@ -12,7 +12,7 @@ function +vi-git-status() { # 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' fi } diff --git a/modules/prompt/functions/prompt_steeef_setup b/modules/prompt/functions/prompt_steeef_setup index f64f47d2..17a8dfad 100644 --- a/modules/prompt/functions/prompt_steeef_setup +++ b/modules/prompt/functions/prompt_steeef_setup @@ -14,7 +14,7 @@ function prompt_steeef_precmd { # 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)" else branch_format="(${_prompt_steeef_colors[1]}%b%f%u%c)"