3 test_description
='git rev-list --exclude-hidden test'
7 test_expect_success
'setup' '
8 test_commit_bulk --id=commit --ref=refs/heads/branch 1 &&
9 COMMIT=$(git rev-parse refs/heads/branch) &&
10 test_commit_bulk --id=tag --ref=refs/tags/lightweight 1 &&
11 TAG=$(git rev-parse refs/tags/lightweight) &&
12 test_commit_bulk --id=hidden --ref=refs/hidden/commit 1 &&
13 HIDDEN=$(git rev-parse refs/hidden/commit) &&
14 test_commit_bulk --id=namespace --ref=refs/namespaces/namespace/refs/namespaced/commit 1 &&
15 NAMESPACE=$(git rev-parse refs/namespaces/namespace/refs/namespaced/commit)
18 test_expect_success
'invalid section' '
19 echo "fatal: unsupported section for hidden refs: unsupported" >expected &&
20 test_must_fail git rev-list --exclude-hidden=unsupported 2>err &&
24 for section
in receive uploadpack
26 test_expect_success
"$section: passed multiple times" '
27 echo "fatal: --exclude-hidden= passed more than once" >expected &&
28 test_must_fail git rev-list --exclude-hidden=$section --exclude-hidden=$section 2>err &&
32 test_expect_success
"$section: without hiddenRefs" '
33 git rev-list --exclude-hidden=$section --all >out &&
34 cat >expected <<-EOF &&
43 test_expect_success
"$section: hidden via transfer.hideRefs" '
44 git -c transfer.hideRefs=refs/hidden/ rev-list --exclude-hidden=$section --all >out &&
45 cat >expected <<-EOF &&
53 test_expect_success
"$section: hidden via $section.hideRefs" '
54 git -c $section.hideRefs=refs/hidden/ rev-list --exclude-hidden=$section --all >out &&
55 cat >expected <<-EOF &&
63 test_expect_success
"$section: respects both transfer.hideRefs and $section.hideRefs" '
64 git -c transfer.hideRefs=refs/tags/ -c $section.hideRefs=refs/hidden/ rev-list --exclude-hidden=$section --all >out &&
65 cat >expected <<-EOF &&
72 test_expect_success
"$section: negation without hidden refs marks everything as uninteresting" '
73 git rev-list --all --exclude-hidden=$section --not --all >out &&
74 test_must_be_empty out
77 test_expect_success
"$section: negation with hidden refs marks them as interesting" '
78 git -c transfer.hideRefs=refs/hidden/ rev-list --all --exclude-hidden=$section --not --all >out &&
79 cat >expected <<-EOF &&
85 test_expect_success
"$section: hidden refs and excludes work together" '
86 git -c transfer.hideRefs=refs/hidden/ rev-list --exclude=refs/tags/* --exclude-hidden=$section --all >out &&
87 cat >expected <<-EOF &&
94 test_expect_success
"$section: excluded hidden refs get reset" '
95 git -c transfer.hideRefs=refs/ rev-list --exclude-hidden=$section --all --all >out &&
96 cat >expected <<-EOF &&
102 test_cmp expected out
105 test_expect_success
"$section: excluded hidden refs can be used with multiple pseudo-refs" '
106 git -c transfer.hideRefs=refs/ rev-list --exclude-hidden=$section --all --exclude-hidden=$section --all >out &&
107 test_must_be_empty out
110 test_expect_success
"$section: works with --glob" '
111 git -c transfer.hideRefs=refs/hidden/ rev-list --exclude-hidden=$section --glob=refs/h* >out &&
112 cat >expected <<-EOF &&
115 test_cmp expected out
118 test_expect_success
"$section: operates on stripped refs by default" '
119 GIT_NAMESPACE=namespace git -c transfer.hideRefs=refs/namespaced/ rev-list --exclude-hidden=$section --all >out &&
120 cat >expected <<-EOF &&
125 test_cmp expected out
128 test_expect_success
"$section: does not hide namespace by default" '
129 GIT_NAMESPACE=namespace git -c transfer.hideRefs=refs/namespaces/namespace/ rev-list --exclude-hidden=$section --all >out &&
130 cat >expected <<-EOF &&
136 test_cmp expected out
139 test_expect_success
"$section: can operate on unstripped refs" '
140 GIT_NAMESPACE=namespace git -c transfer.hideRefs=^refs/namespaces/namespace/ rev-list --exclude-hidden=$section --all >out &&
141 cat >expected <<-EOF &&
146 test_cmp expected out
149 for pseudoopt
in remotes branches tags
151 test_expect_success
"$section: fails with --$pseudoopt" '
152 test_must_fail git rev-list --exclude-hidden=$section --$pseudoopt 2>err &&
153 test_i18ngrep "error: --exclude-hidden cannot be used together with --$pseudoopt" err
156 test_expect_success
"$section: fails with --$pseudoopt=pattern" '
157 test_must_fail git rev-list --exclude-hidden=$section --$pseudoopt=pattern 2>err &&
158 test_i18ngrep "error: --exclude-hidden cannot be used together with --$pseudoopt" err