{"thread":{"id":"9338","subject":"[PATCH] Hack git-add--interactive to make it work with ActiveState Perl","startedAt":"2007-08-01T13:09:14Z","lastAt":"2007-08-01T13:09:14Z","messageCount":1,"participants":["Alex Riesen"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"49304","messageId":"81b0412b0708010609h3346704bg4f708100bb5d6b93@mail.gmail.com","threadId":"9338","inReplyTo":null,"subject":"[PATCH] Hack git-add--interactive to make it work with ActiveState Perl","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-08-01T13:09:14Z","receivedAt":"2007-08-01T13:09:14Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"It wont work for arguments with special characters (like \", : or *).\nIt is generally not possible on Windows, so I didn't even try.\n---\n git-add--interactive.perl |   19 +++++++++++++------\n 1 files changed, 13 insertions(+), 6 deletions(-)\n\n\nFrom 0206b165dab71b0dc6396f88cfb8f70f67277ddf Mon Sep 17 00:00:00 2001\nFrom: Alex Riesen <raa.lkml@gmail.com>\nDate: Wed, 1 Aug 2007 14:57:43 +0200\nSubject: [PATCH] Hack git-add--interactive to make it work with ActiveState Perl\n\nIt wont work for arguments with special characters (like \", : or *).\nIt is generally not possible on Windows, so I didn't even try.\n---\n git-add--interactive.perl |   19 +++++++++++++------\n 1 files changed, 13 insertions(+), 6 deletions(-)\n\ndiff --git a/git-add--interactive.perl b/git-add--interactive.perl\nindex dc30380..7921cde 100755\n--- a/git-add--interactive.perl\n+++ b/git-add--interactive.perl\n@@ -3,9 +3,16 @@\n use strict;\n \n sub run_cmd_pipe {\n-\tmy $fh = undef;\n-\topen($fh, '-|', @_) or die;\n-\treturn <$fh>;\n+\tif ($^O eq 'MSWin32') {\n+\t\tmy @invalid = grep {m/[\":*]/} @_;\n+\t\tdie \"$^O does not support: @invalid\\n\" if @invalid;\n+\t\tmy @args = map { m/ /o ? \"\\\"$_\\\"\": $_ } @_;\n+\t\treturn qx{@args};\n+\t} else {\n+\t\tmy $fh = undef;\n+\t\topen($fh, '-|', @_) or die;\n+\t\treturn <$fh>;\n+\t}\n }\n \n my ($GIT_DIR) = run_cmd_pipe(qw(git rev-parse --git-dir));\n@@ -17,7 +24,7 @@ chomp($GIT_DIR);\n \n sub refresh {\n \tmy $fh;\n-\topen $fh, '-|', qw(git update-index --refresh)\n+\topen $fh, 'git update-index --refresh |'\n \t    or die;\n \twhile (<$fh>) {\n \t\t;# ignore 'needs update'\n@@ -296,7 +303,7 @@ sub revert_cmd {\n \t\tmy @lines = run_cmd_pipe(qw(git ls-tree HEAD --),\n \t\t\t\t\t map { $_->{VALUE} } @update);\n \t\tmy $fh;\n-\t\topen $fh, '|-', qw(git update-index --index-info)\n+\t\topen $fh, '| git update-index --index-info'\n \t\t    or die;\n \t\tfor (@lines) {\n \t\t\tprint $fh $_;\n@@ -725,7 +732,7 @@ sub patch_update_cmd {\n \tif (@result) {\n \t\tmy $fh;\n \n-\t\topen $fh, '|-', qw(git apply --cached);\n+\t\topen $fh, '| git apply --cached';\n \t\tfor (@{$head->{TEXT}}, @result) {\n \t\t\tprint $fh $_;\n \t\t}\n-- \n1.5.3.rc3.145.g4d9cdb\n\n"}]}