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

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

From
PWPete Wyckoff <pw@padd.com>
Date
Aug 18, 2011, 15:18 UTC
Message-ID
<20110818151847.GA2043@padd.com>
In-Reply-To
<1313629459-22937-2-git-send-email-vitor.hda@gmail.com>
vitor.hda@gmail.com wrote on Thu, 18 Aug 2011 02:04 +0100:
Show 5 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.
[..]
Show 11 quoted lines
> -        if self.detectRenames:
> +        diffOpts = ""
> +        if self.detectRenames.lower() == "true":
>              diffOpts = "-M"
> -        else:
> -            diffOpts = ""
> +        elif self.detectRenames != "":
> +            self.detectRenames = int(self.detectRenames)
> +            if self.detectRenames >= 0 and self.detectRenames <= 100:
> +                diffOpts = "-M%d" % self.detectRenames
>  

This is a good idea. But I notice that -M, -C, -B can take a diverse set of option forms, including floating point and optional "%". "-B" can take two args, separated by a "/".

See diff_scoreopt_parse(). It would be weird for git-p4 to limit that set to integers like you do here.

Would you be willing to change it to pass the string blindly? Just filter out the special values, and pass everything else unchanged.

    "true" -> "-M"
    "false" -> ""
    "" -> ""
    ".*" -> "\1"

Dunno if you care about --break-rewrites. Just pointing to it as a similar option to -M and -C in case you missed it.

		-- Pete
Previous: Vitor AntunesNext: Vitor Antunes
Message 3 of 7 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. Pete WyckoffAug 18, 2011
  4. Vitor AntunesAug 18, 2011
  5. 2/4 git-p4: Add description of rename/copy detection options.Vitor Antunes, Aug 18, 2011
  6. 3/4 git-p4: Add test case for rename detection.Vitor Antunes, Aug 18, 2011
  7. 4/4 git-p4: Add test case for copy detection.Vitor Antunes, Aug 18, 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.