8eb31a6f9a053ea22ea88ccba3d91a4694674300
- Author
- ncanceill <nicolas.canceill@ens-cachan.org>
- Committer
- ncanceill <nicolas.canceill@ens-cachan.org>
- Date
Message
git plugin: fix ggpnp when called without argument
also allow multiple arguments for ggp and ggl aliases
Diff
1diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
2index dec787a8c28bd524bf4490dac84447bc7ff45cb0..5cceb8d256e2fa5577f1864082dd935ba9d9733d 100644
3--- a/plugins/git/git.plugin.zsh
4+++ b/plugins/git/git.plugin.zsh
5@@ -99,21 +99,29 @@ git push --force origin "${b:=$1}"
6 }
7 compdef _git ggf=git-checkout
8 ggl() {
9-[[ "$#" != 1 ]] && local b="$(current_branch)"
10-git pull origin "${b:=$1}"
11+[[ "$#" == 0 ]] && local b="$(current_branch)"
12+git pull origin "${b:=$1}" "${*[2,-1]}"
13 }
14 compdef _git ggl=git-checkout
15 alias ggpull='ggl'
16 compdef _git ggpull=git-checkout
17 ggp() {
18-[[ "$#" != 1 ]] && local b="$(current_branch)"
19+if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
20+git push origin "${*}"
21+else
22+[[ "$#" == 0 ]] && local b="$(current_branch)"
23 git push origin "${b:=$1}"
24+fi
25 }
26 compdef _git ggp=git-checkout
27 alias ggpush='ggp'
28 compdef _git ggpush=git-checkout
29 ggpnp() {
30-ggl "$1" && ggp "$1"
31+if [[ "$#" == 0 ]]; then
32+ggl && ggp
33+else
34+ggl "${*}" && ggp "${*}"
35+fi
36 }
37 compdef _git ggpnp=git-checkout
38 alias ggsup='git branch --set-upstream-to=origin/$(current_branch)'