|
| 1 | +test_expect_success "setup git config for remote-tracking of special refs" ' |
| 2 | + ( |
| 3 | + cd workbench && |
| 4 | + if ! git config --get-all remote.origin.fetch | grep refs/for/ |
| 5 | + then |
| 6 | + git config --add remote.origin.fetch \ |
| 7 | + "+refs/for/*:refs/t/for/*" && |
| 8 | + git config --add remote.origin.fetch \ |
| 9 | + "+refs/pull/*:refs/t/pull/*" && |
| 10 | + git config --add remote.origin.fetch \ |
| 11 | + "+refs/changes/*:refs/t/changes/*" |
| 12 | + fi |
| 13 | + ) |
| 14 | +' |
| 15 | + |
1 | 16 | test_expect_success "setup proc-receive hook (multiple rewrites for one ref, no refname for the 1st rewrite, $PROTOCOL)" '
|
2 | 17 | write_script "$upstream/hooks/proc-receive" <<-EOF
|
3 | 18 | printf >&2 "# proc-receive hook\n"
|
@@ -58,6 +73,17 @@ test_expect_success "proc-receive: multiple rewrite for one ref, no refname for
|
58 | 73 | test_cmp expect actual
|
59 | 74 | '
|
60 | 75 |
|
| 76 | +test_expect_success "proc-receive: check remote-tracking #1 ($PROTOCOL)" ' |
| 77 | + git -C workbench show-ref | |
| 78 | + grep -v -e refs/remotes -e refs/heads -e refs/tags >out && |
| 79 | + make_user_friendly_and_stable_output <out >actual && |
| 80 | + cat >expect <<-EOF && |
| 81 | + <COMMIT-A> refs/t/for/master/topic |
| 82 | + EOF |
| 83 | + test_cmp expect actual && |
| 84 | + git -C workbench update-ref -d refs/t/for/master/topic |
| 85 | +' |
| 86 | + |
61 | 87 | test_expect_success "setup proc-receive hook (multiple rewrites for one ref, no refname for the 2nd rewrite, $PROTOCOL)" '
|
62 | 88 | write_script "$upstream/hooks/proc-receive" <<-EOF
|
63 | 89 | printf >&2 "# proc-receive hook\n"
|
@@ -120,6 +146,17 @@ test_expect_success "proc-receive: multiple rewrites for one ref, no refname for
|
120 | 146 | test_cmp expect actual
|
121 | 147 | '
|
122 | 148 |
|
| 149 | +test_expect_success "proc-receive: check remote-tracking #2 ($PROTOCOL)" ' |
| 150 | + git -C workbench show-ref | |
| 151 | + grep -v -e refs/remotes -e refs/heads -e refs/tags >out && |
| 152 | + make_user_friendly_and_stable_output <out >actual && |
| 153 | + cat >expect <<-EOF && |
| 154 | + <COMMIT-A> refs/t/for/master/topic |
| 155 | + EOF |
| 156 | + test_cmp expect actual && |
| 157 | + git -C workbench update-ref -d refs/t/for/master/topic |
| 158 | +' |
| 159 | + |
123 | 160 | test_expect_success "setup proc-receive hook (multiple rewrites for one ref, $PROTOCOL)" '
|
124 | 161 | write_script "$upstream/hooks/proc-receive" <<-EOF
|
125 | 162 | printf >&2 "# proc-receive hook\n"
|
@@ -167,3 +204,14 @@ test_expect_success "proc-receive: multiple rewrites for one ref ($PROTOCOL)" '
|
167 | 204 | EOF
|
168 | 205 | test_cmp expect actual
|
169 | 206 | '
|
| 207 | + |
| 208 | +test_expect_success "proc-receive: check remote-tracking #3 ($PROTOCOL)" ' |
| 209 | + git -C workbench show-ref | |
| 210 | + grep -v -e refs/remotes -e refs/heads -e refs/tags >out && |
| 211 | + make_user_friendly_and_stable_output <out >actual && |
| 212 | + cat >expect <<-EOF && |
| 213 | + <COMMIT-A> refs/t/for/master/topic |
| 214 | + EOF |
| 215 | + test_cmp expect actual && |
| 216 | + git -C workbench update-ref -d refs/t/for/master/topic |
| 217 | +' |
0 commit comments