MinGW: Fix stat definitions to work with MinGW runtime version 4.0
[gitweb.git] / git-p4.py
index 88fcf232e5739b14a60f8b2c2a45add4a48e764b..a53a6dc406c26daaf263944d38b53b27db271072 100755 (executable)
--- a/git-p4.py
+++ b/git-p4.py
@@ -1786,7 +1786,7 @@ def run(self, args):
             missingGitTags = gitTags - p4Labels
             self.exportGitTags(missingGitTags)
 
-        # exit with error unless everything applied perfecly
+        # exit with error unless everything applied perfectly
         if len(commits) != len(applied):
                 sys.exit(1)
 
@@ -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]]
+            else:
+                contents = [data]
 
         if type_base == "utf16":
             # p4 delivers different text in the python output to -G