git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Barret Rhoden <brho@google.com>, Nuthan Munaiah <nm6061@rit.edu>,
	git@vger.kernel.org
Subject: Re: [PATCH 1/3] t8003: check output of coalesced blame
Date: Thu, 13 Aug 2020 10:04:51 -0700	[thread overview]
Message-ID: <xmqq4kp64guk.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <20200813052305.GA2514880@coredump.intra.peff.net> (Jeff King's message of "Thu, 13 Aug 2020 01:23:05 -0400")

Jeff King <peff@peff.net> writes:

> Commit f0cbe742f4 (blame: add a test to cover blame_coalesce(),
> 2019-06-20) added a test case where blame can usefully coalesce two
> groups of lines. But since it relies on the normal blame output, it only
> exercises the code and can't tell whether the lines were actually
> joined into a single group.
>
> However, by using --porcelain output, we can see how git-blame considers
> the groupings (and likewise how the coalescing might have a real
> user-visible impact for a tool that uses the porcelain-output
> groupings). This lets us confirm that we are indeed coalescing correctly
> (and the fact that this test case requires coalescing can be verified by
> dropping the call to blame_coalesce(), causing the test to fail).
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
>  t/t8003-blame-corner-cases.sh | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/t/t8003-blame-corner-cases.sh b/t/t8003-blame-corner-cases.sh
> index b871dd4f86..1e89494ef6 100755
> --- a/t/t8003-blame-corner-cases.sh
> +++ b/t/t8003-blame-corner-cases.sh
> @@ -273,10 +273,6 @@ test_expect_success 'blame file with CRLF core.autocrlf=true' '
>  	grep "A U Thor" actual
>  '
>  
> -# Tests the splitting and merging of blame entries in blame_coalesce().
> -# The output of blame is the same, regardless of whether blame_coalesce() runs
> -# or not, so we'd likely only notice a problem if blame crashes or assigned
> -# blame to the "splitting" commit ('SPLIT' below).
>  test_expect_success 'blame coalesce' '
>  	cat >giraffe <<-\EOF &&
>  	ABC
> @@ -302,10 +298,11 @@ test_expect_success 'blame coalesce' '
>  	git commit -m "same contents as original" &&
>  
>  	cat >expect <<-EOF &&
> -	$oid 1) ABC
> -	$oid 2) DEF
> +	$oid 1 1 2
> +	$oid 2 2
>  	EOF

It has become a bit harder to grok, but for the purpose of the later
steps to see where things exactly came from (including their line
numbers), it is easier to see what is going on with the new format.

> -	git -c core.abbrev=$(test_oid hexsz) blame -s giraffe >actual &&
> +	git blame --porcelain giraffe >actual.raw &&

The original forced the abbrev length; by switching to the format
for porcelain-writers, we know we will get the full object name.  OK.

> +	grep "^$oid" actual.raw >actual &&
>  	test_cmp expect actual
>  '

  reply	other threads:[~2020-08-13 17:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-07  1:05 `git blame` Line Number Off-by-one Nuthan Munaiah
2020-08-07 21:21 ` Jeff King
2020-08-07 21:33   ` Jeff King
2020-08-07 21:45     ` Jeff King
2020-08-07 22:05     ` Junio C Hamano
2020-08-07 22:26       ` Jeff King
2020-08-07 22:35         ` Jeff King
2020-08-13  5:20           ` [PATCH 0/3] blame: fix bug in coalescing non-adjacent "-L" chunks Jeff King
2020-08-13  5:23             ` [PATCH 1/3] t8003: check output of coalesced blame Jeff King
2020-08-13 17:04               ` Junio C Hamano [this message]
2020-08-13 17:22                 ` Jeff King
2020-08-13  5:23             ` [PATCH 2/3] t8003: factor setup out of coalesce test Jeff King
2020-08-13  5:25             ` [PATCH 3/3] blame: only coalesce lines that are adjacent in result Jeff King
2020-08-13 16:59               ` Junio C Hamano
2020-08-13 18:41               ` Junio C Hamano
2020-08-13 12:25             ` [PATCH 0/3] blame: fix bug in coalescing non-adjacent "-L" chunks Barret Rhoden

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=xmqq4kp64guk.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=brho@google.com \
    --cc=git@vger.kernel.org \
    --cc=nm6061@rit.edu \
    --cc=peff@peff.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).