summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2020-11-10 02:03:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-11-10 02:09:21 (GMT)
commit9414938c348f47c76dcea7826ea0b22adb585300 (patch)
tree97284598bbf3e3350d51b0364b7c0b82e8c8ba39 /t
parente4d83eee9239207622e2b1cc43967da5051c189c (diff)
downloadgit-9414938c348f47c76dcea7826ea0b22adb585300.zip
git-9414938c348f47c76dcea7826ea0b22adb585300.tar.gz
git-9414938c348f47c76dcea7826ea0b22adb585300.tar.bz2
completion: bash: support recursive aliases
It is possible to have recursive aliases like: l = log --oneline lg = l --graph So the completion should detect such aliases as well. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t9902-completion.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index 2be9190..5c01c75 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -2195,6 +2195,25 @@ test_expect_success 'complete files' '
test_completion "git add mom" "momified"
'
+test_expect_success "simple alias" '
+ test_config alias.co checkout &&
+ test_completion "git co m" <<-\EOF
+ master Z
+ mybranch Z
+ mytag Z
+ EOF
+'
+
+test_expect_success "recursive alias" '
+ test_config alias.co checkout &&
+ test_config alias.cod "co --detached" &&
+ test_completion "git cod m" <<-\EOF
+ master Z
+ mybranch Z
+ mytag Z
+ EOF
+'
+
test_expect_success "completion uses <cmd> completion for alias: !sh -c 'git <cmd> ...'" '
test_config alias.co "!sh -c '"'"'git checkout ...'"'"'" &&
test_completion "git co m" <<-\EOF