From: Marius Storm-Olsen Date: Thu, 24 May 2007 12:07:55 +0000 (+0200) Subject: Replace \r\n with \n when importing from p4 on Windows X-Git-Tag: v1.5.3-rc0~65^2^2~62 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c1f9197f372a5378c3dbb36adeedf37ae175ecf1;p=git.git Replace \r\n with \n when importing from p4 on Windows Signed-off-by: Marius Storm-Olsen --- diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4 index 9e9d623a3..09b3cb557 100755 --- a/contrib/fast-import/git-p4 +++ b/contrib/fast-import/git-p4 @@ -540,6 +540,7 @@ class P4Sync(Command): self.verbose = False self.importIntoRemotes = True self.maxChanges = "" + self.isWindows = (platform.system() == "Windows") def p4File(self, depotPath): return os.popen("p4 print -q \"%s\"" % depotPath, "rb").read() @@ -647,6 +648,9 @@ class P4Sync(Command): data = self.p4File(depotPath) + if self.isWindows and file["type"].endswith("text"): + data = data.replace("\r\n", "\n") + self.gitStream.write("M %s inline %s\n" % (mode, relPath)) self.gitStream.write("data %s\n" % len(data)) self.gitStream.write(data)