git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-p4: Fix occasional truncation of symlink contents.
@ 2013-08-08 13:17 Alexandru Juncu
  2013-08-11 11:57 ` Pete Wyckoff
  0 siblings, 1 reply; 6+ messages in thread
From: Alexandru Juncu @ 2013-08-08 13:17 UTC (permalink / raw)
  To: git; +Cc: Alexandru Juncu, Alex Badea

Symlink contents in p4 print sometimes have a trailing
new line character, but sometimes it doesn't. git-p4
should only remove the last character if that character
is '\n'.

Signed-off-by: Alex Juncu <ajuncu@ixiacom.com>
Signed-off-by: Alex Badea <abadea@ixiacom.com>
---
 git-p4.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/git-p4.py b/git-p4.py
index 31e71ff..a53a6dc 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -2180,9 +2180,13 @@ class P4Sync(Command, P4UserMap):
             git_mode = "100755"
         if type_base == "symlink":
             git_mode = "120000"
-            # p4 print on a symlink contains "target\n"; remove the newline
+            # p4 print on a symlink sometimes contains "target\n";
+            # if it does, remove the newline
             data = ''.join(contents)
-            contents = [data[:-1]]
+            if data[-1] == '\n':
+                contents = [data[:-1]]
+            else:
+                contents = [data]
 
         if type_base == "utf16":
             # p4 delivers different text in the python output to -G
-- 
1.8.4.rc0.1.g8f6a3e5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-08-12 17:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-08 13:17 [PATCH] git-p4: Fix occasional truncation of symlink contents Alexandru Juncu
2013-08-11 11:57 ` Pete Wyckoff
2013-08-12  7:46   ` Alexandru Juncu
2013-08-12 12:38     ` Pete Wyckoff
2013-08-12 13:30       ` Alexandru Juncu
2013-08-12 17:11       ` Junio C Hamano

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).