[PATCH] git-p4: Fix occasional truncation of symlink contents.
- From
Alexandru Juncu <alexj@rosedu.org>
- Date
- Aug 8, 2013, 13:17 UTC
- Message-ID
- <1375967858-10615-1-git-send-email-ajuncu@ixiacom.com>
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