Skip to content

Commit 1292df1

Browse files
alexandrujuncugitster
authored andcommitted
git-p4: Fix occasional truncation of symlink contents.
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 <[email protected]> Signed-off-by: Alex Badea <[email protected]> Acked-by: Pete Wyckoff <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 96cb27a commit 1292df1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

git-p4.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2180,9 +2180,13 @@ def streamOneP4File(self, file, contents):
21802180
git_mode = "100755"
21812181
if type_base == "symlink":
21822182
git_mode = "120000"
2183-
# p4 print on a symlink contains "target\n"; remove the newline
2183+
# p4 print on a symlink sometimes contains "target\n";
2184+
# if it does, remove the newline
21842185
data = ''.join(contents)
2185-
contents = [data[:-1]]
2186+
if data[-1] == '\n':
2187+
contents = [data[:-1]]
2188+
else:
2189+
contents = [data]
21862190

21872191
if type_base == "utf16":
21882192
# p4 delivers different text in the python output to -G

0 commit comments

Comments
 (0)