Skip to content

Commit 63dd544

Browse files
committed
Merge branch 'ew/svn-crlf'
"git svn" has been updated to strip CRs in the commit messages, as recent versions of Subversion rejects them. * ew/svn-crlf: git-svn: convert CRLF to LF in commit message to SVN
2 parents f427b94 + 73d8c35 commit 63dd544

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

git-svn.perl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1865,6 +1865,7 @@ sub get_commit_entry {
18651865
}
18661866
}
18671867
$msgbuf =~ s/\s+$//s;
1868+
$msgbuf =~ s/\r\n/\n/sg; # SVN 1.6+ disallows CRLF
18681869
if ($Git::SVN::_add_author_from && defined($author)
18691870
&& !$saw_from) {
18701871
$msgbuf .= "\n\nFrom: $author";

t/t9169-git-svn-dcommit-crlf.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh
2+
3+
test_description='git svn dcommit CRLF'
4+
. ./lib-git-svn.sh
5+
6+
test_expect_success 'setup commit repository' '
7+
svn_cmd mkdir -m "$test_description" "$svnrepo/dir" &&
8+
git svn clone "$svnrepo" work &&
9+
(
10+
cd work &&
11+
echo foo >>foo &&
12+
git update-index --add foo &&
13+
printf "a\\r\\n\\r\\nb\\r\\nc\\r\\n" >cmt &&
14+
p=$(git rev-parse HEAD) &&
15+
t=$(git write-tree) &&
16+
cmt=$(git commit-tree -p $p $t <cmt) &&
17+
git update-ref refs/heads/master $cmt &&
18+
git cat-file commit HEAD | tail -n4 >out &&
19+
test_cmp cmt out &&
20+
git svn dcommit &&
21+
printf "a\\n\\nb\\nc\\n" >exp &&
22+
git cat-file commit HEAD | sed -ne 6,9p >out &&
23+
test_cmp exp out
24+
)
25+
'
26+
27+
test_done

0 commit comments

Comments
 (0)