From: Junio C Hamano <gitster@pobox•com>
To: Stefan Beller <sbeller@google•com>
Cc: git@vger•kernel.org
Subject: Re: [PATCH] t8008: rely on rev-parse'd HEAD instead of sha1 value
Date: Tue, 18 Jul 2017 12:17:25 -0700 [thread overview]
Message-ID: <xmqqwp75o8qi.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20170718002020.14309-1-sbeller@google.com> (Stefan Beller's message of "Mon, 17 Jul 2017 17:20:20 -0700")
Stefan Beller <sbeller@google•com> writes:
> Remove hard coded sha1 values, obtain the values using 'git rev-parse HEAD'
> which should be future proof regardless of the hash function used.
Don't hardcoded lengths of the hashes defeat this future-proofing
effort, though? It shouldn't be too hard to do the equivalent of
the auto computation of abbreviation in this script, which would be
true future-proofing, I guess.
> Signed-off-by: Stefan Beller <sbeller@google•com>
> ---
> t/t8008-blame-formats.sh | 28 +++++++++++++++-------------
> 1 file changed, 15 insertions(+), 13 deletions(-)
>
> diff --git a/t/t8008-blame-formats.sh b/t/t8008-blame-formats.sh
> index 92c8e792d1..49cac4b9af 100755
> --- a/t/t8008-blame-formats.sh
> +++ b/t/t8008-blame-formats.sh
> @@ -12,22 +12,25 @@ test_expect_success 'setup' '
> echo c >>file &&
> echo d >>file &&
> test_tick &&
> - git commit -a -m two
> + git commit -a -m two &&
> + ID1=$(git rev-parse HEAD^) &&
> + shortID1="^$(git rev-parse HEAD^ |cut -c 1-7)" &&
> + ID2=$(git rev-parse HEAD) &&
> + shortID2="$(git rev-parse HEAD |cut -c 1-8)"
> '
>
> -cat >expect <<'EOF'
> -^baf5e0b (A U Thor 2005-04-07 15:13:13 -0700 1) a
> -8825379d (A U Thor 2005-04-07 15:14:13 -0700 2) b
> -8825379d (A U Thor 2005-04-07 15:14:13 -0700 3) c
> -8825379d (A U Thor 2005-04-07 15:14:13 -0700 4) d
> +cat >expect <<EOF
> +$shortID1 (A U Thor 2005-04-07 15:13:13 -0700 1) a
> +$shortID2 (A U Thor 2005-04-07 15:14:13 -0700 2) b
> +$shortID2 (A U Thor 2005-04-07 15:14:13 -0700 3) c
> +$shortID2 (A U Thor 2005-04-07 15:14:13 -0700 4) d
> EOF
> test_expect_success 'normal blame output' '
> git blame file >actual &&
> test_cmp expect actual
> '
>
> -ID1=baf5e0b3869e0b2b2beb395a3720c7b51eac94fc
> -COMMIT1='author A U Thor
> +COMMIT1="author A U Thor
> author-mail <author@example•com>
> author-time 1112911993
> author-tz -0700
> @@ -37,9 +40,8 @@ committer-time 1112911993
> committer-tz -0700
> summary one
> boundary
> -filename file'
> -ID2=8825379dfb8a1267b58e8e5bcf69eec838f685ec
> -COMMIT2='author A U Thor
> +filename file"
> +COMMIT2="author A U Thor
> author-mail <author@example•com>
> author-time 1112912053
> author-tz -0700
> @@ -48,8 +50,8 @@ committer-mail <committer@example•com>
> committer-time 1112912053
> committer-tz -0700
> summary two
> -previous baf5e0b3869e0b2b2beb395a3720c7b51eac94fc file
> -filename file'
> +previous $ID1 file
> +filename file"
>
> cat >expect <<EOF
> $ID1 1 1 1
next prev parent reply other threads:[~2017-07-18 19:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-18 0:20 [PATCH] t8008: rely on rev-parse'd HEAD instead of sha1 value Stefan Beller
2017-07-18 19:17 ` Junio C Hamano [this message]
2017-07-18 19:22 ` Stefan Beller
2017-07-18 19:38 ` Junio C Hamano
2017-07-26 19:06 ` [PATCHv2] " Stefan Beller
2017-07-26 20:32 ` Junio C Hamano
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=xmqqwp75o8qi.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=sbeller@google$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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