summaryrefslogtreecommitdiff
path: root/contrib/fast-import/git-p4
diff options
context:
space:
mode:
authorMarius Storm-Olsen <marius@trolltech.com>2007-06-07 12:07:01 (GMT)
committerSimon Hausmann <shausman@trolltech.com>2007-06-07 12:11:15 (GMT)
commitf7baba8b092bdbc31196de1095c7779b633e28b1 (patch)
treef1239de2bd94c78c61b8145e602cf86807aa8cab /contrib/fast-import/git-p4
parenta52d5c7bc027248fca472a402882586a9eaf59bf (diff)
downloadgit-f7baba8b092bdbc31196de1095c7779b633e28b1.zip
git-f7baba8b092bdbc31196de1095c7779b633e28b1.tar.gz
git-f7baba8b092bdbc31196de1095c7779b633e28b1.tar.bz2
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>
Diffstat (limited to 'contrib/fast-import/git-p4')
-rwxr-xr-xcontrib/fast-import/git-p45
1 files changed, 5 insertions, 0 deletions
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index 8b00e35..fc4e7d2 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["<enter description here>"] = "%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: