aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-12-12 16:53:06 -0800
committerJunio C Hamano <gitster@pobox.com>2007-12-12 16:53:06 -0800
commit3e5f260144514f305a529bb2fe2efa7138a6b10a (patch)
treee6a2ab98b8ec904f9147ce7495fe27903efc8796 /t
parentd9cf4ec9f7ddcc589351e1ac7b0e3b88537a0b25 (diff)
parent66ab84b99cdff3d650c9458aa737916735aebfcc (diff)
downloadgit-3e5f260144514f305a529bb2fe2efa7138a6b10a.tar.gz
git-3e5f260144514f305a529bb2fe2efa7138a6b10a.tar.xz
Merge branch 'ew/svn-rev-db'
* ew/svn-rev-db: git-svn: reinstate old rev_db optimization in new rev_map git-svn: replace .rev_db with a more space-efficient .rev_map format
Diffstat (limited to 't')
-rw-r--r--t/lib-git-svn.sh26
-rwxr-xr-xt/t9107-git-svn-migrate.sh16
2 files changed, 36 insertions, 6 deletions
diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
index 8d4a44721..9ee35e790 100644
--- a/t/lib-git-svn.sh
+++ b/t/lib-git-svn.sh
@@ -82,3 +82,29 @@ stop_httpd () {
test -z "$SVN_HTTPD_PORT" && return
"$SVN_HTTPD_PATH" -f "$GIT_DIR"/httpd.conf -k stop
}
+
+convert_to_rev_db () {
+ perl -w -- - "$@" <<\EOF
+use strict;
+@ARGV == 2 or die "Usage: convert_to_rev_db <input> <output>";
+open my $wr, '+>', $ARGV[1] or die "$!: couldn't open: $ARGV[1]";
+open my $rd, '<', $ARGV[0] or die "$!: couldn't open: $ARGV[0]";
+my $size = (stat($rd))[7];
+($size % 24) == 0 or die "Inconsistent size: $size";
+while (sysread($rd, my $buf, 24) == 24) {
+ my ($r, $c) = unpack('NH40', $buf);
+ my $offset = $r * 41;
+ seek $wr, 0, 2 or die $!;
+ my $pos = tell $wr;
+ if ($pos < $offset) {
+ for (1 .. (($offset - $pos) / 41)) {
+ print $wr (('0' x 40),"\n") or die $!;
+ }
+ }
+ seek $wr, $offset, 0 or die $!;
+ print $wr $c,"\n" or die $!;
+}
+close $wr or die $!;
+close $rd or die $!;
+EOF
+}
diff --git a/t/t9107-git-svn-migrate.sh b/t/t9107-git-svn-migrate.sh
index 67fdf7023..0a41d52c7 100755
--- a/t/t9107-git-svn-migrate.sh
+++ b/t/t9107-git-svn-migrate.sh
@@ -97,15 +97,19 @@ test_expect_success 'migrate --minimize on old inited layout' "
grep '^:refs/remotes/git-svn' fetch.out
"
-test_expect_success ".rev_db auto-converted to .rev_db.UUID" "
+test_expect_success ".rev_db auto-converted to .rev_map.UUID" "
git-svn fetch -i trunk &&
- expect=$GIT_DIR/svn/trunk/.rev_db.* &&
+ test -z \"\$(ls $GIT_DIR/svn/trunk/.rev_db.* 2>/dev/null)\" &&
+ expect=\"\$(ls $GIT_DIR/svn/trunk/.rev_map.*)\" &&
test -n \"\$expect\" &&
- mv \$expect $GIT_DIR/svn/trunk/.rev_db &&
+ rev_db=\$(echo \$expect | sed -e 's,_map,_db,') &&
+ convert_to_rev_db \$expect \$rev_db &&
+ rm -f \$expect &&
+ test -f \$rev_db &&
git-svn fetch -i trunk &&
- test -L $GIT_DIR/svn/trunk/.rev_db &&
- test -f \$expect &&
- cmp \$expect $GIT_DIR/svn/trunk/.rev_db
+ test -z \"\$(ls $GIT_DIR/svn/trunk/.rev_db.* 2>/dev/null)\" &&
+ test ! -e $GIT_DIR/svn/trunk/.rev_db &&
+ test -f \$expect
"
test_done