]>
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 |
96b2d4fa AP |
10 | |
11 | # Mon Jul 3 15:18:43 2006 +0000 | |
12 | datestamp=1151939923 | |
13 | setdate_and_increment () { | |
14 | GIT_COMMITTER_DATE="$datestamp +0200" | |
15 | datestamp=$(expr "$datestamp" + 1) | |
16 | GIT_AUTHOR_DATE="$datestamp +0200" | |
17 | datestamp=$(expr "$datestamp" + 1) | |
18 | export GIT_COMMITTER_DATE GIT_AUTHOR_DATE | |
19 | } | |
20 | ||
bc147968 | 21 | test_expect_success setup ' |
96b2d4fa AP |
22 | setdate_and_increment && |
23 | echo "Using $datestamp" > one && | |
24 | git add one && | |
25 | git commit -m "Initial" && | |
26 | setdate_and_increment && | |
bc147968 | 27 | git tag -a -m "Tagging at $datestamp" testtag && |
8cae19d9 JK |
28 | git update-ref refs/remotes/origin/master master && |
29 | git remote add origin nowhere && | |
30 | git config branch.master.remote origin && | |
31 | git config branch.master.merge refs/heads/master | |
32 | ' | |
33 | ||
d2bf48d2 JK |
34 | test_atom() { |
35 | case "$1" in | |
36 | head) ref=refs/heads/master ;; | |
37 | tag) ref=refs/tags/testtag ;; | |
7140c22c | 38 | *) ref=$1 ;; |
d2bf48d2 JK |
39 | esac |
40 | printf '%s\n' "$3" >expected | |
e2b23972 | 41 | test_expect_${4:-success} $PREREQ "basic atom: $1 $2" " |
d2bf48d2 | 42 | git for-each-ref --format='%($2)' $ref >actual && |
e2b23972 MG |
43 | sanitize_pgp <actual >actual.clean && |
44 | test_cmp expected actual.clean | |
d2bf48d2 JK |
45 | " |
46 | } | |
47 | ||
48 | test_atom head refname refs/heads/master | |
8cae19d9 | 49 | test_atom head upstream refs/remotes/origin/master |
d2bf48d2 JK |
50 | test_atom head objecttype commit |
51 | test_atom head objectsize 171 | |
189a5467 RR |
52 | test_atom head objectname $(git rev-parse refs/heads/master) |
53 | test_atom head tree $(git rev-parse refs/heads/master^{tree}) | |
d2bf48d2 JK |
54 | test_atom head parent '' |
55 | test_atom head numparent 0 | |
56 | test_atom head object '' | |
57 | test_atom head type '' | |
b74cf648 JK |
58 | test_atom head '*objectname' '' |
59 | test_atom head '*objecttype' '' | |
d2bf48d2 JK |
60 | test_atom head author 'A U Thor <author@example.com> 1151939924 +0200' |
61 | test_atom head authorname 'A U Thor' | |
62 | test_atom head authoremail '<author@example.com>' | |
63 | test_atom head authordate 'Mon Jul 3 17:18:44 2006 +0200' | |
64 | test_atom head committer 'C O Mitter <committer@example.com> 1151939923 +0200' | |
65 | test_atom head committername 'C O Mitter' | |
66 | test_atom head committeremail '<committer@example.com>' | |
67 | test_atom head committerdate 'Mon Jul 3 17:18:43 2006 +0200' | |
68 | test_atom head tag '' | |
69 | test_atom head tagger '' | |
70 | test_atom head taggername '' | |
71 | test_atom head taggeremail '' | |
72 | test_atom head taggerdate '' | |
73 | test_atom head creator 'C O Mitter <committer@example.com> 1151939923 +0200' | |
74 | test_atom head creatordate 'Mon Jul 3 17:18:43 2006 +0200' | |
75 | test_atom head subject 'Initial' | |
e2b23972 | 76 | test_atom head contents:subject 'Initial' |
d2bf48d2 | 77 | test_atom head body '' |
e2b23972 MG |
78 | test_atom head contents:body '' |
79 | test_atom head contents:signature '' | |
d2bf48d2 JK |
80 | test_atom head contents 'Initial |
81 | ' | |
7a48b832 | 82 | test_atom head HEAD '*' |
d2bf48d2 JK |
83 | |
84 | test_atom tag refname refs/tags/testtag | |
8cae19d9 | 85 | test_atom tag upstream '' |
d2bf48d2 JK |
86 | test_atom tag objecttype tag |
87 | test_atom tag objectsize 154 | |
189a5467 | 88 | test_atom tag objectname $(git rev-parse refs/tags/testtag) |
d2bf48d2 JK |
89 | test_atom tag tree '' |
90 | test_atom tag parent '' | |
91 | test_atom tag numparent '' | |
189a5467 | 92 | test_atom tag object $(git rev-parse refs/tags/testtag^0) |
d2bf48d2 | 93 | test_atom tag type 'commit' |
b74cf648 JK |
94 | test_atom tag '*objectname' '67a36f10722846e891fbada1ba48ed035de75581' |
95 | test_atom tag '*objecttype' 'commit' | |
d2bf48d2 JK |
96 | test_atom tag author '' |
97 | test_atom tag authorname '' | |
98 | test_atom tag authoremail '' | |
99 | test_atom tag authordate '' | |
100 | test_atom tag committer '' | |
101 | test_atom tag committername '' | |
102 | test_atom tag committeremail '' | |
103 | test_atom tag committerdate '' | |
104 | test_atom tag tag 'testtag' | |
105 | test_atom tag tagger 'C O Mitter <committer@example.com> 1151939925 +0200' | |
106 | test_atom tag taggername 'C O Mitter' | |
107 | test_atom tag taggeremail '<committer@example.com>' | |
108 | test_atom tag taggerdate 'Mon Jul 3 17:18:45 2006 +0200' | |
109 | test_atom tag creator 'C O Mitter <committer@example.com> 1151939925 +0200' | |
110 | test_atom tag creatordate 'Mon Jul 3 17:18:45 2006 +0200' | |
111 | test_atom tag subject 'Tagging at 1151939927' | |
e2b23972 | 112 | test_atom tag contents:subject 'Tagging at 1151939927' |
d2bf48d2 | 113 | test_atom tag body '' |
e2b23972 MG |
114 | test_atom tag contents:body '' |
115 | test_atom tag contents:signature '' | |
d2bf48d2 | 116 | test_atom tag contents 'Tagging at 1151939927 |
96b2d4fa | 117 | ' |
7a48b832 | 118 | test_atom tag HEAD ' ' |
96b2d4fa | 119 | |
41ac414e | 120 | test_expect_success 'Check invalid atoms names are errors' ' |
3604e7c5 | 121 | test_must_fail git for-each-ref --format="%(INVALID)" refs/heads |
96b2d4fa AP |
122 | ' |
123 | ||
124 | test_expect_success 'Check format specifiers are ignored in naming date atoms' ' | |
3604e7c5 NS |
125 | git for-each-ref --format="%(authordate)" refs/heads && |
126 | git for-each-ref --format="%(authordate:default) %(authordate)" refs/heads && | |
127 | git for-each-ref --format="%(authordate) %(authordate:default)" refs/heads && | |
128 | git for-each-ref --format="%(authordate:default) %(authordate:default)" refs/heads | |
96b2d4fa AP |
129 | ' |
130 | ||
131 | test_expect_success 'Check valid format specifiers for date fields' ' | |
3604e7c5 NS |
132 | git for-each-ref --format="%(authordate:default)" refs/heads && |
133 | git for-each-ref --format="%(authordate:relative)" refs/heads && | |
134 | git for-each-ref --format="%(authordate:short)" refs/heads && | |
135 | git for-each-ref --format="%(authordate:local)" refs/heads && | |
136 | git for-each-ref --format="%(authordate:iso8601)" refs/heads && | |
137 | git for-each-ref --format="%(authordate:rfc2822)" refs/heads | |
96b2d4fa AP |
138 | ' |
139 | ||
41ac414e | 140 | test_expect_success 'Check invalid format specifiers are errors' ' |
3604e7c5 | 141 | test_must_fail git for-each-ref --format="%(authordate:INVALID)" refs/heads |
96b2d4fa AP |
142 | ' |
143 | ||
144 | cat >expected <<\EOF | |
145 | 'refs/heads/master' 'Mon Jul 3 17:18:43 2006 +0200' 'Mon Jul 3 17:18:44 2006 +0200' | |
146 | 'refs/tags/testtag' 'Mon Jul 3 17:18:45 2006 +0200' | |
147 | EOF | |
148 | ||
149 | test_expect_success 'Check unformatted date fields output' ' | |
150 | (git for-each-ref --shell --format="%(refname) %(committerdate) %(authordate)" refs/heads && | |
151 | git for-each-ref --shell --format="%(refname) %(taggerdate)" refs/tags) >actual && | |
3af82863 | 152 | test_cmp expected actual |
96b2d4fa AP |
153 | ' |
154 | ||
155 | test_expect_success 'Check format "default" formatted date fields output' ' | |
156 | f=default && | |
157 | (git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads && | |
158 | git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual && | |
3af82863 | 159 | test_cmp expected actual |
96b2d4fa AP |
160 | ' |
161 | ||
162 | # Don't know how to do relative check because I can't know when this script | |
163 | # is going to be run and can't fake the current time to git, and hence can't | |
164 | # provide expected output. Instead, I'll just make sure that "relative" | |
165 | # doesn't exit in error | |
166 | # | |
167 | #cat >expected <<\EOF | |
168 | # | |
169 | #EOF | |
170 | # | |
171 | test_expect_success 'Check format "relative" date fields output' ' | |
172 | f=relative && | |
173 | (git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads && | |
174 | git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual | |
175 | ' | |
176 | ||
177 | cat >expected <<\EOF | |
178 | 'refs/heads/master' '2006-07-03' '2006-07-03' | |
179 | 'refs/tags/testtag' '2006-07-03' | |
180 | EOF | |
181 | ||
182 | test_expect_success 'Check format "short" date fields output' ' | |
183 | f=short && | |
184 | (git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads && | |
185 | git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual && | |
3af82863 | 186 | test_cmp expected actual |
96b2d4fa AP |
187 | ' |
188 | ||
189 | cat >expected <<\EOF | |
190 | 'refs/heads/master' 'Mon Jul 3 15:18:43 2006' 'Mon Jul 3 15:18:44 2006' | |
191 | 'refs/tags/testtag' 'Mon Jul 3 15:18:45 2006' | |
192 | EOF | |
193 | ||
194 | test_expect_success 'Check format "local" date fields output' ' | |
195 | f=local && | |
196 | (git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads && | |
197 | git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual && | |
3af82863 | 198 | test_cmp expected actual |
96b2d4fa AP |
199 | ' |
200 | ||
201 | cat >expected <<\EOF | |
202 | 'refs/heads/master' '2006-07-03 17:18:43 +0200' '2006-07-03 17:18:44 +0200' | |
203 | 'refs/tags/testtag' '2006-07-03 17:18:45 +0200' | |
204 | EOF | |
205 | ||
206 | test_expect_success 'Check format "iso8601" date fields output' ' | |
207 | f=iso8601 && | |
208 | (git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads && | |
209 | git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual && | |
3af82863 | 210 | test_cmp expected actual |
96b2d4fa AP |
211 | ' |
212 | ||
213 | cat >expected <<\EOF | |
214 | 'refs/heads/master' 'Mon, 3 Jul 2006 17:18:43 +0200' 'Mon, 3 Jul 2006 17:18:44 +0200' | |
215 | 'refs/tags/testtag' 'Mon, 3 Jul 2006 17:18:45 +0200' | |
216 | EOF | |
217 | ||
218 | test_expect_success 'Check format "rfc2822" date fields output' ' | |
219 | f=rfc2822 && | |
220 | (git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads && | |
221 | git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual && | |
3af82863 | 222 | test_cmp expected actual |
96b2d4fa AP |
223 | ' |
224 | ||
c899a57c LH |
225 | cat >expected <<\EOF |
226 | refs/heads/master | |
8cae19d9 | 227 | refs/remotes/origin/master |
c899a57c LH |
228 | refs/tags/testtag |
229 | EOF | |
230 | ||
231 | test_expect_success 'Verify ascending sort' ' | |
3604e7c5 | 232 | git for-each-ref --format="%(refname)" --sort=refname >actual && |
3af82863 | 233 | test_cmp expected actual |
c899a57c LH |
234 | ' |
235 | ||
236 | ||
237 | cat >expected <<\EOF | |
238 | refs/tags/testtag | |
8cae19d9 | 239 | refs/remotes/origin/master |
c899a57c LH |
240 | refs/heads/master |
241 | EOF | |
242 | ||
243 | test_expect_success 'Verify descending sort' ' | |
3604e7c5 | 244 | git for-each-ref --format="%(refname)" --sort=-refname >actual && |
3af82863 | 245 | test_cmp expected actual |
c899a57c LH |
246 | ' |
247 | ||
c9ecf4f1 JS |
248 | cat >expected <<\EOF |
249 | 'refs/heads/master' | |
8cae19d9 | 250 | 'refs/remotes/origin/master' |
c9ecf4f1 JS |
251 | 'refs/tags/testtag' |
252 | EOF | |
253 | ||
254 | test_expect_success 'Quoting style: shell' ' | |
255 | git for-each-ref --shell --format="%(refname)" >actual && | |
3af82863 | 256 | test_cmp expected actual |
c9ecf4f1 JS |
257 | ' |
258 | ||
259 | test_expect_success 'Quoting style: perl' ' | |
260 | git for-each-ref --perl --format="%(refname)" >actual && | |
3af82863 | 261 | test_cmp expected actual |
c9ecf4f1 JS |
262 | ' |
263 | ||
264 | test_expect_success 'Quoting style: python' ' | |
265 | git for-each-ref --python --format="%(refname)" >actual && | |
3af82863 | 266 | test_cmp expected actual |
c9ecf4f1 JS |
267 | ' |
268 | ||
269 | cat >expected <<\EOF | |
270 | "refs/heads/master" | |
8cae19d9 | 271 | "refs/remotes/origin/master" |
c9ecf4f1 JS |
272 | "refs/tags/testtag" |
273 | EOF | |
274 | ||
275 | test_expect_success 'Quoting style: tcl' ' | |
276 | git for-each-ref --tcl --format="%(refname)" >actual && | |
3af82863 | 277 | test_cmp expected actual |
c9ecf4f1 JS |
278 | ' |
279 | ||
280 | for i in "--perl --shell" "-s --python" "--python --tcl" "--tcl --perl"; do | |
281 | test_expect_success "more than one quoting style: $i" " | |
282 | git for-each-ref $i 2>&1 | (read line && | |
283 | case \$line in | |
284 | \"error: more than one quoting style\"*) : happy;; | |
285 | *) false | |
286 | esac) | |
287 | " | |
288 | done | |
c899a57c | 289 | |
7d66f21a BW |
290 | cat >expected <<\EOF |
291 | master | |
292 | testtag | |
293 | EOF | |
294 | ||
295 | test_expect_success 'Check short refname format' ' | |
296 | (git for-each-ref --format="%(refname:short)" refs/heads && | |
297 | git for-each-ref --format="%(refname:short)" refs/tags) >actual && | |
298 | test_cmp expected actual | |
299 | ' | |
300 | ||
8cae19d9 JK |
301 | cat >expected <<EOF |
302 | origin/master | |
303 | EOF | |
304 | ||
305 | test_expect_success 'Check short upstream format' ' | |
306 | git for-each-ref --format="%(upstream:short)" refs/heads >actual && | |
307 | test_cmp expected actual | |
308 | ' | |
309 | ||
b28061ce RR |
310 | test_expect_success 'setup for upstream:track[short]' ' |
311 | test_commit two | |
312 | ' | |
313 | ||
314 | cat >expected <<EOF | |
315 | [ahead 1] | |
316 | EOF | |
317 | ||
318 | test_expect_success 'Check upstream:track format' ' | |
319 | git for-each-ref --format="%(upstream:track)" refs/heads >actual && | |
320 | test_cmp expected actual | |
321 | ' | |
322 | ||
323 | cat >expected <<EOF | |
324 | > | |
325 | EOF | |
326 | ||
327 | test_expect_success 'Check upstream:trackshort format' ' | |
328 | git for-each-ref --format="%(upstream:trackshort)" refs/heads >actual && | |
329 | test_cmp expected actual | |
330 | ' | |
331 | ||
332 | test_expect_success 'Check that :track[short] cannot be used with other atoms' ' | |
333 | test_must_fail git for-each-ref --format="%(refname:track)" 2>/dev/null && | |
334 | test_must_fail git for-each-ref --format="%(refname:trackshort)" 2>/dev/null | |
335 | ' | |
336 | ||
b6160d95 RKC |
337 | test_expect_success 'Check that :track[short] works when upstream is invalid' ' |
338 | cat >expected <<-\EOF && | |
339 | ||
340 | ||
341 | EOF | |
342 | test_when_finished "git config branch.master.merge refs/heads/master" && | |
343 | git config branch.master.merge refs/heads/does-not-exist && | |
344 | git for-each-ref \ | |
345 | --format="%(upstream:track)$LF%(upstream:trackshort)" \ | |
346 | refs/heads >actual && | |
347 | test_cmp expected actual | |
348 | ' | |
349 | ||
67687fea | 350 | cat >expected <<EOF |
189a5467 | 351 | $(git rev-parse --short HEAD) |
67687fea MG |
352 | EOF |
353 | ||
354 | test_expect_success 'Check short objectname format' ' | |
355 | git for-each-ref --format="%(objectname:short)" refs/heads >actual && | |
356 | test_cmp expected actual | |
357 | ' | |
358 | ||
7d66f21a BW |
359 | test_expect_success 'Check for invalid refname format' ' |
360 | test_must_fail git for-each-ref --format="%(refname:INVALID)" | |
361 | ' | |
362 | ||
fddb74c9 RR |
363 | get_color () |
364 | { | |
365 | git config --get-color no.such.slot "$1" | |
366 | } | |
367 | ||
368 | cat >expected <<EOF | |
369 | $(git rev-parse --short refs/heads/master) $(get_color green)master$(get_color reset) | |
370 | $(git rev-parse --short refs/remotes/origin/master) $(get_color green)origin/master$(get_color reset) | |
371 | $(git rev-parse --short refs/tags/testtag) $(get_color green)testtag$(get_color reset) | |
372 | $(git rev-parse --short refs/tags/two) $(get_color green)two$(get_color reset) | |
373 | EOF | |
374 | ||
375 | test_expect_success 'Check %(color:...) ' ' | |
db64eb65 | 376 | git for-each-ref --format="%(objectname:short) %(color:green)%(refname:short)" >actual && |
fddb74c9 RR |
377 | test_cmp expected actual |
378 | ' | |
379 | ||
7d66f21a BW |
380 | cat >expected <<\EOF |
381 | heads/master | |
2bb98169 | 382 | tags/master |
7d66f21a BW |
383 | EOF |
384 | ||
2bb98169 BW |
385 | test_expect_success 'Check ambiguous head and tag refs (strict)' ' |
386 | git config --bool core.warnambiguousrefs true && | |
7d66f21a BW |
387 | git checkout -b newtag && |
388 | echo "Using $datestamp" > one && | |
389 | git add one && | |
390 | git commit -m "Branch" && | |
391 | setdate_and_increment && | |
392 | git tag -m "Tagging at $datestamp" master && | |
393 | git for-each-ref --format "%(refname:short)" refs/heads/master refs/tags/master >actual && | |
394 | test_cmp expected actual | |
395 | ' | |
396 | ||
2bb98169 BW |
397 | cat >expected <<\EOF |
398 | heads/master | |
399 | master | |
400 | EOF | |
401 | ||
402 | test_expect_success 'Check ambiguous head and tag refs (loose)' ' | |
403 | git config --bool core.warnambiguousrefs false && | |
404 | git for-each-ref --format "%(refname:short)" refs/heads/master refs/tags/master >actual && | |
405 | test_cmp expected actual | |
406 | ' | |
407 | ||
7d66f21a BW |
408 | cat >expected <<\EOF |
409 | heads/ambiguous | |
410 | ambiguous | |
411 | EOF | |
412 | ||
2bb98169 | 413 | test_expect_success 'Check ambiguous head and tag refs II (loose)' ' |
7d66f21a BW |
414 | git checkout master && |
415 | git tag ambiguous testtag^0 && | |
416 | git branch ambiguous testtag^0 && | |
417 | git for-each-ref --format "%(refname:short)" refs/heads/ambiguous refs/tags/ambiguous >actual && | |
418 | test_cmp expected actual | |
419 | ' | |
420 | ||
e276c26b JH |
421 | test_expect_success 'an unusual tag with an incomplete line' ' |
422 | ||
423 | git tag -m "bogo" bogo && | |
424 | bogo=$(git cat-file tag bogo) && | |
425 | bogo=$(printf "%s" "$bogo" | git mktag) && | |
426 | git tag -f bogo "$bogo" && | |
427 | git for-each-ref --format "%(body)" refs/tags/bogo | |
428 | ||
429 | ' | |
430 | ||
7140c22c JK |
431 | test_expect_success 'create tag with subject and body content' ' |
432 | cat >>msg <<-\EOF && | |
433 | the subject line | |
434 | ||
435 | first body line | |
436 | second body line | |
437 | EOF | |
438 | git tag -F msg subject-body | |
439 | ' | |
440 | test_atom refs/tags/subject-body subject 'the subject line' | |
441 | test_atom refs/tags/subject-body body 'first body line | |
442 | second body line | |
443 | ' | |
444 | test_atom refs/tags/subject-body contents 'the subject line | |
445 | ||
446 | first body line | |
447 | second body line | |
448 | ' | |
449 | ||
7f6e275b JK |
450 | test_expect_success 'create tag with multiline subject' ' |
451 | cat >msg <<-\EOF && | |
452 | first subject line | |
453 | second subject line | |
454 | ||
455 | first body line | |
456 | second body line | |
457 | EOF | |
458 | git tag -F msg multiline | |
459 | ' | |
460 | test_atom refs/tags/multiline subject 'first subject line second subject line' | |
e2b23972 | 461 | test_atom refs/tags/multiline contents:subject 'first subject line second subject line' |
7f6e275b JK |
462 | test_atom refs/tags/multiline body 'first body line |
463 | second body line | |
464 | ' | |
e2b23972 MG |
465 | test_atom refs/tags/multiline contents:body 'first body line |
466 | second body line | |
467 | ' | |
468 | test_atom refs/tags/multiline contents:signature '' | |
7f6e275b JK |
469 | test_atom refs/tags/multiline contents 'first subject line |
470 | second subject line | |
471 | ||
472 | first body line | |
473 | second body line | |
474 | ' | |
475 | ||
e2b23972 MG |
476 | test_expect_success GPG 'create signed tags' ' |
477 | git tag -s -m "" signed-empty && | |
478 | git tag -s -m "subject line" signed-short && | |
479 | cat >msg <<-\EOF && | |
480 | subject line | |
481 | ||
482 | body contents | |
483 | EOF | |
484 | git tag -s -F msg signed-long | |
485 | ' | |
486 | ||
487 | sig='-----BEGIN PGP SIGNATURE----- | |
488 | -----END PGP SIGNATURE----- | |
489 | ' | |
490 | ||
491 | PREREQ=GPG | |
492 | test_atom refs/tags/signed-empty subject '' | |
493 | test_atom refs/tags/signed-empty contents:subject '' | |
494 | test_atom refs/tags/signed-empty body "$sig" | |
495 | test_atom refs/tags/signed-empty contents:body '' | |
496 | test_atom refs/tags/signed-empty contents:signature "$sig" | |
497 | test_atom refs/tags/signed-empty contents "$sig" | |
498 | ||
499 | test_atom refs/tags/signed-short subject 'subject line' | |
500 | test_atom refs/tags/signed-short contents:subject 'subject line' | |
501 | test_atom refs/tags/signed-short body "$sig" | |
502 | test_atom refs/tags/signed-short contents:body '' | |
503 | test_atom refs/tags/signed-short contents:signature "$sig" | |
504 | test_atom refs/tags/signed-short contents "subject line | |
505 | $sig" | |
506 | ||
507 | test_atom refs/tags/signed-long subject 'subject line' | |
508 | test_atom refs/tags/signed-long contents:subject 'subject line' | |
509 | test_atom refs/tags/signed-long body "body contents | |
510 | $sig" | |
511 | test_atom refs/tags/signed-long contents:body 'body contents | |
512 | ' | |
513 | test_atom refs/tags/signed-long contents:signature "$sig" | |
514 | test_atom refs/tags/signed-long contents "subject line | |
515 | ||
516 | body contents | |
517 | $sig" | |
518 | ||
189a5467 RR |
519 | cat >expected <<EOF |
520 | $(git rev-parse refs/tags/master) <committer@example.com> refs/tags/master | |
521 | $(git rev-parse refs/tags/bogo) <committer@example.com> refs/tags/bogo | |
912072d5 KK |
522 | EOF |
523 | ||
3b51222c | 524 | test_expect_success 'Verify sort with multiple keys' ' |
912072d5 KK |
525 | git for-each-ref --format="%(objectname) %(taggeremail) %(refname)" --sort=objectname --sort=taggeremail \ |
526 | refs/tags/bogo refs/tags/master > actual && | |
527 | test_cmp expected actual | |
528 | ' | |
96b2d4fa | 529 | test_done |