Code

git-p4: fix bug in symlink handling
authorEvan Powers <evan.powers@gmail.com>
Tue, 16 Feb 2010 08:44:08 +0000 (00:44 -0800)
committerJunio C Hamano <gitster@pobox.com>
Sat, 20 Feb 2010 16:38:21 +0000 (08:38 -0800)
Fix inadvertent breakage from b932705 (git-p4: stream from perforce to
speed up clones, 2009-07-30) 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>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/fast-import/git-p4

index e7c48144e62a0829a5f817c5debaee28516b351d..cd96c6f81f6e054c3c5cdb04f810204aaa594e49 100755 (executable)
@@ -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 = []