From d81b4ac9f29b2f28e23633ed22bceee11d8d605f Mon Sep 17 00:00:00 2001 From: Fabian Bonk Date: Sat, 3 Oct 2020 20:29:26 +0200 Subject: [PATCH] git: run gfa with --jobs=10 (fetch remotes in parallel) (#9268) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marc Cornellà --- plugins/git/git.plugin.zsh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 5a9ccff5c..8255a03ee 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -1,3 +1,7 @@ +# Git version checking +autoload -Uz is-at-least +git_version="${(As: :)$(git version 2>/dev/null)[3]}" + # # Functions # @@ -104,7 +108,10 @@ function gdv() { git diff -w "$@" | view - } compdef _git gdv=git-diff alias gf='git fetch' -alias gfa='git fetch --all --prune' +# --jobs= was added in git 2.8 +is-at-least 2.8 "$git_version" \ + && alias gfa='git fetch --all --prune --jobs=10' \ + || alias gfa='git fetch --all --prune' alias gfo='git fetch origin' alias gfg='git ls-files | grep' @@ -240,8 +247,7 @@ alias gss='git status -s' alias gst='git status' # use the default stash push on git 2.13 and newer -autoload -Uz is-at-least -is-at-least 2.13 "$(git --version 2>/dev/null | awk '{print $3}')" \ +is-at-least 2.13 "$git_version" \ && alias gsta='git stash push' \ || alias gsta='git stash save' @@ -291,3 +297,5 @@ function grename() { git push --set-upstream origin "$2" fi } + +unset git_version