Replace \r\n with \n when importing from p4 on Windows
Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
Marius Storm-Olsen committed
May 24, 2007 at 14:07 UTC
c1f9197f372a5378c3dbb36adeedf37ae175ecf1
1 file changed
+4
contrib/fast-import/git-p4
+4
@@ -540,6 +540,7 @@ class P4Sync(Command):
540
self.verbose = False
541
self.importIntoRemotes = True
542
self.maxChanges = ""
543
+ self.isWindows = (platform.system() == "Windows")
544
545
def p4File(self, depotPath):
546
return os.popen("p4 print -q \"%s\"" % depotPath, "rb").read()
@@ -647,6 +648,9 @@ class P4Sync(Command):
648
649
data = self.p4File(depotPath)
650
651
+ if self.isWindows and file["type"].endswith("text"):
652
+ data = data.replace("\r\n", "\n")
653
+
654
self.gitStream.write("M %s inline %s\n" % (mode, relPath))
655
self.gitStream.write("data %s\n" % len(data))
656
self.gitStream.write(data)