From 9414938c348f47c76dcea7826ea0b22adb585300 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Mon, 9 Nov 2020 20:03:42 -0600 Subject: 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 Signed-off-by: Junio C Hamano --- t/t9902-completion.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 't') diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 2be9190425..5c01c75d40 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 completion for alias: !sh -c 'git ...'" ' test_config alias.co "!sh -c '"'"'git checkout ...'"'"'" && test_completion "git co m" <<-\EOF -- cgit v1.2.3