Re: [PATCH 2/4] Teach git-add--interactive to accept a file path to patch
- From
Jeff King <peff@peff.net>
- Date
- Nov 21, 2007, 15:21 UTC
- Message-ID
- <20071121152118.GG24108@sigill.intra.peff.net>
- In-Reply-To
- <1195648601-21736-3-git-send-email-win@wincent.com>
On Wed, Nov 21, 2007 at 01:36:39PM +0100, Wincent Colaiuta wrote:
Show 5 quoted lines
> If supplied a single file path parameter the git-add--interactive script > now bypasses the command loop and jumps straight to the patch subcommand > using the passed path. After returning from the subcommand the main > command loop is entered. If a non-resolvable path is supplied the > operation is a no-op and the command loop is entered.
Great, the lack of this feature has bugged me in the past. Thank you for working on it. However...
Show 16 quoted lines
> diff --git a/git-add--interactive.perl b/git-add--interactive.perl
> index fb1e92a..8f21c03 100755
> --- a/git-add--interactive.perl
> +++ b/git-add--interactive.perl
> @@ -803,6 +803,11 @@ sub main_loop {
> }
> }
>
> +die "add --interactive may take only 1 optional parameter" if ($#ARGV > 0);
> refresh();
> +if ($#ARGV == 0) {
> + patch_update_file($ARGV[0]);
> +}
> status_cmd();
> main_loop();
> +Why only one file? How about something like this instead:
diff --git a/git-add--interactive.perl b/git-add--interactive.perl index fb1e92a..8036c95 100755 --- a/git-add--interactive.perl +++ b/git-add--interactive.perl @@ -804,5 +804,8 @@ sub main_loop { } refresh(); +foreach my $file (@ARGV) { + patch_update_file($file); +} status_cmd(); main_loop(); On top of that, it would be great to be able to do something like git-add -i *.c and just get prompted for changed files (right now, you only get prompted for changed files, but unchanged files seem to print a spurious newline). And at any rate, this would require fixing 3/4 to handle the multiple files from git-add. What do you think? -Peff