Re: git-cvsexportcommit fails for huge commits

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: git-cvsexportcommit fails for huge commits

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:58

Jeff King [off-list ref] writes:
quoted hunk
@@ -335,6 +335,22 @@ sub safe_pipe_capture {
     return wantarray ? @output : join('',@output);
 }
 
+sub xargs_safe_pipe_capture {
+	my $MAX_ARG_LENGTH = 1024;
+	my $cmd = shift;
+	my @output;
+	while(@_) {
+		my @args;
+		my $length = 0;
+		while(@_ && $length < $MAX_ARG_LENGTH) {
+			push @args, shift;
+			$length += length($args[$#args]);
+		}
+		push @output, safe_pipe_capture(@$cmd, @args);
+	}
+	return @output;
+}
+
Makes me wonder why you are not spawning xargs by doing it by hand.  If
the path at the beginning happens to be longer than 1024 then you will
run path-less "cvs status"?

Re: git-cvsexportcommit fails for huge commits

From: Jeff King <hidden>
Date: 2016-06-15 22:43:58

On Wed, Dec 12, 2007 at 01:21:14AM -0800, Junio C Hamano wrote:
quoted
+sub xargs_safe_pipe_capture {
+	my $MAX_ARG_LENGTH = 1024;
+	my $cmd = shift;
+	my @output;
+	while(@_) {
+		my @args;
+		my $length = 0;
+		while(@_ && $length < $MAX_ARG_LENGTH) {
+			push @args, shift;
+			$length += length($args[$#args]);
+		}
+		push @output, safe_pipe_capture(@$cmd, @args);
+	}
+	return @output;
+}
+
Makes me wonder why you are not spawning xargs by doing it by hand.  If
Because we are reading the output, and it is possible to get a pipe
deadlock. This could be avoided with a tempfile.
the path at the beginning happens to be longer than 1024 then you will
run path-less "cvs status"?
No, read the loop again. The length starts at 0, so we always go through
the loop body once.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help