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: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Alexander Litvinov 2005-11-23 16:19:41 +06:00 коммит произвёл Junio C Hamano
Родитель ab5f86275c
Коммит f359ae42ac
1 изменённых файлов: 22 добавлений и 9 удалений

Просмотреть файл

@ -193,14 +193,27 @@ if ($opt_n) {
exit(1); exit(1);
} }
my $rc; if (@changedfiles) {
if (scalar @changedfiles >0) { open(H, "| git-update-index -z --stdin")
$rc = system("git-update-index","--",@changedfiles); or die "git-update-index failed to update changed files with code $!\n";
die "git-update-index failed to update changed files with code $?\n" if $rc; foreach my $fileName (@changedfiles) {
print H "$fileName\0";
}
close(H);
} }
if (scalar @addedfiles >0) { if (@addedfiles) {
$rc = system("git-update-index","--add","--",@addedfiles); open(H, "| git-update-index --add -z --stdin")
die "git-update-index failed to add new names with code $?\n" if $rc; or die "git-update-index failed to add new names with code $!\n";
foreach my $fileName (@addedfiles) {
print H "$fileName\0";
}
close(H);
}
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;