git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Jonathan Tan <jonathantanmy@google.com>
Cc: git@vger.kernel.org, newren@gmail.com,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH on en/rename-progress v2] diffcore-rename: make diff-tree -l0 mean -l<large>
Date: Wed, 29 Nov 2017 12:23:05 -0800	[thread overview]
Message-ID: <20171129202305.GC15098@aiede.mtv.corp.google.com> (raw)
In-Reply-To: <20171129201154.192379-1-jonathantanmy@google.com>

Jonathan Tan wrote:

> In the documentation of diff-tree, it is stated that the -l option
> "prevents rename/copy detection from running if the number of
> rename/copy targets exceeds the specified number". The documentation
> does not mention any special handling for the number 0, but the
> implementation before commit 9f7e4bfa3b ("diff: remove silent clamp of
> renameLimit", 2017-11-13) treated 0 as a special value indicating that
> the rename limit is to be a very large number instead.
>
> The commit 9f7e4bfa3b changed that behavior, treating 0 as 0. Revert
> this behavior to what it was previously. This allows existing scripts
> and tools that use "-l0" to continue working. The alternative (to have
> "-l0" suppress rename detection) is probably much less useful, since
> users can just refrain from specifying -M and/or -C to have the same
> effect.
>
> Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
> ---
> v2 is exactly the same as previously, except that the commit message is
> changed following Elijah Newren's and Jonathan Nieder's comments.
>
>  diffcore-rename.c      |  2 ++
>  t/t4001-diff-rename.sh | 15 +++++++++++++++
>  2 files changed, 17 insertions(+)

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>

Thanks again.

> diff --git a/diffcore-rename.c b/diffcore-rename.c
> index 9ca0eaec7..245e999fe 100644
> --- a/diffcore-rename.c
> +++ b/diffcore-rename.c
> @@ -392,6 +392,8 @@ static int too_many_rename_candidates(int num_create,
>  	 *
>  	 *    num_create * num_src > rename_limit * rename_limit
>  	 */
> +	if (rename_limit <= 0)
> +		rename_limit = 32767;
>  	if ((num_create <= rename_limit || num_src <= rename_limit) &&
>  	    ((uint64_t)num_create * (uint64_t)num_src
>  	     <= (uint64_t)rename_limit * (uint64_t)rename_limit))
> diff --git a/t/t4001-diff-rename.sh b/t/t4001-diff-rename.sh
> index 0d1fa45d2..eadf4f624 100755
> --- a/t/t4001-diff-rename.sh
> +++ b/t/t4001-diff-rename.sh
> @@ -230,4 +230,19 @@ test_expect_success 'rename pretty print common prefix and suffix overlap' '
>  	test_i18ngrep " d/f/{ => f}/e " output
>  '
>  
> +test_expect_success 'diff-tree -l0 defaults to a big rename limit, not zero' '
> +	test_write_lines line1 line2 line3 >myfile &&
> +	git add myfile &&
> +	git commit -m x &&
> +
> +	test_write_lines line1 line2 line4 >myotherfile &&
> +	git rm myfile &&
> +	git add myotherfile &&
> +	git commit -m x &&
> +
> +	git diff-tree -M -l0 HEAD HEAD^ >actual &&
> +	# Verify that a rename from myotherfile to myfile was detected
> +	grep "myotherfile.*myfile" actual
> +'
> +
>  test_done

  reply	other threads:[~2017-11-29 20:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-29 18:32 [PATCH on en/rename-progress] diffcore-rename: make diff-tree -l0 mean -l<large> Jonathan Tan
2017-11-29 18:51 ` Elijah Newren
2017-11-29 18:54   ` Jonathan Tan
2017-11-29 20:04   ` Jonathan Nieder
2017-11-29 20:11 ` [PATCH on en/rename-progress v2] " Jonathan Tan
2017-11-29 20:23   ` Jonathan Nieder [this message]
2017-11-29 23:40   ` Elijah Newren

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20171129202305.GC15098@aiede.mtv.corp.google.com \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jonathantanmy@google.com \
    --cc=newren@gmail.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).