Skip to content

Commit 20b3d20

Browse files
jyknightJunio C Hamano
authored andcommitted
Fix git-svn to handle svn not reporting the md5sum of a file, and test.
Acked-by: Eric Wong <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a23bfae commit 20b3d20

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

git-svn.perl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2477,7 +2477,7 @@ sub close_file {
24772477
$md5->addfile($fh);
24782478
my $got = $md5->hexdigest;
24792479
die "Checksum mismatch: $path\n",
2480-
"expected: $exp\n got: $got\n" if ($got ne $exp);
2480+
"expected: $exp\n got: $got\n" if (defined $exp && $got ne $exp);
24812481
sysseek($fh, 0, 0) or croak $!;
24822482
if ($fb->{mode_b} == 120000) {
24832483
sysread($fh, my $buf, 5) == 5 or croak $!;

t/t9112-git-svn-md5less-file.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
test_description='test that git handles an svn repository with missing md5sums'
2+
3+
. ./lib-git-svn.sh
4+
5+
# Loading a node from a svn dumpfile without a Text-Content-Length
6+
# field causes svn to neglect to store or report an md5sum. (it will
7+
# calculate one if you had put Text-Content-Length: 0). This showed
8+
# up in a repository creted with cvs2svn.
9+
10+
cat > dumpfile.svn <<EOF
11+
SVN-fs-dump-format-version: 1
12+
13+
Revision-number: 1
14+
Prop-content-length: 98
15+
Content-length: 98
16+
17+
K 7
18+
svn:log
19+
V 0
20+
21+
K 10
22+
svn:author
23+
V 4
24+
test
25+
K 8
26+
svn:date
27+
V 27
28+
2007-05-06T12:37:01.153339Z
29+
PROPS-END
30+
31+
Node-path: md5less-file
32+
Node-kind: file
33+
Node-action: add
34+
Prop-content-length: 10
35+
Content-length: 10
36+
37+
PROPS-END
38+
39+
EOF
40+
41+
test_expect_success 'load svn dumpfile' "svnadmin load $rawsvnrepo < dumpfile.svn"
42+
43+
test_expect_success 'initialize git-svn' "git-svn init $svnrepo"
44+
test_expect_success 'fetch revisions from svn' 'git-svn fetch'
45+
test_done

0 commit comments

Comments
 (0)