From: Marius Storm-Olsen Date: Thu, 7 Jun 2007 12:07:01 +0000 (+0200) Subject: Ensure that the commit message is Windows formated (CRLF) before invoking the editor. X-Git-Tag: v1.5.3-rc0~65^2^2~20^2~6 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f7baba8b092bdbc31196de1095c7779b633e28b1;p=git.git 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 --- diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4 index 8b00e350e..fc4e7d26f 100755 --- a/contrib/fast-import/git-p4 +++ b/contrib/fast-import/git-p4 @@ -277,6 +277,7 @@ class P4Submit(Command): self.directSubmit = False self.trustMeLikeAFool = False self.verbose = False + self.isWindows = (platform.system() == "Windows") self.logSubstitutions = {} self.logSubstitutions[""] = "%log%" @@ -398,6 +399,8 @@ class P4Submit(Command): if not self.directSubmit: logMessage = extractLogMessageFromGitCommit(id) logMessage = logMessage.replace("\n", "\n\t") + if self.isWindows: + logMessage = logMessage.replace("\n", "\r\n") logMessage = logMessage.strip() template = read_pipe("p4 change -o") @@ -444,6 +447,8 @@ class P4Submit(Command): tmpFile.close() os.remove(fileName) submitTemplate = message[:message.index(separatorLine)] + if self.isWindows: + submitTemplate = submitTemplate.replace("\r\n", "\n") if response == "y" or response == "yes": if self.dryRun: