diff options
author | Alexandru Juncu <alexj@rosedu.org> | 2013-08-08 16:17:38 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-08-12 10:10:46 -0700 |
commit | 1292df11e8063442f911b2a4d0f7213f117d54d7 (patch) | |
tree | 16154f32d5f20b1d7519878db69c943d41c8add0 /git-p4.py | |
parent | 96cb27a9d2db3c01b8e296a0fbc1da1da09d1412 (diff) | |
download | git-1292df11e8063442f911b2a4d0f7213f117d54d7.tar.gz |
git-p4: Fix occasional truncation of symlink contents.aj/p4-symlink-lose-nl
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>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-p4.py')
-rwxr-xr-x | git-p4.py | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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 |