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

Re: is git-p4 compatible with p4/linux?

From
PWPete Wyckoff <pw@padd.com>
Date
Apr 20, 2013, 13:22 UTC
Message-ID
<20130420132233.GA2094@padd.com>
In-Reply-To
<CAJDDKr4gLWev=N-yMw3j0norzVxBp99ie_EYAbNcUvWcL-_70w@mail.gmail.com>
davvid@gmail.com wrote on Sat, 20 Apr 2013 03:50 -0700:
Show 22 quoted lines
> On Thu, Apr 18, 2013 at 5:09 PM, Pete Wyckoff <pw@padd.com> wrote:
> >> First issue
> >> -----------
> >>
> >> git-p4 assumes the output of 'p4 print' adds a newline to the
> >> target.  To work around this, git-p4.py strips the last char from
> >> symlinks as shown in the following snippet:
> >>
> >>     if type_base == "symlink":
> >>         git_mode = "120000"
> >>         # p4 print on a symlink contains "target\n"; remove the newline
> >>         data = ''.join(contents)
> >>         contents = [data[:-1]]
> 
> This line could be made more robust by changing it to:
> 
>     contents = [data.rstrip('\n')]
> 
> That way it only strips off newlines if they exist, which essentially
> papers over these rogue depot files.
> Alternatively, it could use rstrip() with no arguments to cast a wider
> net and catch all whitespace.

I was tempted to do that, but it is possible to put \n and other space characters in the target of symlinks. It's unfortunate that p4 always appears to tack on a newline itself.

We'll see if Alex comes up with a pattern that shows how he ended up with the odd symlinks.

		-- Pete
Previous: David Aguilar
Message 8 of 8 in “is git-p4 compatible with p4/linux?”
  1. Alexander TomlinsonApr 17, 2013
  2. Alexander TomlinsonApr 17, 2013
  3. Pete WyckoffApr 19, 2013
  4. Alexander TomlinsonApr 19, 2013
  5. Pete WyckoffApr 19, 2013
  6. Alex TomlinsonApr 19, 2013
  7. David AguilarApr 20, 2013
  8. Pete WyckoffApr 20, 2013

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.