summaryrefslogtreecommitdiff
path: root/git-add--interactive.perl
diff options
context:
space:
mode:
authorAlex Riesen <raa.lkml@gmail.com>2007-08-01 14:57:43 +0200
committerJunio C Hamano <gitster@pobox.com>2007-08-01 17:58:12 -0700
commit21e9757e31d136fad0c04f3ce9da11b8b128b4f2 (patch)
treec56f628a45178f2f4dcfdd6eafacfe00d97b92c1 /git-add--interactive.perl
parent96ffe892e307ea512abbc633f822558c568cece1 (diff)
downloadgit-21e9757e31d136fad0c04f3ce9da11b8b128b4f2.tar.gz
Hack git-add--interactive to make it work with ActiveState Perl
It wont work for arguments with special characters (like ", : or *). It is generally not possible on Windows, so I didn't even try. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-add--interactive.perl')
-rwxr-xr-xgit-add--interactive.perl19
1 files changed, 13 insertions, 6 deletions
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index dc3038091d..7921cde8cb 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -3,9 +3,16 @@
use strict;
sub run_cmd_pipe {
- my $fh = undef;
- open($fh, '-|', @_) or die;
- return <$fh>;
+ if ($^O eq 'MSWin32') {
+ my @invalid = grep {m/[":*]/} @_;
+ die "$^O does not support: @invalid\n" if @invalid;
+ my @args = map { m/ /o ? "\"$_\"": $_ } @_;
+ return qx{@args};
+ } else {
+ my $fh = undef;
+ open($fh, '-|', @_) or die;
+ return <$fh>;
+ }
}
my ($GIT_DIR) = run_cmd_pipe(qw(git rev-parse --git-dir));
@@ -17,7 +24,7 @@ chomp($GIT_DIR);
sub refresh {
my $fh;
- open $fh, '-|', qw(git update-index --refresh)
+ open $fh, 'git update-index --refresh |'
or die;
while (<$fh>) {
;# ignore 'needs update'
@@ -296,7 +303,7 @@ sub revert_cmd {
my @lines = run_cmd_pipe(qw(git ls-tree HEAD --),
map { $_->{VALUE} } @update);
my $fh;
- open $fh, '|-', qw(git update-index --index-info)
+ open $fh, '| git update-index --index-info'
or die;
for (@lines) {
print $fh $_;
@@ -725,7 +732,7 @@ sub patch_update_cmd {
if (@result) {
my $fh;
- open $fh, '|-', qw(git apply --cached);
+ open $fh, '| git apply --cached';
for (@{$head->{TEXT}}, @result) {
print $fh $_;
}