Skip to content

Commit

Permalink
git-add -i: allow multiple selection in patch subcommand
Browse files Browse the repository at this point in the history
This allows more than one files from the list to be chosen from
the patch subcommand instead of going through the file one by
one.

This also updates the "list-and-choose" UI for usability.  When
the prompt ends with ">>", if you type '*' to choose all
choices, the prompt immediately returns the choice without
requiring an extra empty line to confirm the selection.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Nov 23, 2007
1 parent 4c84168 commit 12db334
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions git-add--interactive.perl
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ sub list_and_choose {
$chosen[$i] = $choose;
}
}
last if ($opts->{IMMEDIATE});
last if ($opts->{IMMEDIATE} || $line eq '*');
}
for ($i = 0; $i < @stuff; $i++) {
if ($chosen[$i]) {
Expand Down Expand Up @@ -567,12 +567,12 @@ sub patch_update_cmd {
@mods = grep { !($_->{BINARY}) } @mods;
return if (!@mods);

my ($it) = list_and_choose({ PROMPT => 'Patch update',
SINGLETON => 1,
IMMEDIATE => 1,
HEADER => $status_head, },
@mods);
patch_update_file($it->{VALUE}) if ($it);
my (@them) = list_and_choose({ PROMPT => 'Patch update',
HEADER => $status_head, },
@mods);
for (@them) {
patch_update_file($_->{VALUE});
}
}

sub patch_update_file {
Expand Down

0 comments on commit 12db334

Please sign in to comment.