提交 6a1871e1 编写于 作者: J Jeff King 提交者: Junio C Hamano

cvsimport: use git-update-index --index-info

This should reduce the number of git-update-index forks required per
commit. We now do adds/removes in one call, and we are no longer forced to
deal with argv limitations.
Signed-off-by: NJeff King <peff@peff.net>
Signed-off-by: NJunio C Hamano <junkio@cox.net>
上级 443f8338
...@@ -565,29 +565,19 @@ ($$) ...@@ -565,29 +565,19 @@ ($$)
my(@old,@new,@skipped); my(@old,@new,@skipped);
sub commit { sub commit {
my $pid; my $pid;
while(@old) {
my @o2; open(my $fh, '|-', qw(git-update-index -z --index-info))
if(@old > 55) { or die "unable to open git-update-index: $!";
@o2 = splice(@old,0,50); print $fh
} else { (map { "0 0000000000000000000000000000000000000000\t$_\0" }
@o2 = @old; @old),
@old = (); (map { '100' . sprintf('%o', $_->[0]) . " $_->[1]\t$_->[2]\0" }
} @new)
system("git-update-index","--force-remove","--",@o2); or die "unable to write to git-update-index: $!";
die "Cannot remove files: $?\n" if $?; close $fh
} or die "unable to write to git-update-index: $!";
while(@new) { $? and die "git-update-index reported error: $?";
my @n2; @old = @new = ();
if(@new > 12) {
@n2 = splice(@new,0,10);
} else {
@n2 = @new;
@new = ();
}
system("git-update-index","--add",
(map { ('--cacheinfo', @$_) } @n2));
die "Cannot add files: $?\n" if $?;
}
$pid = open(C,"-|"); $pid = open(C,"-|");
die "Cannot fork: $!" unless defined $pid; die "Cannot fork: $!" unless defined $pid;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册