aboutsummaryrefslogtreecommitdiff
path: root/git-mv.perl
diff options
context:
space:
mode:
authorAlexander Litvinov <lan@ac-sw.com>2005-11-23 16:19:41 +0600
committerJunio C Hamano <junkio@cox.net>2005-11-25 22:19:23 -0800
commitf359ae42ac102ef98d5708f1dc8b06e6af2701c1 (patch)
tree196314fa7461a36f09ad1bab9b76dd190ad1925d /git-mv.perl
parentab5f86275c070331c308a133afa3a648b347c062 (diff)
downloadgit-f359ae42ac102ef98d5708f1dc8b06e6af2701c1.tar.gz
git-f359ae42ac102ef98d5708f1dc8b06e6af2701c1.tar.xz
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>
Diffstat (limited to 'git-mv.perl')
-rwxr-xr-xgit-mv.perl31
1 files changed, 22 insertions, 9 deletions
diff --git a/git-mv.perl b/git-mv.perl
index bf54c3841..b2eace5b2 100755
--- a/git-mv.perl
+++ b/git-mv.perl
@@ -193,14 +193,27 @@ if ($opt_n) {
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;