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