Skip to content

Commit

Permalink
Replace \r\n with \n when importing from p4 on Windows
Browse files Browse the repository at this point in the history
Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
  • Loading branch information
Marius Storm-Olsen authored and Simon Hausmann committed May 24, 2007
1 parent ebd8116 commit c1f9197
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions contrib/fast-import/git-p4
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit c1f9197

Please sign in to comment.