f513999a4dbfea3a15287368848a718543fcaf7b
- Author
- ncanceill <nicolas.canceill@ens-cachan.org>
- Committer
- ncanceill <nicolas.canceill@ens-cachan.org>
- Date
Message
git plugin: make b local in gg* functions
because it leaked, and led to #3991
Diff
1diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
2index 7db43351a0837850d6f4c5bc2e051b9eb5f88419..dec787a8c28bd524bf4490dac84447bc7ff45cb0 100644
3--- a/plugins/git/git.plugin.zsh
4+++ b/plugins/git/git.plugin.zsh
5@@ -94,19 +94,19 @@ alias gfo='git fetch origin'
6 alias gg='git gui citool'
7 alias gga='git gui citool --amend'
8 ggf() {
9-[[ "$#" != 1 ]] && b="$(current_branch)"
10+[[ "$#" != 1 ]] && local b="$(current_branch)"
11 git push --force origin "${b:=$1}"
12 }
13 compdef _git ggf=git-checkout
14 ggl() {
15-[[ "$#" != 1 ]] && b="$(current_branch)"
16+[[ "$#" != 1 ]] && local b="$(current_branch)"
17 git pull origin "${b:=$1}"
18 }
19 compdef _git ggl=git-checkout
20 alias ggpull='ggl'
21 compdef _git ggpull=git-checkout
22 ggp() {
23-[[ "$#" != 1 ]] && b="$(current_branch)"
24+[[ "$#" != 1 ]] && local b="$(current_branch)"
25 git push origin "${b:=$1}"
26 }
27 compdef _git ggp=git-checkout
28@@ -118,7 +118,7 @@ ggl "$1" && ggp "$1"
29 compdef _git ggpnp=git-checkout
30 alias ggsup='git branch --set-upstream-to=origin/$(current_branch)'
31 ggu() {
32-[[ "$#" != 1 ]] && b="$(current_branch)"
33+[[ "$#" != 1 ]] && local b="$(current_branch)"
34 git pull --rebase origin "${b:=$1}"
35 }
36 compdef _git ggu=git-checkout