summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ab5f862)
raw | patch | inline | side by side (parent: ab5f862)
author | Alexander Litvinov <lan@ac-sw.com> | |
Wed, 23 Nov 2005 10:19:41 +0000 (16:19 +0600) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sat, 26 Nov 2005 06:19:23 +0000 (22:19 -0800) |
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>
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>
git-mv.perl | patch | blob | history |
diff --git a/git-mv.perl b/git-mv.perl
index bf54c38413c02553bd314d24bfdadc4cdb23ccce..b2eace5b26ce9e01535ee9f430dcd8c9ac78d46f 100755 (executable)
--- a/git-mv.perl
+++ b/git-mv.perl
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;