Re: [PATCH] Teach git-p4 to ignore case in perforce filenames if configured.

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

 



torarvid@xxxxxxxxx wrote on Tue, 08 Feb 2011 12:11 +0100:
> When files are added to perforce, the path to that file has whichever case
> configuration that exists on the machine of the user who added the file.
> What does that mean? It means that when Alice adds a file
> 
> //depot/DirA/FileA.txt
> 
> ... and Bob adds:
> 
> //depot/dirA/FileB.txt
> 
> ... we may or may not get a problem. If a user sets the config variable
> git-p4.ignorecase to "true", we will consider //depot/DirA and //depot/dirA
> to be the same directory.

That's horrid.  Seriously?  A and B can both generate mixed-case
paths, but with a different mix?

If it's all just cast to lower, does it make sense to use
core.ignorecase for this?

> ---
>  contrib/fast-import/git-p4     |   22 ++++++++++++++--------
>  contrib/fast-import/git-p4.txt |   12 ++++++++++++
>  2 files changed, 26 insertions(+), 8 deletions(-)
> 
> diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
> index 04ce7e3..ca3cea0 100755
> --- a/contrib/fast-import/git-p4
> +++ b/contrib/fast-import/git-p4
> @@ -452,6 +452,12 @@ def p4ChangesForPaths(depotPaths, changeRange):
>      changelist.sort()
>      return changelist
>  
> +def p4PathStartsWith(path, prefix):
> +    ignorecase = gitConfig("git-p4.ignorecase").lower()
> +    if ignorecase in ["true", "yes", "1"]:
> +        return path.lower().startswith(prefix.lower())
> +    return path.startswith(prefix)

git config --bool will always return "true" or "false" (or "").
I think we should start looking for "true" that rather than
checking for all four possible versions of true (+ "on").

Can you put a comment in this function explaining the mixed-case
problem?  When reading the code, it's easier than searching
through the doc to learn about it.

Rest of patch looks fine.

		-- Pete
--
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]