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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Vitor Antunes <vitor.hda@xxxxxxxxx> writes:

> 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@xxxxxxxxx>
> ---
>  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.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]