git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 04/10] t1405: sort reflog entries in a hash-independent way

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 26, 2018, 22:18 UTC
Message-ID
<xmqqefk6bhw3.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20180325192055.841459-5-sandals@crustytoothpaste.net>
"brian m. carlson" <sandals@crustytoothpaste.net> writes:
Show 5 quoted lines
> The test enumerates reflog entries in an arbitrary order and then sorts
> them.  For SHA-1, this produces results that happen to sort in
> alphabetical order, but for other hash algorithms they sort differently.
> Ensure we sort the reflog entries in a hash-independent way by sorting
> on the ref name instead of the object ID.
Makes sense.
> Remove an assumption about the length of a hash by using cut with
> the delimiter and field options instead of the character range
> option.

I thought you used your truncated blake hash to develop and verify these changes, but I'd imagine that the "42" thing were hard to spot.

Thanks.
Show 27 quoted lines
> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
> ---
>  t/t1405-main-ref-store.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/t/t1405-main-ref-store.sh b/t/t1405-main-ref-store.sh
> index e8115df5ba..a1e243a05c 100755
> --- a/t/t1405-main-ref-store.sh
> +++ b/t/t1405-main-ref-store.sh
> @@ -45,7 +45,7 @@ test_expect_success 'rename_refs(master, new-master)' '
>  '
>  
>  test_expect_success 'for_each_ref(refs/heads/)' '
> -	$RUN for-each-ref refs/heads/ | cut -c 42- >actual &&
> +	$RUN for-each-ref refs/heads/ | cut -d" " -f 2- >actual &&
>  	cat >expected <<-\EOF &&
>  	master 0x0
>  	new-master 0x0
> @@ -71,7 +71,7 @@ test_expect_success 'verify_ref(new-master)' '
>  '
>  
>  test_expect_success 'for_each_reflog()' '
> -	$RUN for-each-reflog | sort | cut -c 42- >actual &&
> +	$RUN for-each-reflog | sort -k2 | cut -c 42- >actual &&
>  	cat >expected <<-\EOF &&
>  	HEAD 0x1
>  	refs/heads/master 0x0
Previous: brian m. carlsonNext: brian m. carlson
Message 7 of 20 in “Hash-independent tests (part 1)”
  1. 00/10 Hash-independent tests (part 1)brian m. carlson, Mar 25, 2018
  2. 01/10 t1011: abstract away SHA-1-specific constantsbrian m. carlson, Mar 25, 2018
  3. 02/10 t1304: abstract away SHA-1-specific constantsbrian m. carlson, Mar 25, 2018
  4. 03/10 t1300: abstract away SHA-1-specific constantsbrian m. carlson, Mar 25, 2018
  5. 05/10 t1411: abstract away SHA-1-specific constantsbrian m. carlson, Mar 25, 2018
  6. 04/10 t1405: sort reflog entries in a hash-independent waybrian m. carlson, Mar 25, 2018
  7. Junio C HamanoMar 26, 2018
  8. brian m. carlsonMar 26, 2018
  9. 07/10 t2020: abstract away SHA-1 specific constantsbrian m. carlson, Mar 25, 2018
  10. 06/10 t1507: abstract away SHA-1-specific constantsbrian m. carlson, Mar 25, 2018
  11. 08/10 t2101: modernize test stylebrian m. carlson, Mar 25, 2018
  12. 09/10 t2101: abstract away SHA-1-specific constantsbrian m. carlson, Mar 25, 2018
  13. 10/10 t2107: abstract away SHA-1-specific constantsbrian m. carlson, Mar 25, 2018
  14. Eric SunshineMar 26, 2018
  15. Junio C HamanoMar 26, 2018
  16. Johannes SchindelinMar 27, 2018
  17. Junio C HamanoMar 28, 2018
  18. Johannes SchindelinMar 29, 2018
  19. brian m. carlsonMar 26, 2018
  20. Johannes SchindelinMar 27, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.