]>
Commit | Line | Data |
---|---|---|
96b2d4fa AP |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2007 Andy Parkins | |
4 | # | |
5 | ||
6 | test_description='for-each-ref test' | |
7 | ||
8 | . ./test-lib.sh | |
e2b23972 | 9 | . "$TEST_DIRECTORY"/lib-gpg.sh |
11b087ad | 10 | . "$TEST_DIRECTORY"/lib-terminal.sh |
96b2d4fa | 11 | |
db7bae25 JK |
12 | # Mon Jul 3 23:18:43 2006 +0000 |
13 | datestamp=1151968723 | |
96b2d4fa AP |
14 | setdate_and_increment () { |
15 | GIT_COMMITTER_DATE="$datestamp +0200" | |
16 | datestamp=$(expr "$datestamp" + 1) | |
17 | GIT_AUTHOR_DATE="$datestamp +0200" | |
18 | datestamp=$(expr "$datestamp" + 1) | |
19 | export GIT_COMMITTER_DATE GIT_AUTHOR_DATE | |
20 | } | |
21 | ||
bc147968 | 22 | test_expect_success setup ' |
1f5f8f3e | 23 | test_oid_cache <<-EOF && |
24 | disklen sha1:138 | |
25 | disklen sha256:154 | |
26 | EOF | |
96b2d4fa AP |
27 | setdate_and_increment && |
28 | echo "Using $datestamp" > one && | |
29 | git add one && | |
30 | git commit -m "Initial" && | |
31 | setdate_and_increment && | |
bc147968 | 32 | git tag -a -m "Tagging at $datestamp" testtag && |
8cae19d9 JK |
33 | git update-ref refs/remotes/origin/master master && |
34 | git remote add origin nowhere && | |
35 | git config branch.master.remote origin && | |
29bc8850 JK |
36 | git config branch.master.merge refs/heads/master && |
37 | git remote add myfork elsewhere && | |
38 | git config remote.pushdefault myfork && | |
39 | git config push.default current | |
8cae19d9 JK |
40 | ' |
41 | ||
d2bf48d2 JK |
42 | test_atom() { |
43 | case "$1" in | |
44 | head) ref=refs/heads/master ;; | |
45 | tag) ref=refs/tags/testtag ;; | |
01f95825 | 46 | sym) ref=refs/heads/sym ;; |
7140c22c | 47 | *) ref=$1 ;; |
d2bf48d2 JK |
48 | esac |
49 | printf '%s\n' "$3" >expected | |
e2b23972 | 50 | test_expect_${4:-success} $PREREQ "basic atom: $1 $2" " |
d2bf48d2 | 51 | git for-each-ref --format='%($2)' $ref >actual && |
e2b23972 MG |
52 | sanitize_pgp <actual >actual.clean && |
53 | test_cmp expected actual.clean | |
d2bf48d2 JK |
54 | " |
55 | } | |
56 | ||
1f5f8f3e | 57 | hexlen=$(test_oid hexsz) |
58 | disklen=$(test_oid disklen) | |
59 | ||
d2bf48d2 | 60 | test_atom head refname refs/heads/master |
bea4dbea | 61 | test_atom head refname: refs/heads/master |
1d094db9 | 62 | test_atom head refname:short master |
17938f17 KN |
63 | test_atom head refname:lstrip=1 heads/master |
64 | test_atom head refname:lstrip=2 master | |
1a0ca5e3 KN |
65 | test_atom head refname:lstrip=-1 master |
66 | test_atom head refname:lstrip=-2 heads/master | |
1a34728e KN |
67 | test_atom head refname:rstrip=1 refs/heads |
68 | test_atom head refname:rstrip=2 refs | |
69 | test_atom head refname:rstrip=-1 refs | |
70 | test_atom head refname:rstrip=-2 refs/heads | |
44a6b6ce JH |
71 | test_atom head refname:strip=1 heads/master |
72 | test_atom head refname:strip=2 master | |
73 | test_atom head refname:strip=-1 master | |
74 | test_atom head refname:strip=-2 heads/master | |
8cae19d9 | 75 | test_atom head upstream refs/remotes/origin/master |
1d094db9 | 76 | test_atom head upstream:short origin/master |
17938f17 | 77 | test_atom head upstream:lstrip=2 origin/master |
1a0ca5e3 | 78 | test_atom head upstream:lstrip=-2 origin/master |
1a34728e KN |
79 | test_atom head upstream:rstrip=2 refs/remotes |
80 | test_atom head upstream:rstrip=-2 refs/remotes | |
44a6b6ce JH |
81 | test_atom head upstream:strip=2 origin/master |
82 | test_atom head upstream:strip=-2 origin/master | |
29bc8850 | 83 | test_atom head push refs/remotes/myfork/master |
1d094db9 | 84 | test_atom head push:short myfork/master |
17938f17 | 85 | test_atom head push:lstrip=1 remotes/myfork/master |
1a0ca5e3 | 86 | test_atom head push:lstrip=-1 master |
1a34728e KN |
87 | test_atom head push:rstrip=1 refs/remotes/myfork |
88 | test_atom head push:rstrip=-1 refs | |
44a6b6ce JH |
89 | test_atom head push:strip=1 remotes/myfork/master |
90 | test_atom head push:strip=-1 master | |
d2bf48d2 | 91 | test_atom head objecttype commit |
1f5f8f3e | 92 | test_atom head objectsize $((131 + hexlen)) |
93 | test_atom head objectsize:disk $disklen | |
94 | test_atom head deltabase $ZERO_OID | |
189a5467 | 95 | test_atom head objectname $(git rev-parse refs/heads/master) |
1d094db9 | 96 | test_atom head objectname:short $(git rev-parse --short refs/heads/master) |
42d0eb05 KN |
97 | test_atom head objectname:short=1 $(git rev-parse --short=1 refs/heads/master) |
98 | test_atom head objectname:short=10 $(git rev-parse --short=10 refs/heads/master) | |
189a5467 | 99 | test_atom head tree $(git rev-parse refs/heads/master^{tree}) |
d2bf48d2 JK |
100 | test_atom head parent '' |
101 | test_atom head numparent 0 | |
102 | test_atom head object '' | |
103 | test_atom head type '' | |
b74cf648 JK |
104 | test_atom head '*objectname' '' |
105 | test_atom head '*objecttype' '' | |
db7bae25 | 106 | test_atom head author 'A U Thor <author@example.com> 1151968724 +0200' |
d2bf48d2 JK |
107 | test_atom head authorname 'A U Thor' |
108 | test_atom head authoremail '<author@example.com>' | |
db7bae25 JK |
109 | test_atom head authordate 'Tue Jul 4 01:18:44 2006 +0200' |
110 | test_atom head committer 'C O Mitter <committer@example.com> 1151968723 +0200' | |
d2bf48d2 JK |
111 | test_atom head committername 'C O Mitter' |
112 | test_atom head committeremail '<committer@example.com>' | |
db7bae25 | 113 | test_atom head committerdate 'Tue Jul 4 01:18:43 2006 +0200' |
d2bf48d2 JK |
114 | test_atom head tag '' |
115 | test_atom head tagger '' | |
116 | test_atom head taggername '' | |
117 | test_atom head taggeremail '' | |
118 | test_atom head taggerdate '' | |
db7bae25 JK |
119 | test_atom head creator 'C O Mitter <committer@example.com> 1151968723 +0200' |
120 | test_atom head creatordate 'Tue Jul 4 01:18:43 2006 +0200' | |
d2bf48d2 | 121 | test_atom head subject 'Initial' |
e2b23972 | 122 | test_atom head contents:subject 'Initial' |
d2bf48d2 | 123 | test_atom head body '' |
e2b23972 MG |
124 | test_atom head contents:body '' |
125 | test_atom head contents:signature '' | |
d2bf48d2 JK |
126 | test_atom head contents 'Initial |
127 | ' | |
7a48b832 | 128 | test_atom head HEAD '*' |
d2bf48d2 JK |
129 | |
130 | test_atom tag refname refs/tags/testtag | |
1d094db9 | 131 | test_atom tag refname:short testtag |
8cae19d9 | 132 | test_atom tag upstream '' |
29bc8850 | 133 | test_atom tag push '' |
d2bf48d2 | 134 | test_atom tag objecttype tag |
1f5f8f3e | 135 | test_atom tag objectsize $((114 + hexlen)) |
136 | test_atom tag objectsize:disk $disklen | |
137 | test_atom tag '*objectsize:disk' $disklen | |
138 | test_atom tag deltabase $ZERO_OID | |
139 | test_atom tag '*deltabase' $ZERO_OID | |
189a5467 | 140 | test_atom tag objectname $(git rev-parse refs/tags/testtag) |
1d094db9 | 141 | test_atom tag objectname:short $(git rev-parse --short refs/tags/testtag) |
42d0eb05 KN |
142 | test_atom head objectname:short=1 $(git rev-parse --short=1 refs/heads/master) |
143 | test_atom head objectname:short=10 $(git rev-parse --short=10 refs/heads/master) | |
d2bf48d2 JK |
144 | test_atom tag tree '' |
145 | test_atom tag parent '' | |
146 | test_atom tag numparent '' | |
189a5467 | 147 | test_atom tag object $(git rev-parse refs/tags/testtag^0) |
d2bf48d2 | 148 | test_atom tag type 'commit' |
1f5f8f3e | 149 | test_atom tag '*objectname' $(git rev-parse refs/tags/testtag^{}) |
b74cf648 | 150 | test_atom tag '*objecttype' 'commit' |
d2bf48d2 JK |
151 | test_atom tag author '' |
152 | test_atom tag authorname '' | |
153 | test_atom tag authoremail '' | |
154 | test_atom tag authordate '' | |
155 | test_atom tag committer '' | |
156 | test_atom tag committername '' | |
157 | test_atom tag committeremail '' | |
158 | test_atom tag committerdate '' | |
159 | test_atom tag tag 'testtag' | |
db7bae25 | 160 | test_atom tag tagger 'C O Mitter <committer@example.com> 1151968725 +0200' |
d2bf48d2 JK |
161 | test_atom tag taggername 'C O Mitter' |
162 | test_atom tag taggeremail '<committer@example.com>' | |
db7bae25 JK |
163 | test_atom tag taggerdate 'Tue Jul 4 01:18:45 2006 +0200' |
164 | test_atom tag creator 'C O Mitter <committer@example.com> 1151968725 +0200' | |
165 | test_atom tag creatordate 'Tue Jul 4 01:18:45 2006 +0200' | |
166 | test_atom tag subject 'Tagging at 1151968727' | |
167 | test_atom tag contents:subject 'Tagging at 1151968727' | |
d2bf48d2 | 168 | test_atom tag body '' |
e2b23972 MG |
169 | test_atom tag contents:body '' |
170 | test_atom tag contents:signature '' | |
db7bae25 | 171 | test_atom tag contents 'Tagging at 1151968727 |
96b2d4fa | 172 | ' |
7a48b832 | 173 | test_atom tag HEAD ' ' |
96b2d4fa | 174 | |
41ac414e | 175 | test_expect_success 'Check invalid atoms names are errors' ' |
3604e7c5 | 176 | test_must_fail git for-each-ref --format="%(INVALID)" refs/heads |
96b2d4fa AP |
177 | ' |
178 | ||
179 | test_expect_success 'Check format specifiers are ignored in naming date atoms' ' | |
3604e7c5 NS |
180 | git for-each-ref --format="%(authordate)" refs/heads && |
181 | git for-each-ref --format="%(authordate:default) %(authordate)" refs/heads && | |
182 | git for-each-ref --format="%(authordate) %(authordate:default)" refs/heads && | |
183 | git for-each-ref --format="%(authordate:default) %(authordate:default)" refs/heads | |
96b2d4fa AP |
184 | ' |
185 | ||
186 | test_expect_success 'Check valid format specifiers for date fields' ' | |
3604e7c5 NS |
187 | git for-each-ref --format="%(authordate:default)" refs/heads && |
188 | git for-each-ref --format="%(authordate:relative)" refs/heads && | |
189 | git for-each-ref --format="%(authordate:short)" refs/heads && | |
190 | git for-each-ref --format="%(authordate:local)" refs/heads && | |
191 | git for-each-ref --format="%(authordate:iso8601)" refs/heads && | |
192 | git for-each-ref --format="%(authordate:rfc2822)" refs/heads | |
96b2d4fa AP |
193 | ' |
194 | ||
41ac414e | 195 | test_expect_success 'Check invalid format specifiers are errors' ' |
3604e7c5 | 196 | test_must_fail git for-each-ref --format="%(authordate:INVALID)" refs/heads |
96b2d4fa AP |
197 | ' |
198 | ||
42d0eb05 KN |
199 | test_expect_success 'arguments to %(objectname:short=) must be positive integers' ' |
200 | test_must_fail git for-each-ref --format="%(objectname:short=0)" && | |
201 | test_must_fail git for-each-ref --format="%(objectname:short=-1)" && | |
202 | test_must_fail git for-each-ref --format="%(objectname:short=foo)" | |
203 | ' | |
204 | ||
f95cecf4 JK |
205 | test_date () { |
206 | f=$1 && | |
207 | committer_date=$2 && | |
208 | author_date=$3 && | |
209 | tagger_date=$4 && | |
210 | cat >expected <<-EOF && | |
211 | 'refs/heads/master' '$committer_date' '$author_date' | |
212 | 'refs/tags/testtag' '$tagger_date' | |
213 | EOF | |
214 | ( | |
215 | git for-each-ref --shell \ | |
216 | --format="%(refname) %(committerdate${f:+:$f}) %(authordate${f:+:$f})" \ | |
217 | refs/heads && | |
218 | git for-each-ref --shell \ | |
219 | --format="%(refname) %(taggerdate${f:+:$f})" \ | |
220 | refs/tags | |
221 | ) >actual && | |
222 | test_cmp expected actual | |
223 | } | |
96b2d4fa AP |
224 | |
225 | test_expect_success 'Check unformatted date fields output' ' | |
f95cecf4 | 226 | test_date "" \ |
db7bae25 JK |
227 | "Tue Jul 4 01:18:43 2006 +0200" \ |
228 | "Tue Jul 4 01:18:44 2006 +0200" \ | |
229 | "Tue Jul 4 01:18:45 2006 +0200" | |
96b2d4fa AP |
230 | ' |
231 | ||
232 | test_expect_success 'Check format "default" formatted date fields output' ' | |
f95cecf4 | 233 | test_date default \ |
db7bae25 JK |
234 | "Tue Jul 4 01:18:43 2006 +0200" \ |
235 | "Tue Jul 4 01:18:44 2006 +0200" \ | |
236 | "Tue Jul 4 01:18:45 2006 +0200" | |
96b2d4fa AP |
237 | ' |
238 | ||
99264e93 JK |
239 | test_expect_success 'Check format "default-local" date fields output' ' |
240 | test_date default-local "Mon Jul 3 23:18:43 2006" "Mon Jul 3 23:18:44 2006" "Mon Jul 3 23:18:45 2006" | |
96b2d4fa AP |
241 | ' |
242 | ||
243 | # Don't know how to do relative check because I can't know when this script | |
244 | # is going to be run and can't fake the current time to git, and hence can't | |
245 | # provide expected output. Instead, I'll just make sure that "relative" | |
246 | # doesn't exit in error | |
96b2d4fa AP |
247 | test_expect_success 'Check format "relative" date fields output' ' |
248 | f=relative && | |
249 | (git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads && | |
250 | git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual | |
251 | ' | |
252 | ||
99264e93 JK |
253 | # We just check that this is the same as "relative" for now. |
254 | test_expect_success 'Check format "relative-local" date fields output' ' | |
255 | test_date relative-local \ | |
256 | "$(git for-each-ref --format="%(committerdate:relative)" refs/heads)" \ | |
257 | "$(git for-each-ref --format="%(authordate:relative)" refs/heads)" \ | |
258 | "$(git for-each-ref --format="%(taggerdate:relative)" refs/tags)" | |
259 | ' | |
96b2d4fa AP |
260 | |
261 | test_expect_success 'Check format "short" date fields output' ' | |
db7bae25 | 262 | test_date short 2006-07-04 2006-07-04 2006-07-04 |
96b2d4fa AP |
263 | ' |
264 | ||
99264e93 JK |
265 | test_expect_success 'Check format "short-local" date fields output' ' |
266 | test_date short-local 2006-07-03 2006-07-03 2006-07-03 | |
267 | ' | |
96b2d4fa AP |
268 | |
269 | test_expect_success 'Check format "local" date fields output' ' | |
f95cecf4 | 270 | test_date local \ |
db7bae25 JK |
271 | "Mon Jul 3 23:18:43 2006" \ |
272 | "Mon Jul 3 23:18:44 2006" \ | |
273 | "Mon Jul 3 23:18:45 2006" | |
96b2d4fa AP |
274 | ' |
275 | ||
96b2d4fa | 276 | test_expect_success 'Check format "iso8601" date fields output' ' |
f95cecf4 | 277 | test_date iso8601 \ |
db7bae25 JK |
278 | "2006-07-04 01:18:43 +0200" \ |
279 | "2006-07-04 01:18:44 +0200" \ | |
280 | "2006-07-04 01:18:45 +0200" | |
96b2d4fa AP |
281 | ' |
282 | ||
99264e93 JK |
283 | test_expect_success 'Check format "iso8601-local" date fields output' ' |
284 | test_date iso8601-local "2006-07-03 23:18:43 +0000" "2006-07-03 23:18:44 +0000" "2006-07-03 23:18:45 +0000" | |
285 | ' | |
96b2d4fa AP |
286 | |
287 | test_expect_success 'Check format "rfc2822" date fields output' ' | |
f95cecf4 | 288 | test_date rfc2822 \ |
db7bae25 JK |
289 | "Tue, 4 Jul 2006 01:18:43 +0200" \ |
290 | "Tue, 4 Jul 2006 01:18:44 +0200" \ | |
291 | "Tue, 4 Jul 2006 01:18:45 +0200" | |
96b2d4fa AP |
292 | ' |
293 | ||
99264e93 JK |
294 | test_expect_success 'Check format "rfc2822-local" date fields output' ' |
295 | test_date rfc2822-local "Mon, 3 Jul 2006 23:18:43 +0000" "Mon, 3 Jul 2006 23:18:44 +0000" "Mon, 3 Jul 2006 23:18:45 +0000" | |
296 | ' | |
297 | ||
f3c1ba50 | 298 | test_expect_success 'Check format "raw" date fields output' ' |
db7bae25 | 299 | test_date raw "1151968723 +0200" "1151968724 +0200" "1151968725 +0200" |
f3c1ba50 JK |
300 | ' |
301 | ||
99264e93 JK |
302 | test_expect_success 'Check format "raw-local" date fields output' ' |
303 | test_date raw-local "1151968723 +0000" "1151968724 +0000" "1151968725 +0000" | |
96b2d4fa AP |
304 | ' |
305 | ||
aa1462cc | 306 | test_expect_success 'Check format of strftime date fields' ' |
db7bae25 | 307 | echo "my date is 2006-07-04" >expected && |
aa1462cc JK |
308 | git for-each-ref \ |
309 | --format="%(authordate:format:my date is %Y-%m-%d)" \ | |
310 | refs/heads >actual && | |
311 | test_cmp expected actual | |
312 | ' | |
313 | ||
99264e93 JK |
314 | test_expect_success 'Check format of strftime-local date fields' ' |
315 | echo "my date is 2006-07-03" >expected && | |
316 | git for-each-ref \ | |
317 | --format="%(authordate:format-local:my date is %Y-%m-%d)" \ | |
318 | refs/heads >actual && | |
319 | test_cmp expected actual | |
320 | ' | |
321 | ||
e4f031e3 JK |
322 | test_expect_success 'exercise strftime with odd fields' ' |
323 | echo >expected && | |
324 | git for-each-ref --format="%(authordate:format:)" refs/heads >actual && | |
325 | test_cmp expected actual && | |
8125a58b | 326 | long="long format -- $ZERO_OID$ZERO_OID$ZERO_OID$ZERO_OID$ZERO_OID$ZERO_OID$ZERO_OID" && |
e4f031e3 JK |
327 | echo $long >expected && |
328 | git for-each-ref --format="%(authordate:format:$long)" refs/heads >actual && | |
329 | test_cmp expected actual | |
330 | ' | |
331 | ||
c899a57c LH |
332 | cat >expected <<\EOF |
333 | refs/heads/master | |
8cae19d9 | 334 | refs/remotes/origin/master |
c899a57c LH |
335 | refs/tags/testtag |
336 | EOF | |
337 | ||
338 | test_expect_success 'Verify ascending sort' ' | |
3604e7c5 | 339 | git for-each-ref --format="%(refname)" --sort=refname >actual && |
3af82863 | 340 | test_cmp expected actual |
c899a57c LH |
341 | ' |
342 | ||
343 | ||
344 | cat >expected <<\EOF | |
345 | refs/tags/testtag | |
8cae19d9 | 346 | refs/remotes/origin/master |
c899a57c LH |
347 | refs/heads/master |
348 | EOF | |
349 | ||
350 | test_expect_success 'Verify descending sort' ' | |
3604e7c5 | 351 | git for-each-ref --format="%(refname)" --sort=-refname >actual && |
3af82863 | 352 | test_cmp expected actual |
b31e2680 TB |
353 | ' |
354 | ||
355 | cat >expected <<\EOF | |
356 | refs/tags/testtag | |
357 | refs/tags/testtag-2 | |
358 | EOF | |
359 | ||
360 | test_expect_success 'exercise patterns with prefixes' ' | |
361 | git tag testtag-2 && | |
362 | test_when_finished "git tag -d testtag-2" && | |
363 | git for-each-ref --format="%(refname)" \ | |
364 | refs/tags/testtag refs/tags/testtag-2 >actual && | |
365 | test_cmp expected actual | |
366 | ' | |
367 | ||
368 | cat >expected <<\EOF | |
369 | refs/tags/testtag | |
370 | refs/tags/testtag-2 | |
371 | EOF | |
372 | ||
373 | test_expect_success 'exercise glob patterns with prefixes' ' | |
374 | git tag testtag-2 && | |
375 | test_when_finished "git tag -d testtag-2" && | |
376 | git for-each-ref --format="%(refname)" \ | |
377 | refs/tags/testtag "refs/tags/testtag-*" >actual && | |
378 | test_cmp expected actual | |
c899a57c LH |
379 | ' |
380 | ||
c9ecf4f1 JS |
381 | cat >expected <<\EOF |
382 | 'refs/heads/master' | |
8cae19d9 | 383 | 'refs/remotes/origin/master' |
c9ecf4f1 JS |
384 | 'refs/tags/testtag' |
385 | EOF | |
386 | ||
387 | test_expect_success 'Quoting style: shell' ' | |
388 | git for-each-ref --shell --format="%(refname)" >actual && | |
3af82863 | 389 | test_cmp expected actual |
c9ecf4f1 JS |
390 | ' |
391 | ||
392 | test_expect_success 'Quoting style: perl' ' | |
393 | git for-each-ref --perl --format="%(refname)" >actual && | |
3af82863 | 394 | test_cmp expected actual |
c9ecf4f1 JS |
395 | ' |
396 | ||
397 | test_expect_success 'Quoting style: python' ' | |
398 | git for-each-ref --python --format="%(refname)" >actual && | |
3af82863 | 399 | test_cmp expected actual |
c9ecf4f1 JS |
400 | ' |
401 | ||
402 | cat >expected <<\EOF | |
403 | "refs/heads/master" | |
8cae19d9 | 404 | "refs/remotes/origin/master" |
c9ecf4f1 JS |
405 | "refs/tags/testtag" |
406 | EOF | |
407 | ||
408 | test_expect_success 'Quoting style: tcl' ' | |
409 | git for-each-ref --tcl --format="%(refname)" >actual && | |
3af82863 | 410 | test_cmp expected actual |
c9ecf4f1 JS |
411 | ' |
412 | ||
413 | for i in "--perl --shell" "-s --python" "--python --tcl" "--tcl --perl"; do | |
414 | test_expect_success "more than one quoting style: $i" " | |
2708ef4a SG |
415 | test_must_fail git for-each-ref $i 2>err && |
416 | grep '^error: more than one quoting style' err | |
c9ecf4f1 JS |
417 | " |
418 | done | |
c899a57c | 419 | |
b28061ce RR |
420 | test_expect_success 'setup for upstream:track[short]' ' |
421 | test_commit two | |
422 | ' | |
423 | ||
1d094db9 JK |
424 | test_atom head upstream:track '[ahead 1]' |
425 | test_atom head upstream:trackshort '>' | |
7743fcca KN |
426 | test_atom head upstream:track,nobracket 'ahead 1' |
427 | test_atom head upstream:nobracket,track 'ahead 1' | |
c646d093 DR |
428 | |
429 | test_expect_success 'setup for push:track[short]' ' | |
430 | test_commit third && | |
431 | git update-ref refs/remotes/myfork/master master && | |
432 | git reset master~1 | |
433 | ' | |
434 | ||
435 | test_atom head push:track '[behind 1]' | |
436 | test_atom head push:trackshort '<' | |
b28061ce RR |
437 | |
438 | test_expect_success 'Check that :track[short] cannot be used with other atoms' ' | |
439 | test_must_fail git for-each-ref --format="%(refname:track)" 2>/dev/null && | |
440 | test_must_fail git for-each-ref --format="%(refname:trackshort)" 2>/dev/null | |
441 | ' | |
442 | ||
b6160d95 RKC |
443 | test_expect_success 'Check that :track[short] works when upstream is invalid' ' |
444 | cat >expected <<-\EOF && | |
ffd921d3 | 445 | [gone] |
b6160d95 RKC |
446 | |
447 | EOF | |
448 | test_when_finished "git config branch.master.merge refs/heads/master" && | |
449 | git config branch.master.merge refs/heads/does-not-exist && | |
450 | git for-each-ref \ | |
451 | --format="%(upstream:track)$LF%(upstream:trackshort)" \ | |
452 | refs/heads >actual && | |
453 | test_cmp expected actual | |
29bc8850 JK |
454 | ' |
455 | ||
7d66f21a BW |
456 | test_expect_success 'Check for invalid refname format' ' |
457 | test_must_fail git for-each-ref --format="%(refname:INVALID)" | |
458 | ' | |
459 | ||
11b087ad JK |
460 | test_expect_success 'set up color tests' ' |
461 | cat >expected.color <<-EOF && | |
462 | $(git rev-parse --short refs/heads/master) <GREEN>master<RESET> | |
c646d093 | 463 | $(git rev-parse --short refs/remotes/myfork/master) <GREEN>myfork/master<RESET> |
11b087ad JK |
464 | $(git rev-parse --short refs/remotes/origin/master) <GREEN>origin/master<RESET> |
465 | $(git rev-parse --short refs/tags/testtag) <GREEN>testtag<RESET> | |
c646d093 | 466 | $(git rev-parse --short refs/tags/third) <GREEN>third<RESET> |
11b087ad JK |
467 | $(git rev-parse --short refs/tags/two) <GREEN>two<RESET> |
468 | EOF | |
469 | sed "s/<[^>]*>//g" <expected.color >expected.bare && | |
470 | color_format="%(objectname:short) %(color:green)%(refname:short)" | |
471 | ' | |
fddb74c9 | 472 | |
11b087ad | 473 | test_expect_success TTY '%(color) shows color with a tty' ' |
e433749d | 474 | test_terminal git for-each-ref --format="$color_format" >actual.raw && |
097b681b | 475 | test_decode_color <actual.raw >actual && |
11b087ad JK |
476 | test_cmp expected.color actual |
477 | ' | |
478 | ||
479 | test_expect_success '%(color) does not show color without tty' ' | |
480 | TERM=vt100 git for-each-ref --format="$color_format" >actual && | |
481 | test_cmp expected.bare actual | |
482 | ' | |
483 | ||
0c88bf50 JK |
484 | test_expect_success '--color can override tty check' ' |
485 | git for-each-ref --color --format="$color_format" >actual.raw && | |
11b087ad JK |
486 | test_decode_color <actual.raw >actual && |
487 | test_cmp expected.color actual | |
fddb74c9 RR |
488 | ' |
489 | ||
b521fd12 JK |
490 | test_expect_success 'color.ui=always does not override tty check' ' |
491 | git -c color.ui=always for-each-ref --format="$color_format" >actual && | |
492 | test_cmp expected.bare actual | |
493 | ' | |
494 | ||
7d66f21a BW |
495 | cat >expected <<\EOF |
496 | heads/master | |
2bb98169 | 497 | tags/master |
7d66f21a BW |
498 | EOF |
499 | ||
2bb98169 BW |
500 | test_expect_success 'Check ambiguous head and tag refs (strict)' ' |
501 | git config --bool core.warnambiguousrefs true && | |
7d66f21a BW |
502 | git checkout -b newtag && |
503 | echo "Using $datestamp" > one && | |
504 | git add one && | |
505 | git commit -m "Branch" && | |
506 | setdate_and_increment && | |
507 | git tag -m "Tagging at $datestamp" master && | |
508 | git for-each-ref --format "%(refname:short)" refs/heads/master refs/tags/master >actual && | |
509 | test_cmp expected actual | |
510 | ' | |
511 | ||
2bb98169 BW |
512 | cat >expected <<\EOF |
513 | heads/master | |
514 | master | |
515 | EOF | |
516 | ||
517 | test_expect_success 'Check ambiguous head and tag refs (loose)' ' | |
518 | git config --bool core.warnambiguousrefs false && | |
519 | git for-each-ref --format "%(refname:short)" refs/heads/master refs/tags/master >actual && | |
520 | test_cmp expected actual | |
521 | ' | |
522 | ||
7d66f21a BW |
523 | cat >expected <<\EOF |
524 | heads/ambiguous | |
525 | ambiguous | |
526 | EOF | |
527 | ||
2bb98169 | 528 | test_expect_success 'Check ambiguous head and tag refs II (loose)' ' |
7d66f21a BW |
529 | git checkout master && |
530 | git tag ambiguous testtag^0 && | |
531 | git branch ambiguous testtag^0 && | |
532 | git for-each-ref --format "%(refname:short)" refs/heads/ambiguous refs/tags/ambiguous >actual && | |
533 | test_cmp expected actual | |
534 | ' | |
535 | ||
8b3f33ef MP |
536 | test_expect_success 'create tag without tagger' ' |
537 | git tag -a -m "Broken tag" taggerless && | |
538 | git tag -f taggerless $(git cat-file tag taggerless | | |
539 | sed -e "/^tagger /d" | | |
540 | git hash-object --stdin -w -t tag) | |
541 | ' | |
542 | ||
543 | test_atom refs/tags/taggerless type 'commit' | |
544 | test_atom refs/tags/taggerless tag 'taggerless' | |
545 | test_atom refs/tags/taggerless tagger '' | |
546 | test_atom refs/tags/taggerless taggername '' | |
547 | test_atom refs/tags/taggerless taggeremail '' | |
548 | test_atom refs/tags/taggerless taggerdate '' | |
549 | test_atom refs/tags/taggerless committer '' | |
550 | test_atom refs/tags/taggerless committername '' | |
551 | test_atom refs/tags/taggerless committeremail '' | |
552 | test_atom refs/tags/taggerless committerdate '' | |
553 | test_atom refs/tags/taggerless subject 'Broken tag' | |
554 | ||
e276c26b JH |
555 | test_expect_success 'an unusual tag with an incomplete line' ' |
556 | ||
557 | git tag -m "bogo" bogo && | |
558 | bogo=$(git cat-file tag bogo) && | |
559 | bogo=$(printf "%s" "$bogo" | git mktag) && | |
560 | git tag -f bogo "$bogo" && | |
561 | git for-each-ref --format "%(body)" refs/tags/bogo | |
562 | ||
563 | ' | |
564 | ||
7140c22c JK |
565 | test_expect_success 'create tag with subject and body content' ' |
566 | cat >>msg <<-\EOF && | |
567 | the subject line | |
568 | ||
569 | first body line | |
570 | second body line | |
571 | EOF | |
572 | git tag -F msg subject-body | |
573 | ' | |
574 | test_atom refs/tags/subject-body subject 'the subject line' | |
575 | test_atom refs/tags/subject-body body 'first body line | |
576 | second body line | |
577 | ' | |
578 | test_atom refs/tags/subject-body contents 'the subject line | |
579 | ||
580 | first body line | |
581 | second body line | |
582 | ' | |
583 | ||
7f6e275b JK |
584 | test_expect_success 'create tag with multiline subject' ' |
585 | cat >msg <<-\EOF && | |
586 | first subject line | |
587 | second subject line | |
588 | ||
589 | first body line | |
590 | second body line | |
591 | EOF | |
592 | git tag -F msg multiline | |
593 | ' | |
594 | test_atom refs/tags/multiline subject 'first subject line second subject line' | |
e2b23972 | 595 | test_atom refs/tags/multiline contents:subject 'first subject line second subject line' |
7f6e275b JK |
596 | test_atom refs/tags/multiline body 'first body line |
597 | second body line | |
598 | ' | |
e2b23972 MG |
599 | test_atom refs/tags/multiline contents:body 'first body line |
600 | second body line | |
601 | ' | |
602 | test_atom refs/tags/multiline contents:signature '' | |
7f6e275b JK |
603 | test_atom refs/tags/multiline contents 'first subject line |
604 | second subject line | |
605 | ||
606 | first body line | |
607 | second body line | |
608 | ' | |
609 | ||
e2b23972 MG |
610 | test_expect_success GPG 'create signed tags' ' |
611 | git tag -s -m "" signed-empty && | |
612 | git tag -s -m "subject line" signed-short && | |
613 | cat >msg <<-\EOF && | |
614 | subject line | |
615 | ||
616 | body contents | |
617 | EOF | |
618 | git tag -s -F msg signed-long | |
619 | ' | |
620 | ||
621 | sig='-----BEGIN PGP SIGNATURE----- | |
622 | -----END PGP SIGNATURE----- | |
623 | ' | |
624 | ||
625 | PREREQ=GPG | |
626 | test_atom refs/tags/signed-empty subject '' | |
627 | test_atom refs/tags/signed-empty contents:subject '' | |
628 | test_atom refs/tags/signed-empty body "$sig" | |
629 | test_atom refs/tags/signed-empty contents:body '' | |
630 | test_atom refs/tags/signed-empty contents:signature "$sig" | |
631 | test_atom refs/tags/signed-empty contents "$sig" | |
632 | ||
633 | test_atom refs/tags/signed-short subject 'subject line' | |
634 | test_atom refs/tags/signed-short contents:subject 'subject line' | |
635 | test_atom refs/tags/signed-short body "$sig" | |
636 | test_atom refs/tags/signed-short contents:body '' | |
637 | test_atom refs/tags/signed-short contents:signature "$sig" | |
638 | test_atom refs/tags/signed-short contents "subject line | |
639 | $sig" | |
640 | ||
641 | test_atom refs/tags/signed-long subject 'subject line' | |
642 | test_atom refs/tags/signed-long contents:subject 'subject line' | |
643 | test_atom refs/tags/signed-long body "body contents | |
644 | $sig" | |
645 | test_atom refs/tags/signed-long contents:body 'body contents | |
646 | ' | |
647 | test_atom refs/tags/signed-long contents:signature "$sig" | |
648 | test_atom refs/tags/signed-long contents "subject line | |
649 | ||
650 | body contents | |
651 | $sig" | |
652 | ||
7c5045fc JK |
653 | test_expect_success 'set up multiple-sort tags' ' |
654 | for when in 100000 200000 | |
655 | do | |
656 | for email in user1 user2 | |
657 | do | |
658 | for ref in ref1 ref2 | |
659 | do | |
660 | GIT_COMMITTER_DATE="@$when +0000" \ | |
661 | GIT_COMMITTER_EMAIL="$email@example.com" \ | |
662 | git tag -m "tag $ref-$when-$email" \ | |
663 | multi-$ref-$when-$email || return 1 | |
664 | done | |
665 | done | |
666 | done | |
667 | ' | |
912072d5 | 668 | |
3b51222c | 669 | test_expect_success 'Verify sort with multiple keys' ' |
7c5045fc JK |
670 | cat >expected <<-\EOF && |
671 | 100000 <user1@example.com> refs/tags/multi-ref2-100000-user1 | |
672 | 100000 <user1@example.com> refs/tags/multi-ref1-100000-user1 | |
673 | 100000 <user2@example.com> refs/tags/multi-ref2-100000-user2 | |
674 | 100000 <user2@example.com> refs/tags/multi-ref1-100000-user2 | |
675 | 200000 <user1@example.com> refs/tags/multi-ref2-200000-user1 | |
676 | 200000 <user1@example.com> refs/tags/multi-ref1-200000-user1 | |
677 | 200000 <user2@example.com> refs/tags/multi-ref2-200000-user2 | |
678 | 200000 <user2@example.com> refs/tags/multi-ref1-200000-user2 | |
679 | EOF | |
680 | git for-each-ref \ | |
681 | --format="%(taggerdate:unix) %(taggeremail) %(refname)" \ | |
682 | --sort=-refname \ | |
683 | --sort=taggeremail \ | |
684 | --sort=taggerdate \ | |
685 | "refs/tags/multi-*" >actual && | |
912072d5 KK |
686 | test_cmp expected actual |
687 | ' | |
84679d47 | 688 | |
7c5045fc JK |
689 | test_expect_success 'equivalent sorts fall back on refname' ' |
690 | cat >expected <<-\EOF && | |
691 | 100000 <user1@example.com> refs/tags/multi-ref1-100000-user1 | |
692 | 100000 <user2@example.com> refs/tags/multi-ref1-100000-user2 | |
693 | 100000 <user1@example.com> refs/tags/multi-ref2-100000-user1 | |
694 | 100000 <user2@example.com> refs/tags/multi-ref2-100000-user2 | |
695 | 200000 <user1@example.com> refs/tags/multi-ref1-200000-user1 | |
696 | 200000 <user2@example.com> refs/tags/multi-ref1-200000-user2 | |
697 | 200000 <user1@example.com> refs/tags/multi-ref2-200000-user1 | |
698 | 200000 <user2@example.com> refs/tags/multi-ref2-200000-user2 | |
699 | EOF | |
700 | git for-each-ref \ | |
701 | --format="%(taggerdate:unix) %(taggeremail) %(refname)" \ | |
702 | --sort=taggerdate \ | |
703 | "refs/tags/multi-*" >actual && | |
704 | test_cmp expected actual | |
705 | ' | |
01f95825 | 706 | |
84679d47 JH |
707 | test_expect_success 'do not dereference NULL upon %(HEAD) on unborn branch' ' |
708 | test_when_finished "git checkout master" && | |
709 | git for-each-ref --format="%(HEAD) %(refname:short)" refs/heads/ >actual && | |
710 | sed -e "s/^\* / /" actual >expect && | |
f0252ca2 | 711 | git checkout --orphan orphaned-branch && |
84679d47 JH |
712 | git for-each-ref --format="%(HEAD) %(refname:short)" refs/heads/ >actual && |
713 | test_cmp expect actual | |
714 | ' | |
715 | ||
b1d31c89 JK |
716 | cat >trailers <<EOF |
717 | Reviewed-by: A U Thor <author@example.com> | |
718 | Signed-off-by: A U Thor <author@example.com> | |
624b44d3 TB |
719 | [ v2 updated patch description ] |
720 | Acked-by: A U Thor | |
721 | <author@example.com> | |
b1d31c89 JK |
722 | EOF |
723 | ||
67a20a00 TB |
724 | unfold () { |
725 | perl -0pe 's/\n\s+/ /g' | |
726 | } | |
624b44d3 TB |
727 | |
728 | test_expect_success 'set up trailers for next test' ' | |
b1d31c89 JK |
729 | echo "Some contents" > two && |
730 | git add two && | |
624b44d3 | 731 | git commit -F - <<-EOF |
b1d31c89 JK |
732 | trailers: this commit message has trailers |
733 | ||
734 | Some message contents | |
735 | ||
736 | $(cat trailers) | |
737 | EOF | |
624b44d3 TB |
738 | ' |
739 | ||
67a20a00 | 740 | test_expect_success '%(trailers:unfold) unfolds trailers' ' |
67a20a00 TB |
741 | { |
742 | unfold <trailers | |
743 | echo | |
744 | } >expect && | |
a8e0f50e HV |
745 | git for-each-ref --format="%(trailers:unfold)" refs/heads/master >actual && |
746 | test_cmp expect actual && | |
747 | git for-each-ref --format="%(contents:trailers:unfold)" refs/heads/master >actual && | |
67a20a00 TB |
748 | test_cmp expect actual |
749 | ' | |
750 | ||
751 | test_expect_success '%(trailers:only) shows only "key: value" trailers' ' | |
67a20a00 TB |
752 | { |
753 | grep -v patch.description <trailers && | |
754 | echo | |
755 | } >expect && | |
a8e0f50e HV |
756 | git for-each-ref --format="%(trailers:only)" refs/heads/master >actual && |
757 | test_cmp expect actual && | |
758 | git for-each-ref --format="%(contents:trailers:only)" refs/heads/master >actual && | |
67a20a00 TB |
759 | test_cmp expect actual |
760 | ' | |
761 | ||
762 | test_expect_success '%(trailers:only) and %(trailers:unfold) work together' ' | |
67a20a00 TB |
763 | { |
764 | grep -v patch.description <trailers | unfold && | |
765 | echo | |
766 | } >expect && | |
a8e0f50e HV |
767 | git for-each-ref --format="%(trailers:only,unfold)" refs/heads/master >actual && |
768 | test_cmp expect actual && | |
769 | git for-each-ref --format="%(trailers:unfold,only)" refs/heads/master >actual && | |
770 | test_cmp actual actual && | |
7a5edbdb | 771 | git for-each-ref --format="%(contents:trailers:only,unfold)" refs/heads/master >actual && |
a8e0f50e HV |
772 | test_cmp expect actual && |
773 | git for-each-ref --format="%(contents:trailers:unfold,only)" refs/heads/master >actual && | |
774 | test_cmp actual actual | |
7a5edbdb TB |
775 | ' |
776 | ||
67a20a00 TB |
777 | test_expect_success '%(trailers) rejects unknown trailers arguments' ' |
778 | # error message cannot be checked under i18n | |
779 | cat >expect <<-EOF && | |
780 | fatal: unknown %(trailers) argument: unsupported | |
781 | EOF | |
782 | test_must_fail git for-each-ref --format="%(trailers:unsupported)" 2>actual && | |
a8e0f50e | 783 | test_i18ncmp expect actual && |
7a5edbdb TB |
784 | test_must_fail git for-each-ref --format="%(contents:trailers:unsupported)" 2>actual && |
785 | test_i18ncmp expect actual | |
786 | ' | |
787 | ||
2c22e102 HV |
788 | test_expect_success 'if arguments, %(contents:trailers) shows error if colon is missing' ' |
789 | cat >expect <<-EOF && | |
790 | fatal: unrecognized %(contents) argument: trailersonly | |
791 | EOF | |
792 | test_must_fail git for-each-ref --format="%(contents:trailersonly)" 2>actual && | |
793 | test_i18ncmp expect actual | |
794 | ' | |
795 | ||
624b44d3 | 796 | test_expect_success 'basic atom: head contents:trailers' ' |
b1d31c89 JK |
797 | git for-each-ref --format="%(contents:trailers)" refs/heads/master >actual && |
798 | sanitize_pgp <actual >actual.clean && | |
799 | # git for-each-ref ends with a blank line | |
800 | cat >expect <<-EOF && | |
801 | $(cat trailers) | |
802 | ||
803 | EOF | |
804 | test_cmp expect actual.clean | |
805 | ' | |
806 | ||
e5fba5d5 JK |
807 | test_expect_success 'trailer parsing not fooled by --- line' ' |
808 | git commit --allow-empty -F - <<-\EOF && | |
809 | this is the subject | |
810 | ||
811 | This is the body. The message has a "---" line which would confuse a | |
812 | message+patch parser. But here we know we have only a commit message, | |
813 | so we get it right. | |
814 | ||
815 | trailer: wrong | |
816 | --- | |
817 | This is more body. | |
818 | ||
819 | trailer: right | |
820 | EOF | |
821 | ||
822 | { | |
823 | echo "trailer: right" && | |
824 | echo | |
825 | } >expect && | |
826 | git for-each-ref --format="%(trailers)" refs/heads/master >actual && | |
827 | test_cmp expect actual | |
828 | ' | |
829 | ||
01f95825 KN |
830 | test_expect_success 'Add symbolic ref for the following tests' ' |
831 | git symbolic-ref refs/heads/sym refs/heads/master | |
832 | ' | |
833 | ||
834 | cat >expected <<EOF | |
835 | refs/heads/master | |
836 | EOF | |
837 | ||
838 | test_expect_success 'Verify usage of %(symref) atom' ' | |
839 | git for-each-ref --format="%(symref)" refs/heads/sym >actual && | |
840 | test_cmp expected actual | |
841 | ' | |
842 | ||
843 | cat >expected <<EOF | |
844 | heads/master | |
845 | EOF | |
846 | ||
847 | test_expect_success 'Verify usage of %(symref:short) atom' ' | |
848 | git for-each-ref --format="%(symref:short)" refs/heads/sym >actual && | |
849 | test_cmp expected actual | |
850 | ' | |
851 | ||
a7984101 KN |
852 | cat >expected <<EOF |
853 | master | |
1a0ca5e3 | 854 | heads/master |
a7984101 KN |
855 | EOF |
856 | ||
17938f17 KN |
857 | test_expect_success 'Verify usage of %(symref:lstrip) atom' ' |
858 | git for-each-ref --format="%(symref:lstrip=2)" refs/heads/sym > actual && | |
1a0ca5e3 | 859 | git for-each-ref --format="%(symref:lstrip=-2)" refs/heads/sym >> actual && |
44a6b6ce JH |
860 | test_cmp expected actual && |
861 | ||
862 | git for-each-ref --format="%(symref:strip=2)" refs/heads/sym > actual && | |
863 | git for-each-ref --format="%(symref:strip=-2)" refs/heads/sym >> actual && | |
a7984101 KN |
864 | test_cmp expected actual |
865 | ' | |
866 | ||
1a34728e KN |
867 | cat >expected <<EOF |
868 | refs | |
869 | refs/heads | |
870 | EOF | |
871 | ||
872 | test_expect_success 'Verify usage of %(symref:rstrip) atom' ' | |
873 | git for-each-ref --format="%(symref:rstrip=2)" refs/heads/sym > actual && | |
874 | git for-each-ref --format="%(symref:rstrip=-2)" refs/heads/sym >> actual && | |
875 | test_cmp expected actual | |
876 | ' | |
877 | ||
1b586867 JS |
878 | test_expect_success ':remotename and :remoteref' ' |
879 | git init remote-tests && | |
880 | ( | |
881 | cd remote-tests && | |
882 | test_commit initial && | |
883 | git remote add from fifth.coffee:blub && | |
884 | git config branch.master.remote from && | |
885 | git config branch.master.merge refs/heads/stable && | |
886 | git remote add to southridge.audio:repo && | |
887 | git config remote.to.push "refs/heads/*:refs/heads/pushed/*" && | |
888 | git config branch.master.pushRemote to && | |
889 | for pair in "%(upstream)=refs/remotes/from/stable" \ | |
890 | "%(upstream:remotename)=from" \ | |
891 | "%(upstream:remoteref)=refs/heads/stable" \ | |
892 | "%(push)=refs/remotes/to/pushed/master" \ | |
893 | "%(push:remotename)=to" \ | |
894 | "%(push:remoteref)=refs/heads/pushed/master" | |
895 | do | |
896 | echo "${pair#*=}" >expect && | |
897 | git for-each-ref --format="${pair%=*}" \ | |
898 | refs/heads/master >actual && | |
899 | test_cmp expect actual | |
900 | done && | |
901 | git branch push-simple && | |
902 | git config branch.push-simple.pushRemote from && | |
903 | actual="$(git for-each-ref \ | |
904 | --format="%(push:remotename),%(push:remoteref)" \ | |
905 | refs/heads/push-simple)" && | |
906 | test from, = "$actual" | |
907 | ) | |
908 | ' | |
909 | ||
e674eb25 | 910 | test_expect_success 'for-each-ref --ignore-case ignores case' ' |
ee0f3e22 | 911 | git for-each-ref --format="%(refname)" refs/heads/MASTER >actual && |
d3c6751b | 912 | test_must_be_empty actual && |
ee0f3e22 JK |
913 | |
914 | echo refs/heads/master >expect && | |
915 | git for-each-ref --format="%(refname)" --ignore-case \ | |
916 | refs/heads/MASTER >actual && | |
917 | test_cmp expect actual | |
918 | ' | |
919 | ||
76f9e569 JK |
920 | test_expect_success 'for-each-ref --ignore-case works on multiple sort keys' ' |
921 | # name refs numerically to avoid case-insensitive filesystem conflicts | |
922 | nr=0 && | |
923 | for email in a A b B | |
924 | do | |
925 | for subject in a A b B | |
926 | do | |
927 | GIT_COMMITTER_EMAIL="$email@example.com" \ | |
928 | git tag -m "tag $subject" icase-$(printf %02d $nr) && | |
929 | nr=$((nr+1))|| | |
930 | return 1 | |
931 | done | |
932 | done && | |
933 | git for-each-ref --ignore-case \ | |
934 | --format="%(taggeremail) %(subject) %(refname)" \ | |
935 | --sort=refname \ | |
936 | --sort=subject \ | |
937 | --sort=taggeremail \ | |
938 | refs/tags/icase-* >actual && | |
939 | cat >expect <<-\EOF && | |
940 | <a@example.com> tag a refs/tags/icase-00 | |
941 | <a@example.com> tag A refs/tags/icase-01 | |
942 | <A@example.com> tag a refs/tags/icase-04 | |
943 | <A@example.com> tag A refs/tags/icase-05 | |
944 | <a@example.com> tag b refs/tags/icase-02 | |
945 | <a@example.com> tag B refs/tags/icase-03 | |
946 | <A@example.com> tag b refs/tags/icase-06 | |
947 | <A@example.com> tag B refs/tags/icase-07 | |
948 | <b@example.com> tag a refs/tags/icase-08 | |
949 | <b@example.com> tag A refs/tags/icase-09 | |
950 | <B@example.com> tag a refs/tags/icase-12 | |
951 | <B@example.com> tag A refs/tags/icase-13 | |
952 | <b@example.com> tag b refs/tags/icase-10 | |
953 | <b@example.com> tag B refs/tags/icase-11 | |
954 | <B@example.com> tag b refs/tags/icase-14 | |
955 | <B@example.com> tag B refs/tags/icase-15 | |
956 | EOF | |
957 | test_cmp expect actual | |
958 | ' | |
959 | ||
96b2d4fa | 960 | test_done |