All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Max Kirillov <max@max630.net>
Cc: Jeff King <peff@peff.net>,
	Eric Sunshine <sunshine@sunshineco.com>,
	git@vger.kernel.org
Subject: Re: [PATCH v5 1/3] blame: test to describe use of blame --reverse --first-parent
Date: Fri, 30 Oct 2015 15:30:38 -0700	[thread overview]
Message-ID: <xmqq611oj8fl.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <1446181313-15094-2-git-send-email-max@max630.net> (Max Kirillov's message of "Fri, 30 Oct 2015 07:01:51 +0200")

Max Kirillov <max@max630.net> writes:

> Reverse blame can be used to locate removal of lines which does not
> change adjacent lines. Such edits do not appear in non-reverse blame,
> because the adjacent lines last changed commit is older history, before
> the edit.
>
> For a big and active project which uses topic branches, or analogous
> feature, for example pull-requests, the history can contain many
> concurrent branches, and even after an edit merged into the target
> branch, there are still many (sometimes several tens or even hundreds)
> topic branch which do not contain it:
>
>  a0--a1-----*a2-*a3-a4...-*a100
>  |\         /   /         /
>  | b0-B1..bN   /         /
>  |\           /         /
>  | c0..   ..cN         /
>  \                    /
>   z0..            ..zN
>
> Here, the '*'s mark the first parent in merge, and uppercase B1 - the
> commit where the line being blamed for was removed. Since commits cN-zN
> do not contain the B1, the still have the line removed in B1, and
> reverce blame can report that the last commit for the line was zN
> (meaning that it was removed in a100). In fact it really does return
> some very late commit, and this makes it unusable for finding the B1
> commit.
>
> The search could be done by blame --reverse --first-parent. For range
> a0..a100 it would return a1, and then only one additional blame along
> the a0..bN will return the desired commit b0. But combining --reverse
> and --first-parent was forbidden in 95a4fb0eac, because incorrectly
> specified range could produce unexpected and meaningless result.
>
> Add test which describes the expected behavior of
> `blame --reverse --first-parent` in the case described above.
>
> Signed-off-by: Max Kirillov <max@max630.net>
> ---

There were a few obvious typos I spotted but other than that a very
understandable description.  Will queue.

Thanks.

>  t/t8009-blame-vs-topicbranches.sh | 36 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 36 insertions(+)
>  create mode 100755 t/t8009-blame-vs-topicbranches.sh
>
> diff --git a/t/t8009-blame-vs-topicbranches.sh b/t/t8009-blame-vs-topicbranches.sh
> new file mode 100755
> index 0000000..175ad37
> --- /dev/null
> +++ b/t/t8009-blame-vs-topicbranches.sh
> @@ -0,0 +1,36 @@
> +#!/bin/sh
> +
> +test_description='blaming trough history with topic branches'
> +. ./test-lib.sh
> +
> +# Creates the history shown below. '*'s mark the first parent in the merges.
> +# The only line of file.t is changed in commit B2
> +#
> +#        +---C1
> +#       /      \
> +# A0--A1--*A2--*A3
> +#   \     /
> +#    B1-B2
> +#
> +test_expect_success setup '
> +	test_commit A0 file.t line0 &&
> +	test_commit A1 &&
> +	git reset --hard A0 &&
> +	test_commit B1 &&
> +	test_commit B2 file.t line0changed &&
> +	git reset --hard A1 &&
> +	test_merge A2 B2 &&
> +	git reset --hard A1 &&
> +	test_commit C1 &&
> +	git reset --hard A2 &&
> +	test_merge A3 C1
> +	'
> +
> +test_expect_failure 'blame --reverse --first-parent finds A1' '
> +	git blame --porcelain --reverse --first-parent A0..A3 -- file.t >actual_full &&
> +	head -n 1 <actual_full | sed -e "s/ .*//" >actual &&
> +	git rev-parse A1 >expect &&
> +	test_cmp expect actual
> +	'
> +
> +test_done

  reply	other threads:[~2015-10-30 22:30 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-21  4:08 [PATCH 0/2] blame: allow blame --reverse --first-parent when it makes sense Max Kirillov
2015-10-21  4:08 ` [PATCH 1/2] Add test to describe expectation of blame --reverse with branched history Max Kirillov
2015-10-21  4:08 ` [PATCH 2/2] blame: allow blame --reverse --first-parent when it makes sense Max Kirillov
2015-10-21  4:29   ` Eric Sunshine
2015-10-22  3:52     ` Max Kirillov
2015-10-22  3:51 ` [PATCH v2 0/2] " Max Kirillov
2015-10-22  3:51   ` [PATCH v2 1/2] Add test to describe expectation of blame --reverse with branched history Max Kirillov
2015-10-22  4:19     ` Junio C Hamano
2015-10-22 14:37       ` Max Kirillov
2015-10-22 14:56         ` Max Kirillov
2015-10-22  3:51   ` [PATCH v2 2/2] blame: allow blame --reverse --first-parent when it makes sense Max Kirillov
2015-10-22  4:25     ` Junio C Hamano
2015-10-22 14:56       ` Max Kirillov
2015-10-22 19:11         ` Junio C Hamano
2015-10-25 12:43           ` Max Kirillov
2015-10-25 16:52             ` Junio C Hamano
2015-10-22  4:07   ` [PATCH v3 0/2] " Max Kirillov
2015-10-22  4:07     ` [PATCH v3 1/2] Add test to describe expectation of blame --reverse with branched history Max Kirillov
2015-10-22  4:07     ` [PATCH v3 2/2] blame: allow blame --reverse --first-parent when it makes sense Max Kirillov
2015-10-26  5:26     ` [PATCH v4 0/4] " Max Kirillov
2015-10-26  5:26       ` [PATCH v4 1/3] Add test to describe expectation of blame --reverse with branched history Max Kirillov
2015-10-26  5:41         ` Max Kirillov
2015-10-26  6:27         ` Junio C Hamano
2015-10-27  4:40           ` Max Kirillov
2015-10-27 17:57             ` Junio C Hamano
2015-10-26  5:26       ` [PATCH v4 2/3] blame: extract find_single_final Max Kirillov
2015-10-26  5:26       ` [PATCH v4 3/3] blame: allow blame --reverse --first-parent when it makes sense Max Kirillov
2015-10-30  5:01       ` [PATCH v5 0/3] " Max Kirillov
2015-10-30  5:01         ` [PATCH v5 1/3] blame: test to describe use of blame --reverse --first-parent Max Kirillov
2015-10-30 22:30           ` Junio C Hamano [this message]
2015-10-30  5:01         ` [PATCH v5 2/3] blame: extract find_single_final Max Kirillov
2015-10-30  5:01         ` [PATCH v5 3/3] blame: allow blame --reverse --first-parent when it makes sense Max Kirillov
2015-10-26  5:26     ` [PATCH v4 0/4] " Max Kirillov
2015-10-26  5:31       ` Max Kirillov

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=xmqq611oj8fl.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=max@max630.net \
    --cc=peff@peff.net \
    --cc=sunshine@sunshineco.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.