@@ -49,11 +49,15 @@ test_atom() {
4949}
5050
5151test_atom head refname refs/heads/master
52+ test_atom head refname:short master
5253test_atom head upstream refs/remotes/origin/master
54+ test_atom head upstream:short origin/master
5355test_atom head push refs/remotes/myfork/master
56+ test_atom head push:short myfork/master
5457test_atom head objecttype commit
5558test_atom head objectsize 171
5659test_atom head objectname $( git rev-parse refs/heads/master)
60+ test_atom head objectname:short $( git rev-parse --short refs/heads/master)
5761test_atom head tree $( git rev-parse refs/heads/master^{tree})
5862test_atom head parent ' '
5963test_atom head numparent 0
@@ -86,11 +90,13 @@ test_atom head contents 'Initial
8690test_atom head HEAD ' *'
8791
8892test_atom tag refname refs/tags/testtag
93+ test_atom tag refname:short testtag
8994test_atom tag upstream ' '
9095test_atom tag push ' '
9196test_atom tag objecttype tag
9297test_atom tag objectsize 154
9398test_atom tag objectname $( git rev-parse refs/tags/testtag)
99+ test_atom tag objectname:short $( git rev-parse --short refs/tags/testtag)
94100test_atom tag tree ' '
95101test_atom tag parent ' '
96102test_atom tag numparent ' '
@@ -338,47 +344,14 @@ for i in "--perl --shell" "-s --python" "--python --tcl" "--tcl --perl"; do
338344 "
339345done
340346
341- cat > expected << \EOF
342- master
343- testtag
344- EOF
345-
346- test_expect_success ' Check short refname format' '
347- (git for-each-ref --format="%(refname:short)" refs/heads &&
348- git for-each-ref --format="%(refname:short)" refs/tags) >actual &&
349- test_cmp expected actual
350- '
351-
352- cat > expected << EOF
353- origin/master
354- EOF
355-
356- test_expect_success ' Check short upstream format' '
357- git for-each-ref --format="%(upstream:short)" refs/heads >actual &&
358- test_cmp expected actual
359- '
360-
361347test_expect_success ' setup for upstream:track[short]' '
362348 test_commit two
363349'
364350
365- cat > expected << EOF
366- [ahead 1]
367- EOF
368-
369- test_expect_success ' Check upstream:track format' '
370- git for-each-ref --format="%(upstream:track)" refs/heads >actual &&
371- test_cmp expected actual
372- '
373-
374- cat > expected << EOF
375- >
376- EOF
377-
378- test_expect_success ' Check upstream:trackshort format' '
379- git for-each-ref --format="%(upstream:trackshort)" refs/heads >actual &&
380- test_cmp expected actual
381- '
351+ test_atom head upstream:track ' [ahead 1]'
352+ test_atom head upstream:trackshort ' >'
353+ test_atom head push:track ' [ahead 1]'
354+ test_atom head push:trackshort ' >'
382355
383356test_expect_success ' Check that :track[short] cannot be used with other atoms' '
384357 test_must_fail git for-each-ref --format="%(refname:track)" 2>/dev/null &&
@@ -398,21 +371,6 @@ test_expect_success 'Check that :track[short] works when upstream is invalid' '
398371 test_cmp expected actual
399372'
400373
401- test_expect_success ' %(push) supports tracking specifiers, too' '
402- echo "[ahead 1]" >expected &&
403- git for-each-ref --format="%(push:track)" refs/heads >actual &&
404- test_cmp expected actual
405- '
406-
407- cat > expected << EOF
408- $( git rev-parse --short HEAD)
409- EOF
410-
411- test_expect_success ' Check short objectname format' '
412- git for-each-ref --format="%(objectname:short)" refs/heads >actual &&
413- test_cmp expected actual
414- '
415-
416374test_expect_success ' Check for invalid refname format' '
417375 test_must_fail git for-each-ref --format="%(refname:INVALID)"
418376'
0 commit comments