]> git.ipfire.org Git - thirdparty/git.git/commit
t: sort output of hashmap iteration
authorJeff King <peff@peff.net>
Wed, 31 Jul 2019 01:23:37 +0000 (21:23 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 31 Jul 2019 17:00:34 +0000 (10:00 -0700)
commite1e7a77141bda8f2ab02f5ed8b0030cba793ec2d
treebe09113dfa2c6d70f9137e9a520f56f2772d9ee5
parent026dd738a6e5f1e42ef0f390feacb5ed6acc4ee8
t: sort output of hashmap iteration

The iteration order of a hashmap is undefined, and may depend on things
like the exact set of items added, or the table has been grown or
shrunk. In the case of an oidmap, it even depends on endianness, because
we take the oid hash by casting sha1 bytes directly into an unsigned
int.

Let's sort the test-tool output from any hash iterators. In the case of
t0011, this is just future-proofing. But for t0016, it actually fixes a
reported failure on the big-endian s390 and nonstop ports.

I didn't bother to teach the helper functions to optionally sort output.
They are short enough that it's simpler to just repeat them inline for
the iteration tests than it is to add a --sort option.

Reported-by: Randall S. Becker <rsbecker@nexbridge.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t0011-hashmap.sh
t/t0016-oidmap.sh