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

[PATCH] git-p4: fix bug in symlink handling

From
EPEvan Powers <evan.powers@gmail.com>
Date
Feb 16, 2010, 08:44 UTC
Message-ID
<6682cfcf1002160044i7aacd1b0t7bb351380b1bd27c@mail.gmail.com>

Fix inadvertent breakage from b932705 in the code that strips the trailing '\n' from p4 print on a symlink. (In practice, contents is of the form ['target\n', ''].)

Signed-off-by: Evan Powers <evan.powers@gmail.com>
---
This patch Works For Me, but I didn't take the time to understand the
entire code path so it might be equally valid to replace contents.pop()
with contents.pop(0) and call it a day.
 contrib/fast-import/git-p4 |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index e7c4814..cd96c6f 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -967,9 +967,8 @@ class P4Sync(Command):
         elif file["type"] == "symlink":
             mode = "120000"
             # p4 print on a symlink contains "target\n", so strip it off
-            last = contents.pop()
-            last = last[:-1]
-            contents.append(last)
+            data = ''.join(contents)
+            contents = [data[:-1]]

         if self.isWindows and file["type"].endswith("text"):
             mangled = []
-- 
1.6.6
Next: Pete Wyckoff
Message 1 of 3 in “git-p4: fix bug in symlink handling”
  1. git-p4: fix bug in symlink handlingEvan Powers, Feb 16, 2010
  2. Pete WyckoffFeb 20, 2010
  3. Junio C HamanoFeb 20, 2010

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.