git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "brian m. carlson" <sandals@crustytoothpaste.net>
Cc: git@vger.kernel.org, "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
	"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
	"Lars Schneider" <larsxschneider@gmail.com>
Subject: Re: [PATCH 04/10] t1405: sort reflog entries in a hash-independent way
Date: Mon, 26 Mar 2018 15:18:20 -0700	[thread overview]
Message-ID: <xmqqefk6bhw3.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20180325192055.841459-5-sandals@crustytoothpaste.net> (brian m. carlson's message of "Sun, 25 Mar 2018 19:20:49 +0000")

"brian m. carlson" <sandals@crustytoothpaste.net> writes:

> 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.


> 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

  reply	other threads:[~2018-03-26 22:18 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-25 19:20 [PATCH 00/10] Hash-independent tests (part 1) brian m. carlson
2018-03-25 19:20 ` [PATCH 01/10] t1011: abstract away SHA-1-specific constants brian m. carlson
2018-03-25 19:20 ` [PATCH 02/10] t1304: " brian m. carlson
2018-03-25 19:20 ` [PATCH 03/10] t1300: " brian m. carlson
2018-03-25 19:20 ` [PATCH 04/10] t1405: sort reflog entries in a hash-independent way brian m. carlson
2018-03-26 22:18   ` Junio C Hamano [this message]
2018-03-26 23:02     ` brian m. carlson
2018-03-25 19:20 ` [PATCH 05/10] t1411: abstract away SHA-1-specific constants brian m. carlson
2018-03-25 19:20 ` [PATCH 06/10] t1507: " brian m. carlson
2018-03-25 19:20 ` [PATCH 07/10] t2020: abstract away SHA-1 specific constants brian m. carlson
2018-03-25 19:20 ` [PATCH 08/10] t2101: modernize test style brian m. carlson
2018-03-25 19:20 ` [PATCH 09/10] t2101: abstract away SHA-1-specific constants brian m. carlson
2018-03-25 19:20 ` [PATCH 10/10] t2107: " brian m. carlson
2018-03-26  2:10 ` [PATCH 00/10] Hash-independent tests (part 1) Eric Sunshine
2018-03-26  4:48   ` Junio C Hamano
2018-03-27 14:40     ` Johannes Schindelin
2018-03-28 16:58       ` Junio C Hamano
2018-03-29 14:01         ` Johannes Schindelin
2018-03-26 22:27   ` brian m. carlson
2018-03-27 14:30 ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqefk6bhw3.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=larsxschneider@gmail.com \
    --cc=pclouds@gmail.com \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).