Skip to content

Commit

Permalink
git-svn: make --repack work consistently between fetch and multi-fetch
Browse files Browse the repository at this point in the history
Since fetch reforks itself at most every 1000 revisions, we
need to update the counter in the parent process to have a
working count if we set our repack interval to be > ~1000
revisions.  multi-fetch has always done this correctly
because of an extra process; now fetch uses the extra process;
as well.

While we're at it, only compile the $sha1 regex that checks for
repacking once.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Eric Wong authored and Junio C Hamano committed Jan 5, 2007
1 parent 0d313b2 commit 2a3240b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions git-svn.perl
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
);

my %cmd = (
fetch => [ \&fetch, "Download new revisions from SVN",
fetch => [ \&cmd_fetch, "Download new revisions from SVN",
{ 'revision|r=s' => \$_revision, %fc_opts } ],
init => [ \&init, "Initialize a repo for tracking" .
" (requires URL argument)",
Expand Down Expand Up @@ -293,6 +293,10 @@ sub init {
setup_git_svn();
}

sub cmd_fetch {
fetch_child_id($GIT_SVN, @_);
}

sub fetch {
check_upgrade_needed();
$SVN_URL ||= file_to_s("$GIT_SVN_DIR/info/url");
Expand Down Expand Up @@ -836,15 +840,14 @@ sub fetch_child_id {
my $ref = "$GIT_DIR/refs/remotes/$id";
defined(my $pid = open my $fh, '-|') or croak $!;
if (!$pid) {
$_repack = undef;
$GIT_SVN = $ENV{GIT_SVN_ID} = $id;
init_vars();
fetch(@_);
exit 0;
}
while (<$fh>) {
print $_;
check_repack() if (/^r\d+ = $sha1/);
check_repack() if (/^r\d+ = $sha1/o);
}
close $fh or croak $?;
}
Expand Down Expand Up @@ -1407,7 +1410,6 @@ sub git_commit {

# this output is read via pipe, do not change:
print "r$log_msg->{revision} = $commit\n";
check_repack();
return $commit;
}

Expand Down

0 comments on commit 2a3240b

Please sign in to comment.