Junio C Hamano <gitster@xxxxxxxxx> writes: > Of course, we _could_ update the test_atom to do something magic > only when the 'contents' atom is being asked. We notice that $2 is > 'contents', do the usual test_expect_success for 'contents', and > then measure the byte length of $3 ourselves and test > 'contents:size'. That way, all the above test updates would become > unnecessary (and the last two hunks of this patch can also go). > > That approach may even allow you to hide the details of sanitize-pgp > in the updated test_atom so that the actual tests may not have to get > updated even for signed tags. After seeing the "wc -c" portability issues, I am now even more inclined to say that the above is the right direction. The portability worries can and should be encapsulated in a single test_atom helper function, just as it can be used to hide the differences between signed tags, annotated tags and commits. Thanks. >> +# We cannot use test_atom to check contents:size of signed tags due to sanitize_pgp >> +test_tag_contents_size_pgp () { >> + ref="$1" >> + test_expect_success $PREREQ "basic atom: $ref contents:size" " >> + git cat-file tag $ref | tail -n +6 | wc -c >expected && >> + git for-each-ref --format='%(contents:size)' $ref >actual && >> + test_cmp expected actual >> + " >> +}