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

Re: [PATCH v2 7/8] git-p4: decode p4 wildcard characters

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 21, 2011, 23:32 UTC
Message-ID
<7vbp25hsk6.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1298121481-7005-8-git-send-email-pw@padd.com>
Pete Wyckoff <pw@padd.com> writes:
Show 11 quoted lines
> There are four wildcard characters in p4.  Files with these
> characters can be added to p4 repos using the "-f" option.
> They are stored in %xx notation, and when checked out, p4
> converts them back to normal.
>
> This patch does the same thing when importing into git,
> converting the four special characters.  Without this change,
> the files appear with literal %xx in their names.
>
> Be careful not to produce "*" in filenames on windows.  That
> will fail.
Show 11 quoted lines
> +    # P4 wildcards are not allowed in filenames.  P4 complains
> +    # if you simply add them, but you can force it with "-f", in
> +    # which case it translates them into %xx encoding internally.
> +    # Search for and fix just these four characters.  Do % last so
> +    # that fixing it does not inadvertently create new %-escapes.
> +    #
> +    def wildcard_decode(self, path):
> +        # Cannot have * in a filename in windows; untested as to
> +        # what p4 would do in such a case.
> +        if not self.isWindows:
> +            path = path.replace("%2A", "*")

I'll queue the patch as-is, but perhaps we can ask for help from people who have access to P4 on both non-Windows and Windows to run a small test to determine what happens in the native client?

 1. On a non-Windows client, add a path with '*' in it to the depot;
    perhaps "p4 add" might fail at this point, in which case we don't
    need to worry about this issue at all.
 
 2. Create a p4 client on Windows against that depot, and sync it; unless
    the previous step failed, we will see what happens (I would imagine it
    either dies or mangles the pathname and warns), so that we have
    something to emulate.
and then the quoted part can be further refined in a separate patch later.
Thanks.
Previous: Pete WyckoffNext: Pete Wyckoff
Message 11 of 16 in “git-p4 fixes and enhancements”
  1. 0/8 git-p4 fixes and enhancementsPete Wyckoff, Feb 19, 2011
  2. 1/8 git-p4: test scriptPete Wyckoff, Feb 19, 2011
  3. 2/8 git-p4: fix key error for p4 problemPete Wyckoff, Feb 19, 2011
  4. 3/8 git-p4: add missing newline in initial import messagePete Wyckoff, Feb 19, 2011
  5. 4/8 git-p4: accommodate new move/delete type in p4Pete Wyckoff, Feb 19, 2011
  6. Junio C HamanoFeb 21, 2011
  7. 5/8 git-p4: reinterpret confusing p4 messagePete Wyckoff, Feb 19, 2011
  8. Tor Arvid LundFeb 23, 2011
  9. 6/8 git-p4: better message for "git-p4 sync" when not clonedPete Wyckoff, Feb 19, 2011
  10. 7/8 git-p4: decode p4 wildcard charactersPete Wyckoff, Feb 19, 2011
  11. Junio C HamanoFeb 21, 2011
  12. Pete WyckoffFeb 24, 2011
  13. Tor Arvid LundFeb 24, 2011
  14. Junio C HamanoFeb 24, 2011
  15. Pete WyckoffFeb 27, 2011
  16. 8/8 git-p4: support clone --barePete Wyckoff, Feb 19, 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.