git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pete Wyckoff <pw@padd.com>
To: Tor Arvid Lund <torarvid@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Teach git-p4 to ignore case in perforce filenames if configured.
Date: Fri, 11 Feb 2011 07:22:53 -0500	[thread overview]
Message-ID: <20110211122253.GA14662@mew.padd.com> (raw)
In-Reply-To: <1297163499-18776-1-git-send-email-torarvid@gmail.com>

torarvid@gmail.com 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

      reply	other threads:[~2011-02-11 12:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-08 11:11 [PATCH] Teach git-p4 to ignore case in perforce filenames if configured Tor Arvid Lund
2011-02-11 12:22 ` Pete Wyckoff [this message]

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

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

  git send-email \
    --in-reply-to=20110211122253.GA14662@mew.padd.com \
    --to=pw@padd.com \
    --cc=git@vger.kernel.org \
    --cc=torarvid@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.
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 NNTP newsgroup(s).