summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Cornellà <marc.cornella@live.com>2019-04-09 18:33:15 +0200
committerGitHub <noreply@github.com>2019-04-09 18:33:15 +0200
commit35dc26a2c091e90de1274bd4b9993e403d1c6642 (patch)
treeb6cdad26df0423d6fb2adfcf07bef3ec04af103e
parent4aa545abedb430df2fa1ae2cc7cc502a5be1a80b (diff)
parent1bd72f588cb2e4950ea513aa4315ce77c792e43b (diff)
downloadzsh-35dc26a2c091e90de1274bd4b9993e403d1c6642.tar.gz
zsh-35dc26a2c091e90de1274bd4b9993e403d1c6642.tar.bz2
zsh-35dc26a2c091e90de1274bd4b9993e403d1c6642.zip
git: use stash 'push' instead of the deprecated 'save' (#7486)
* Use stash 'push' or 'save' depending on Git version A utility function now parses the output of git --version and set the alias for git stash to 'git stash push' iff the current version of Git is 2.13 or greater; it falls back to 'git stash save' otherwise.
-rw-r--r--plugins/git/git.plugin.zsh7
1 files changed, 6 insertions, 1 deletions
diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
index a4b6eb977..344419f1e 100644
--- a/plugins/git/git.plugin.zsh
+++ b/plugins/git/git.plugin.zsh
@@ -239,7 +239,12 @@ alias gsps='git show --pretty=short --show-signature'
alias gsr='git svn rebase'
alias gss='git status -s'
alias gst='git status'
-alias gsta='git stash save'
+
+# use the default stash push on git 2.13 and newer
+[[ "$(git --version 2>/dev/null)" =~ '^git version ([0-9]+.[0-9]+)' && "$match" -ge '2.13' ]] \
+ && alias gsta='git stash push'
+ || alias gsta='git stash save'
+
alias gstaa='git stash apply'
alias gstc='git stash clear'
alias gstd='git stash drop'