t4205: sort log output in a hash-independent way

This test enumerates log entries and then sorts them. For SHA-1, this produces results that happen to sort in the order specified in the test, but for other hash algorithms they sort differently. Ensure we sort the log entries in a hash-independent way by sorting on the ref name instead of the object ID. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed May 21, 2018 at 02:01 UTC 2a73022e5cd95e01e5923cf3a451f941e48806be
1 file changed +4 -4
t/t4205-log-pretty-formats.sh
+4 -4
@@ -516,22 +516,22 @@ test_expect_success 'log decoration properly follows tag chain' '
516 git commit --amend -m shorter &&
517 git log --no-walk --tags --pretty="%H %d" --decorate=full >actual &&
518 cat <<-EOF >expected &&
519 - $head1 (tag: refs/tags/tag2)
519 $head2 (tag: refs/tags/message-one)
520 $old_head1 (tag: refs/tags/message-two)
521 + $head1 (tag: refs/tags/tag2)
522 EOF
523 - sort actual >actual1 &&
523 + sort -k3 actual >actual1 &&
524 test_cmp expected actual1
525 '
526
527 test_expect_success 'clean log decoration' '
528 git log --no-walk --tags --pretty="%H %D" --decorate=full >actual &&
529 cat >expected <<-EOF &&
530 - $head1 tag: refs/tags/tag2
530 $head2 tag: refs/tags/message-one
531 $old_head1 tag: refs/tags/message-two
532 + $head1 tag: refs/tags/tag2
533 EOF
534 - sort actual >actual1 &&
534 + sort -k3 actual >actual1 &&
535 test_cmp expected actual1
536 '
537