summaryrefslogtreecommitdiff
path: root/t/t9902-completion.sh
diff options
context:
space:
mode:
authorSZEDER Gábor <szeder.dev@gmail.com>2017-03-23 15:29:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-03-23 18:18:22 (GMT)
commitaed3881359027921afffae2c6da853034a42c64d (patch)
treed52b3b481ae8e3e82f4d25da1a5cee706eb60028 /t/t9902-completion.sh
parentaa0644f74f68d7ae7f3a6954535aa979dcea22cf (diff)
downloadgit-aed3881359027921afffae2c6da853034a42c64d.zip
git-aed3881359027921afffae2c6da853034a42c64d.tar.gz
git-aed3881359027921afffae2c6da853034a42c64d.tar.bz2
completion: support excluding full refs
Commit 49416ad22 (completion: support excluding refs, 2016-08-24) made possible to complete short refs with a '^' prefix. Extend the support to full refs to make completing '^refs/...' work. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9902-completion.sh')
-rwxr-xr-xt/t9902-completion.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index f641d99..e2b45f6 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -806,6 +806,37 @@ test_expect_success '__git_refs - after --opt= - full refs' '
test_cmp expected "$actual"
'
+test_expect_success '__git refs - exluding refs' '
+ cat >expected <<-EOF &&
+ ^HEAD
+ ^master
+ ^matching-branch
+ ^other/branch-in-other
+ ^other/master-in-other
+ ^matching-tag
+ EOF
+ (
+ cur=^ &&
+ __git_refs >"$actual"
+ ) &&
+ test_cmp expected "$actual"
+'
+
+test_expect_success '__git refs - exluding full refs' '
+ cat >expected <<-EOF &&
+ ^refs/heads/master
+ ^refs/heads/matching-branch
+ ^refs/remotes/other/branch-in-other
+ ^refs/remotes/other/master-in-other
+ ^refs/tags/matching-tag
+ EOF
+ (
+ cur=^refs/ &&
+ __git_refs >"$actual"
+ ) &&
+ test_cmp expected "$actual"
+'
+
test_expect_success '__git_complete_refs - simple' '
sed -e "s/Z$//" >expected <<-EOF &&
HEAD Z