Skip to content

Commit

Permalink
fix for long command line on git-add-interactive
Browse files Browse the repository at this point in the history
See msysgit#182 for more details
This implementation is not checked. It was created from @PhilipDavis
proposal https://gist.github.com/PhilipDavis/a7e8843dad39493a698c
  • Loading branch information
albfan committed Jul 9, 2014
1 parent b128d9c commit 31b228c
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion git-add--interactive.perl
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,32 @@ sub run_cmd_pipe {
my @args = map { m/ /o ? "\"$_\"": $_ } @_;
return qx{@args};
} else {

# 2014-08-07 - Phil - Write filename args to a temporary file
my @myArgs = @_;
my $cmd = "@myArgs";
my $path = "$ENV{APPDATA}";
$path =~ s/\\/\//g;
use File::Temp qw(tempfile);
my ($fhargs, $filename) = tempfile("$path/git-args-XXXXXX", UNLINK => 1);
if (grep $_ eq "--", @myArgs) {
$cmd = "";
while ($myArgs[0] ne '--') {
$cmd = $cmd . shift(@myArgs) . " ";
}
$cmd = $cmd . "-- ";
shift(@myArgs);

foreach (@myArgs) {
print $fhargs "$_ ";
}
$fhargs->flush;
$cmd = $cmd . "< $filename";
}

my $fh = undef;
open($fh, '-|', @_) or die;
open($fh, '-|', $cmd) or die;
close $fhargs;
return <$fh>;
}
}
Expand Down

2 comments on commit 31b228c

@PhilipDavis
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't create a pull request because I found bugs in my code. You probably shouldn't blindly grab someone's code and create a pull request from it.

@albfan
Copy link
Owner Author

@albfan albfan commented on 31b228c Jul 9, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trust in git and collaboration. Don't wait till your code is pollute and shiny. This is better than thousand words. We two can improve it until msysgit collaborator accepts it.

You do first step to solve the issue, but if it is only a gist, you cannot allow others to help when you are blocked.

Please sign in to comment.