File tree Expand file tree Collapse file tree 3 files changed +21
-28
lines changed Expand file tree Collapse file tree 3 files changed +21
-28
lines changed Original file line number Diff line number Diff line change @@ -855,22 +855,26 @@ __git_compute_merge_strategies ()
855
855
856
856
__git_complete_revlist_file ()
857
857
{
858
- local pfx ls ref cur_=" $cur "
858
+ local dequoted_word pfx ls ref cur_=" $cur "
859
859
case " $cur_ " in
860
860
* ..?* :* )
861
861
return
862
862
;;
863
863
?* :* )
864
864
ref=" ${cur_%%:* } "
865
865
cur_=" ${cur_#*: } "
866
- case " $cur_ " in
866
+
867
+ __git_dequote " $cur_ "
868
+
869
+ case " $dequoted_word " in
867
870
?* /* )
868
- pfx=" ${cur_ %/* } "
869
- cur_=" ${cur_ ##*/ } "
871
+ pfx=" ${dequoted_word %/* } "
872
+ cur_=" ${dequoted_word ##*/ } "
870
873
ls=" $ref :$pfx "
871
874
pfx=" $pfx /"
872
875
;;
873
876
* )
877
+ cur_=" $dequoted_word "
874
878
ls=" $ref "
875
879
;;
876
880
esac
@@ -880,21 +884,10 @@ __git_complete_revlist_file ()
880
884
* ) pfx=" $ref :$pfx " ;;
881
885
esac
882
886
883
- __gitcomp_nl " $( __git ls-tree " $ls " \
884
- | sed ' /^100... blob /{
885
- s,^.* ,,
886
- s,$, ,
887
- }
888
- /^120000 blob /{
889
- s,^.* ,,
890
- s,$, ,
891
- }
892
- /^040000 tree /{
893
- s,^.* ,,
894
- s,$,/,
895
- }
896
- s/^.* //' ) " \
897
- " $pfx " " $cur_ " " "
887
+ __gitcomp_file " $( __git ls-tree " $ls " \
888
+ | sed ' s/^.* //
889
+ s/$//' ) " \
890
+ " $pfx " " $cur_ "
898
891
;;
899
892
* ...* )
900
893
pfx=" ${cur_% ...* } ..."
@@ -2993,7 +2986,7 @@ if [[ -n ${ZSH_VERSION-} ]] &&
2993
2986
2994
2987
local IFS=$' \n '
2995
2988
compset -P ' *[=:]'
2996
- compadd -Q - f -- ${=1} && _ret=0
2989
+ compadd -f -- ${=1} && _ret=0
2997
2990
}
2998
2991
2999
2992
__gitcomp_file ()
@@ -3002,7 +2995,7 @@ if [[ -n ${ZSH_VERSION-} ]] &&
3002
2995
3003
2996
local IFS=$' \n '
3004
2997
compset -P ' *[=:]'
3005
- compadd -Q - p " ${2-} " -f -- ${=1} && _ret=0
2998
+ compadd -p " ${2-} " -f -- ${=1} && _ret=0
3006
2999
}
3007
3000
3008
3001
_git ()
Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ __gitcomp_file_direct ()
99
99
100
100
local IFS=$' \n '
101
101
compset -P ' *[=:]'
102
- compadd -Q - f -- ${=1} && _ret=0
102
+ compadd -f -- ${=1} && _ret=0
103
103
}
104
104
105
105
__gitcomp_file ()
@@ -108,7 +108,7 @@ __gitcomp_file ()
108
108
109
109
local IFS=$' \n '
110
110
compset -P ' *[=:]'
111
- compadd -Q - p " ${2-} " -f -- ${=1} && _ret=0
111
+ compadd -p " ${2-} " -f -- ${=1} && _ret=0
112
112
}
113
113
114
114
__git_zsh_bash_func ()
Original file line number Diff line number Diff line change @@ -1516,8 +1516,8 @@ test_expect_success 'show completes all refs' '
1516
1516
1517
1517
test_expect_success ' <ref>: completes paths' '
1518
1518
test_completion "git show mytag:f" <<-\EOF
1519
- file1 Z
1520
- file2 Z
1519
+ file1Z
1520
+ file2Z
1521
1521
EOF
1522
1522
'
1523
1523
@@ -1526,7 +1526,7 @@ test_expect_success 'complete tree filename with spaces' '
1526
1526
git add "name with spaces" &&
1527
1527
git commit -m spaces &&
1528
1528
test_completion "git show HEAD:nam" <<-\EOF
1529
- name with spaces Z
1529
+ name with spacesZ
1530
1530
EOF
1531
1531
'
1532
1532
@@ -1535,8 +1535,8 @@ test_expect_success 'complete tree filename with metacharacters' '
1535
1535
git add "name with \${meta}" &&
1536
1536
git commit -m meta &&
1537
1537
test_completion "git show HEAD:nam" <<-\EOF
1538
- name with ${meta} Z
1539
- name with spaces Z
1538
+ name with ${meta}Z
1539
+ name with spacesZ
1540
1540
EOF
1541
1541
'
1542
1542
You can’t perform that action at this time.
0 commit comments