for-each-ref: Field with abbreviated objectname

Introduce a :short modifier to objectname which outputs the abbreviated
object name.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Michael J Gruber
2010-05-13 14:31:46 +02:00
committed by Junio C Hamano
parent 04794fdc27
commit 67687feae5
3 changed files with 13 additions and 0 deletions

View File

@ -295,6 +295,15 @@ test_expect_success 'Check short upstream format' '
test_cmp expected actual
'
cat >expected <<EOF
67a36f1
EOF
test_expect_success 'Check short objectname format' '
git for-each-ref --format="%(objectname:short)" refs/heads >actual &&
test_cmp expected actual
'
test_expect_success 'Check for invalid refname format' '
test_must_fail git for-each-ref --format="%(refname:INVALID)"
'