login
Header Space

 
 

[PATCH 1/2] cvsimport: use git-update-index --index-info

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <git@...>
Cc: <martin@...>, <junkio@...>
Date: Tuesday, May 23, 2006 - 3:27 am

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.

---

This is a repost using -z/NUL instead of line feeds.

d82d215430ae5e79210f73a31f5f8a053f36c27f
 git-cvsimport.perl |   36 +++++++++++++-----------------------
 1 files changed, 13 insertions(+), 23 deletions(-)

d82d215430ae5e79210f73a31f5f8a053f36c27f
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index d257e66..a65bea6 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -565,29 +565,19 @@ my($patchset,$date,$author_name,$author_
 my(@old,@new,@skipped);
 sub commit {
 	my $pid;
-	while(@old) {
-		my @o2;
-		if(@old > 55) {
-			@o2 = splice(@old,0,50);
-		} else {
-			@o2 = @old;
-			@old = ();
-		}
-		system("git-update-index","--force-remove","--",@o2);
-		die "Cannot remove files: $?\n" if $?;
-	}
-	while(@new) {
-		my @n2;
-		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 $?;
-	}
+
+	open(my $fh, '|-', qw(git-update-index -z --index-info))
+		or die "unable to open git-update-index: $!";
+	print $fh 
+		(map { "0 0000000000000000000000000000000000000000\t$_\0" }
+			@old),
+		(map { '100' . sprintf('%o', $_->[0]) . " $_->[1]\t$_->[2]\0" }
+			@new)
+		or die "unable to write to git-update-index: $!";
+	close $fh
+		or die "unable to write to git-update-index: $!";
+	$? and die "git-update-index reported error: $?";
+	@old = @new = ();
 
 	$pid = open(C,"-|");
 	die "Cannot fork: $!" unless defined $pid;
-- 
1.3.3.g3408

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
irc usage.., Linus Torvalds, (Sat May 20, 1:26 pm)
Re: irc usage.., Junio C Hamano, (Sat May 20, 1:50 pm)
Re: irc usage.., Yann Dirson, (Sat May 20, 4:39 pm)
Re: irc usage.., Linus Torvalds, (Sun May 21, 9:45 pm)
Re: irc usage.., Donnie Berkholz, (Sat May 20, 6:18 pm)
Re: irc usage.., Linus Torvalds, (Sat May 20, 6:45 pm)
Re: irc usage.., Donnie Berkholz, (Sat May 20, 7:12 pm)
Re: irc usage.., Linus Torvalds, (Sun May 21, 3:24 pm)
Re: irc usage.., Linus Torvalds, (Sun May 21, 11:59 pm)
Re: irc usage.., Donnie Berkholz, (Mon May 22, 12:19 am)
Re: irc usage.., Linus Torvalds, (Mon May 22, 12:50 am)
Re: irc usage.., Martin Langhoff, (Mon May 22, 3:42 am)
Re: irc usage.., Linus Torvalds, (Mon May 22, 5:13 am)
Re: irc usage.., Martin Langhoff, (Mon May 22, 8:54 am)
Re: irc usage.., Linus Torvalds, (Mon May 22, 1:27 pm)
Re: irc usage.., Martin Langhoff, (Mon May 22, 3:46 pm)
Re: irc usage.., Donnie Berkholz, (Mon May 22, 3:09 pm)
Re: irc usage.., Linus Torvalds, (Mon May 22, 3:38 pm)
Re: irc usage.., Donnie Berkholz, (Mon May 22, 3:49 pm)
Re: irc usage.., Linus Torvalds, (Mon May 22, 4:20 pm)
Re: irc usage.., Donnie Berkholz, (Mon May 22, 5:48 pm)
Re: irc usage.., Donnie Berkholz, (Mon May 29, 5:54 pm)
Re: irc usage.., Martin Langhoff, (Mon May 29, 6:21 pm)
Re: irc usage.., Donnie Berkholz, (Mon May 29, 6:32 pm)
Re: irc usage.., Martin Langhoff, (Tue May 30, 6:31 pm)
Re: irc usage.., Linus Torvalds, (Tue May 30, 7:07 pm)
Re: irc usage.., Martin Langhoff, (Tue May 30, 9:04 pm)
Re: irc usage.., Donnie Berkholz, (Tue May 30, 10:49 pm)
Re: irc usage.., Martin Langhoff, (Wed May 31, 2:05 am)
Re: irc usage.., Alec Warner, (Wed May 31, 9:54 am)
Re: irc usage.., Martin Langhoff, (Wed May 31, 6:03 pm)
Re: irc usage.., Alec Warner, (Wed May 31, 9:42 pm)
Re: irc usage.., Martin Langhoff, (Thu Jun 1, 3:47 am)
Re: irc usage.., Alec Warner, (Sun Jun 4, 8:33 pm)
Re: irc usage.., Martin Langhoff, (Sun Jun 4, 10:06 pm)
Re: irc usage.., Alec Warner, (Sun Jun 4, 10:36 pm)
Re: irc usage.., Sean, (Mon Jun 5, 12:07 pm)
Re: irc usage.., Martin Langhoff, (Sun Jun 4, 11:49 pm)
Re: irc usage.., Linus Torvalds, (Mon May 29, 8:43 pm)
Re: irc usage.., Martin Langhoff, (Mon May 29, 8:19 pm)
Re: irc usage.., Donnie Berkholz, (Tue May 30, 1:31 am)
Re: irc usage.., Martin Langhoff, (Tue May 30, 2:01 am)
Re: irc usage.., Martin Langhoff, (Mon May 22, 3:41 pm)
Re: irc usage.., Linus Torvalds, (Mon May 22, 4:11 pm)
Re: irc usage.., Linus Torvalds, (Mon May 22, 4:33 pm)
Re: irc usage.., Matthias Urlichs, (Mon May 22, 5:41 pm)
Re: irc usage.., Linus Torvalds, (Mon May 22, 6:18 pm)
Re: irc usage.., Martin Langhoff, (Mon May 22, 7:23 pm)
Re: irc usage.., Linus Torvalds, (Mon May 22, 7:33 pm)
Re: irc usage.., Martin Langhoff, (Mon May 22, 7:29 pm)
Re: irc usage.., Junio C Hamano, (Mon May 22, 6:39 pm)
Re: irc usage.., Martin Langhoff, (Mon May 22, 7:15 pm)
Re: irc usage.., Jeff King, (Tue May 23, 2:52 am)
[PATCH 2/2] cvsimport: cleanup commit function, Jeff King, (Tue May 23, 3:00 am)
Re: [PATCH 2/2] cvsimport: cleanup commit function, Morten Welinder, (Tue May 23, 1:47 pm)
Re: [PATCH 2/2] cvsimport: cleanup commit function, Jeff King, (Tue May 23, 4:59 pm)
Re: [PATCH 2/2] cvsimport: cleanup commit function, Junio C Hamano, (Tue May 23, 7:41 pm)
Re: [PATCH 2/2] cvsimport: cleanup commit function, Jeff King, (Wed May 24, 5:52 am)
Re: [PATCH 2/2] cvsimport: cleanup commit function, Martin Langhoff, (Tue May 23, 4:13 am)
Re: [PATCH 2/2] cvsimport: cleanup commit function, Linus Torvalds, (Tue May 23, 12:50 pm)
Re: [PATCH 2/2] cvsimport: cleanup commit function, Linus Torvalds, (Tue May 23, 3:36 pm)
Re: [PATCH 2/2] cvsimport: cleanup commit function, Martin Langhoff, (Tue May 23, 4:29 pm)
Re: [PATCH 2/2] cvsimport: cleanup commit function, Jeff King, (Tue May 23, 5:10 pm)
Re: [PATCH 2/2] cvsimport: cleanup commit function, Martin Langhoff, (Tue May 23, 5:13 pm)
Re: [PATCH 2/2] cvsimport: cleanup commit function, Junio C Hamano, (Tue May 23, 4:25 pm)
Re: [PATCH 2/2] cvsimport: cleanup commit function, Junio C Hamano, (Tue May 23, 4:24 am)
Re: [PATCH 2/2] cvsimport: cleanup commit function, Martin Langhoff, (Tue May 23, 4:32 pm)
[PATCH 1/2] cvsimport: use git-update-index --index-info, Jeff King, (Tue May 23, 3:27 am)
[PATCH 2/2] cvsimport: cleanup commit function, Jeff King, (Tue May 23, 3:27 am)
Re: irc usage.., Jeff King, (Tue May 23, 2:58 am)
Re: irc usage.., Donnie Berkholz, (Mon May 22, 4:16 pm)
Re: irc usage.., Martin Langhoff, (Mon May 22, 1:04 am)
Re: irc usage.., Donnie Berkholz, (Mon May 22, 1:21 am)
Re: irc usage.., Thomas Glanzmann, (Sun May 21, 5:46 am)
Re: irc usage.., Donnie Berkholz, (Sat May 20, 9:14 pm)
speck-geostationary