@@ -491,18 +491,20 @@ __gitcomp ()
491
491
{
492
492
local cur
493
493
_get_comp_words_by_ref -n =: cur
494
+ local cur_=" $cur "
495
+
494
496
if [ $# -gt 2 ]; then
495
- cur =" $3 "
497
+ cur_ =" $3 "
496
498
fi
497
- case " $cur " in
499
+ case " $cur_ " in
498
500
--* =)
499
501
COMPREPLY=()
500
502
;;
501
503
* )
502
504
local IFS=$' \n '
503
505
COMPREPLY=($( compgen -P " ${2-} " \
504
506
-W " $( __gitcomp_1 " ${1-} " " ${4-} " ) " \
505
- -- " $cur " ) )
507
+ -- " $cur_ " ) )
506
508
;;
507
509
esac
508
510
}
@@ -668,17 +670,18 @@ __git_complete_revlist_file ()
668
670
{
669
671
local pfx ls ref cur
670
672
_get_comp_words_by_ref -n =: cur
671
- case " $cur " in
673
+ local cur_=" $cur "
674
+ case " $cur_ " in
672
675
* ..?* :* )
673
676
return
674
677
;;
675
678
?* :* )
676
- ref=" ${cur %%:* } "
677
- cur =" ${cur #*: } "
678
- case " $cur " in
679
+ ref=" ${cur_ %%:* } "
680
+ cur_ =" ${cur_ #*: } "
681
+ case " $cur_ " in
679
682
?* /* )
680
- pfx=" ${cur %/* } "
681
- cur =" ${cur ##*/ } "
683
+ pfx=" ${cur_ %/* } "
684
+ cur_ =" ${cur_ ##*/ } "
682
685
ls=" $ref :$pfx "
683
686
pfx=" $pfx /"
684
687
;;
@@ -708,17 +711,17 @@ __git_complete_revlist_file ()
708
711
s,$,/,
709
712
}
710
713
s/^.* //' ) " \
711
- -- " $cur " ) )
714
+ -- " $cur_ " ) )
712
715
;;
713
716
* ...* )
714
- pfx=" ${cur % ...* } ..."
715
- cur =" ${cur #* ...} "
716
- __gitcomp " $( __git_refs) " " $pfx " " $cur "
717
+ pfx=" ${cur_ % ...* } ..."
718
+ cur_ =" ${cur_ #* ...} "
719
+ __gitcomp " $( __git_refs) " " $pfx " " $cur_ "
717
720
;;
718
721
* ..* )
719
- pfx=" ${cur % ..* } .."
720
- cur =" ${cur #* ..} "
721
- __gitcomp " $( __git_refs) " " $pfx " " $cur "
722
+ pfx=" ${cur_ % ..* } .."
723
+ cur_ =" ${cur_ #* ..} "
724
+ __gitcomp " $( __git_refs) " " $pfx " " $cur_ "
722
725
;;
723
726
* )
724
727
__gitcomp " $( __git_refs) "
@@ -741,7 +744,7 @@ __git_complete_remote_or_refspec ()
741
744
{
742
745
local cur words cword
743
746
_get_comp_words_by_ref -n =: cur words cword
744
- local cmd=" ${words[1]} "
747
+ local cur_= " $cur " cmd=" ${words[1]} "
745
748
local i c=2 remote=" " pfx=" " lhs=1 no_complete_refspec=0
746
749
while [ $c -lt $cword ]; do
747
750
i=" ${words[c]} "
@@ -771,40 +774,40 @@ __git_complete_remote_or_refspec ()
771
774
return
772
775
fi
773
776
[ " $remote " = " ." ] && remote=
774
- case " $cur " in
777
+ case " $cur_ " in
775
778
* :* )
776
779
case " $COMP_WORDBREAKS " in
777
780
* :* ) : great ;;
778
- * ) pfx=" ${cur %%:* } :" ;;
781
+ * ) pfx=" ${cur_ %%:* } :" ;;
779
782
esac
780
- cur =" ${cur #*: } "
783
+ cur_ =" ${cur_ #*: } "
781
784
lhs=0
782
785
;;
783
786
+* )
784
787
pfx=" +"
785
- cur =" ${cur # +} "
788
+ cur_ =" ${cur_ # +} "
786
789
;;
787
790
esac
788
791
case " $cmd " in
789
792
fetch)
790
793
if [ $lhs = 1 ]; then
791
- __gitcomp " $( __git_refs2 " $remote " ) " " $pfx " " $cur "
794
+ __gitcomp " $( __git_refs2 " $remote " ) " " $pfx " " $cur_ "
792
795
else
793
- __gitcomp " $( __git_refs) " " $pfx " " $cur "
796
+ __gitcomp " $( __git_refs) " " $pfx " " $cur_ "
794
797
fi
795
798
;;
796
799
pull)
797
800
if [ $lhs = 1 ]; then
798
- __gitcomp " $( __git_refs " $remote " ) " " $pfx " " $cur "
801
+ __gitcomp " $( __git_refs " $remote " ) " " $pfx " " $cur_ "
799
802
else
800
- __gitcomp " $( __git_refs) " " $pfx " " $cur "
803
+ __gitcomp " $( __git_refs) " " $pfx " " $cur_ "
801
804
fi
802
805
;;
803
806
push)
804
807
if [ $lhs = 1 ]; then
805
- __gitcomp " $( __git_refs) " " $pfx " " $cur "
808
+ __gitcomp " $( __git_refs) " " $pfx " " $cur_ "
806
809
else
807
- __gitcomp " $( __git_refs " $remote " ) " " $pfx " " $cur "
810
+ __gitcomp " $( __git_refs " $remote " ) " " $pfx " " $cur_ "
808
811
fi
809
812
;;
810
813
esac
@@ -2012,70 +2015,60 @@ _git_config ()
2012
2015
return
2013
2016
;;
2014
2017
branch.* .* )
2015
- local pfx=" ${cur% .* } ."
2016
- cur=" ${cur##* .} "
2017
- __gitcomp " remote merge mergeoptions rebase" " $pfx " " $cur "
2018
+ local pfx=" ${cur% .* } ." cur_=" ${cur##* .} "
2019
+ __gitcomp " remote merge mergeoptions rebase" " $pfx " " $cur_ "
2018
2020
return
2019
2021
;;
2020
2022
branch.* )
2021
- local pfx=" ${cur% .* } ."
2022
- cur=" ${cur#* .} "
2023
- __gitcomp " $( __git_heads) " " $pfx " " $cur " " ."
2023
+ local pfx=" ${cur% .* } ." cur_=" ${cur#* .} "
2024
+ __gitcomp " $( __git_heads) " " $pfx " " $cur_ " " ."
2024
2025
return
2025
2026
;;
2026
2027
guitool.* .* )
2027
- local pfx=" ${cur% .* } ."
2028
- cur=" ${cur##* .} "
2028
+ local pfx=" ${cur% .* } ." cur_=" ${cur##* .} "
2029
2029
__gitcomp "
2030
2030
argprompt cmd confirm needsfile noconsole norescan
2031
2031
prompt revprompt revunmerged title
2032
- " " $pfx " " $cur "
2032
+ " " $pfx " " $cur_ "
2033
2033
return
2034
2034
;;
2035
2035
difftool.* .* )
2036
- local pfx=" ${cur% .* } ."
2037
- cur=" ${cur##* .} "
2038
- __gitcomp " cmd path" " $pfx " " $cur "
2036
+ local pfx=" ${cur% .* } ." cur_=" ${cur##* .} "
2037
+ __gitcomp " cmd path" " $pfx " " $cur_ "
2039
2038
return
2040
2039
;;
2041
2040
man.* .* )
2042
- local pfx=" ${cur% .* } ."
2043
- cur=" ${cur##* .} "
2044
- __gitcomp " cmd path" " $pfx " " $cur "
2041
+ local pfx=" ${cur% .* } ." cur_=" ${cur##* .} "
2042
+ __gitcomp " cmd path" " $pfx " " $cur_ "
2045
2043
return
2046
2044
;;
2047
2045
mergetool.* .* )
2048
- local pfx=" ${cur% .* } ."
2049
- cur=" ${cur##* .} "
2050
- __gitcomp " cmd path trustExitCode" " $pfx " " $cur "
2046
+ local pfx=" ${cur% .* } ." cur_=" ${cur##* .} "
2047
+ __gitcomp " cmd path trustExitCode" " $pfx " " $cur_ "
2051
2048
return
2052
2049
;;
2053
2050
pager.* )
2054
- local pfx=" ${cur% .* } ."
2055
- cur=" ${cur#* .} "
2051
+ local pfx=" ${cur% .* } ." cur_=" ${cur#* .} "
2056
2052
__git_compute_all_commands
2057
- __gitcomp " $__git_all_commands " " $pfx " " $cur "
2053
+ __gitcomp " $__git_all_commands " " $pfx " " $cur_ "
2058
2054
return
2059
2055
;;
2060
2056
remote.* .* )
2061
- local pfx=" ${cur% .* } ."
2062
- cur=" ${cur##* .} "
2057
+ local pfx=" ${cur% .* } ." cur_=" ${cur##* .} "
2063
2058
__gitcomp "
2064
2059
url proxy fetch push mirror skipDefaultUpdate
2065
2060
receivepack uploadpack tagopt pushurl
2066
- " " $pfx " " $cur "
2061
+ " " $pfx " " $cur_ "
2067
2062
return
2068
2063
;;
2069
2064
remote.* )
2070
- local pfx=" ${cur% .* } ."
2071
- cur=" ${cur#* .} "
2072
- __gitcomp " $( __git_remotes) " " $pfx " " $cur " " ."
2065
+ local pfx=" ${cur% .* } ." cur_=" ${cur#* .} "
2066
+ __gitcomp " $( __git_remotes) " " $pfx " " $cur_ " " ."
2073
2067
return
2074
2068
;;
2075
2069
url.* .* )
2076
- local pfx=" ${cur% .* } ."
2077
- cur=" ${cur##* .} "
2078
- __gitcomp " insteadOf pushInsteadOf" " $pfx " " $cur "
2070
+ local pfx=" ${cur% .* } ." cur_=" ${cur##* .} "
2071
+ __gitcomp " insteadOf pushInsteadOf" " $pfx " " $cur_ "
2079
2072
return
2080
2073
;;
2081
2074
esac
0 commit comments