@matheusbsbs / matheus-bagliano / commits / 12db334e75
Fork 0

git-add -i: allow multiple selection in patch subcommand

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>

Junio C Hamano committed Nov 22, 2007 at 01:47 UTC 12db334e75ae291aa69987cbe0feda2b6a64af38
1 file changed +7 -7
git-add--interactive.perl
+7 -7
@@ -260,7 +260,7 @@ sub list_and_choose {
260 $chosen[$i] = $choose;
261 }
262 }
263 - last if ($opts->{IMMEDIATE});
263 + last if ($opts->{IMMEDIATE} || $line eq '*');
264 }
265 for ($i = 0; $i < @stuff; $i++) {
266 if ($chosen[$i]) {
@@ -567,12 +567,12 @@ sub patch_update_cmd {
567 @mods = grep { !($_->{BINARY}) } @mods;
568 return if (!@mods);
569
570 - my ($it) = list_and_choose({ PROMPT => 'Patch update',
571 - SINGLETON => 1,
572 - IMMEDIATE => 1,
573 - HEADER => $status_head, },
574 - @mods);
575 - patch_update_file($it->{VALUE}) if ($it);
570 + my (@them) = list_and_choose({ PROMPT => 'Patch update',
571 + HEADER => $status_head, },
572 + @mods);
573 + for (@them) {
574 + patch_update_file($_->{VALUE});
575 + }
576 }
577
578 sub patch_update_file {