@matheusbsbs / matheus-bagliano / commits / f7baba8b09
Fork 0

Ensure that the commit message is Windows formated (CRLF) before invoking the editor.

(The default editor on Windows (Notepad) doesn't handle Unix line endings) Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>

Marius Storm-Olsen committed Jun 7, 2007 at 14:07 UTC f7baba8b092bdbc31196de1095c7779b633e28b1
1 file changed +5
contrib/fast-import/git-p4
+5
@@ -277,6 +277,7 @@ class P4Submit(Command):
277 self.directSubmit = False
278 self.trustMeLikeAFool = False
279 self.verbose = False
280 + self.isWindows = (platform.system() == "Windows")
281
282 self.logSubstitutions = {}
283 self.logSubstitutions["<enter description here>"] = "%log%"
@@ -398,6 +399,8 @@ class P4Submit(Command):
399 if not self.directSubmit:
400 logMessage = extractLogMessageFromGitCommit(id)
401 logMessage = logMessage.replace("\n", "\n\t")
402 + if self.isWindows:
403 + logMessage = logMessage.replace("\n", "\r\n")
404 logMessage = logMessage.strip()
405
406 template = read_pipe("p4 change -o")
@@ -444,6 +447,8 @@ class P4Submit(Command):
447 tmpFile.close()
448 os.remove(fileName)
449 submitTemplate = message[:message.index(separatorLine)]
450 + if self.isWindows:
451 + submitTemplate = submitTemplate.replace("\r\n", "\n")
452
453 if response == "y" or response == "yes":
454 if self.dryRun: