git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 1/4] git-p4: Allow setting rename/copy detection threshold.

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 18, 2011, 23:04 UTC
Message-ID
<7vy5yq5nkb.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1313706054-11740-2-git-send-email-vitor.hda@gmail.com>
Vitor Antunes <vitor.hda@gmail.com> writes:
Show 25 quoted lines
> Copy and rename detection arguments (-C and -M) allow setting a threshold value
> for the similarity ratio. If the similarity is below this threshold the rename
> or copy is ignored and the file is added as new.
> This patch allows setting git-p4.detectRenames and git-p4.detectCopies options
> to an integer value to set the respective threshold.
>
> Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
> ---
>  contrib/fast-import/git-p4 |   18 +++++++++++++-----
>  1 files changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
> index 6b9de9e..cf719be 100755
> --- a/contrib/fast-import/git-p4
> +++ b/contrib/fast-import/git-p4
> @@ -774,15 +774,23 @@ class P4Submit(Command, P4UserMap):
>  
>          if not self.detectRenames:
>              # If not explicitly set check the config variable
> -            self.detectRenames = gitConfig("git-p4.detectRenames").lower() == "true"
> +            self.detectRenames = gitConfig("git-p4.detectRenames")
>  
> -        if self.detectRenames:
> +        diffOpts = ""
> +        if self.detectRenames.lower() == "true":

This is not a new problem you introduced with this patch, but unless you are invoking "git config --bool" in your gitConfig() (I didn't bother to check), you will misunderstand different ways to say "Yes", e.g.

	[git-p4]
                detectRenames
                detectRenames = on
                detectRenames = yes
                detectRenames = 1

If you use --bool, you can rely on the values being either true or false, and do not have to do the .lower() thing.

Previous: Vitor AntunesNext: Vitor Antunes
Message 3 of 12 in “Support threshold in copy/rename detection”
  1. 0/4 Support threshold in copy/rename detectionVitor Antunes, Aug 18, 2011
  2. 1/4 git-p4: Allow setting rename/copy detection threshold.Vitor Antunes, Aug 18, 2011
  3. Junio C HamanoAug 18, 2011
  4. Vitor AntunesAug 18, 2011
  5. Pete WyckoffAug 19, 2011
  6. Vitor AntunesAug 19, 2011
  7. Pete WyckoffAug 20, 2011
  8. Vitor AntunesAug 22, 2011
  9. 2/4 git-p4: Add description of rename/copy detection options.Vitor Antunes, Aug 18, 2011
  10. 3/4 git-p4: Add test case for rename detection.Vitor Antunes, Aug 18, 2011
  11. 4/4 git-p4: Add test case for copy detection.Vitor Antunes, Aug 18, 2011
  12. Pete WyckoffAug 20, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.