summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8e7e6f3)
raw | patch | inline | side by side (parent: 8e7e6f3)
author | Avery Pennarun <apenwarr@gmail.com> | |
Thu, 12 Jun 2008 23:10:50 +0000 (19:10 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 14 Jun 2008 18:47:55 +0000 (11:47 -0700) |
In git, all commits end in exactly one newline character. In svn, commits
end in zero or more newlines. Thus, when importing commits from svn into
git, git-svn always appends two extra newlines to ensure that the
git-svn-id: line is separated from the main commit message by at least one
blank line.
Combined with the terminating newline that's always present in svn commits
produced by git, you usually end up with two blank lines instead of one
between the commit message and git-svn-id: line, which is undesirable.
Instead, let's remove all trailing whitespace from the git commit on the way
through to svn.
Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
end in zero or more newlines. Thus, when importing commits from svn into
git, git-svn always appends two extra newlines to ensure that the
git-svn-id: line is separated from the main commit message by at least one
blank line.
Combined with the terminating newline that's always present in svn commits
produced by git, you usually end up with two blank lines instead of one
between the commit message and git-svn-id: line, which is undesirable.
Instead, let's remove all trailing whitespace from the git commit on the way
through to svn.
Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-svn.perl | patch | blob | history |
diff --git a/git-svn.perl b/git-svn.perl
index 47b0c37d17101e17e34fab8ed04c3409fe106e87..a54979dc51f0fc392b357da9071b6ea19aac4798 100755 (executable)
--- a/git-svn.perl
+++ b/git-svn.perl
my $in_msg = 0;
my $author;
my $saw_from = 0;
+ my $msgbuf = "";
while (<$msg_fh>) {
if (!$in_msg) {
$in_msg = 1 if (/^\s*$/);
if (/^From:/ || /^Signed-off-by:/) {
$saw_from = 1;
}
- print $log_fh $_ or croak $!;
+ $msgbuf .= $_;
}
}
+ $msgbuf =~ s/\s+$//s;
if ($Git::SVN::_add_author_from && defined($author)
&& !$saw_from) {
- print $log_fh "\nFrom: $author\n"
- or croak $!;
+ $msgbuf .= "\n\nFrom: $author";
}
+ print $log_fh $msgbuf or croak $!;
command_close_pipe($msg_fh, $ctx);
}
close $log_fh or croak $!;