提交 f359ae42 编写于 作者: A Alexander Litvinov 提交者: Junio C Hamano

git-mv is not able to handle big directories

Use update-index --stdin to handle large number of files without
breaking exec() argument storage limit.

[jc: with minor cleanup from the version posted on the list]
Signed-off-by: NJunio C Hamano <junkio@cox.net>
上级 ab5f8627
......@@ -193,14 +193,27 @@ ()
exit(1);
}
my $rc;
if (scalar @changedfiles >0) {
$rc = system("git-update-index","--",@changedfiles);
die "git-update-index failed to update changed files with code $?\n" if $rc;
if (@changedfiles) {
open(H, "| git-update-index -z --stdin")
or die "git-update-index failed to update changed files with code $!\n";
foreach my $fileName (@changedfiles) {
print H "$fileName\0";
}
close(H);
}
if (@addedfiles) {
open(H, "| git-update-index --add -z --stdin")
or die "git-update-index failed to add new names with code $!\n";
foreach my $fileName (@addedfiles) {
print H "$fileName\0";
}
close(H);
}
if (scalar @addedfiles >0) {
$rc = system("git-update-index","--add","--",@addedfiles);
die "git-update-index failed to add new names with code $?\n" if $rc;
if (@deletedfiles) {
open(H, "| git-update-index --remove -z --stdin")
or die "git-update-index failed to remove old names with code $!\n";
foreach my $fileName (@deletedfiles) {
print H "$fileName\0";
}
close(H);
}
$rc = system("git-update-index","--remove","--",@deletedfiles);
die "git-update-index failed to remove old names with code $?\n" if $rc;
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册