Commit 1292df11 authored by Alexandru Juncu's avatar Alexandru Juncu Committed by Junio C Hamano

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: Alexandru Juncu's avatarAlex Juncu <[email protected]>
Signed-off-by: default avatarAlex Badea <[email protected]>
Acked-by: default avatarPete Wyckoff <[email protected]>
Signed-off-by: default avatarJunio C Hamano <[email protected]>
parent 96cb27a9
......@@ -2180,9 +2180,13 @@ def streamOneP4File(self, file, contents):
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]]
contents = [data]
if type_base == "utf16":
# p4 delivers different text in the python output to -G
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment