Skip to content

Commit

Permalink
add -p: 'q' should really quit
Browse files Browse the repository at this point in the history
The "quit" command was added in 9a7a1e0 (git add -p: new "quit" command at
the prompt, 2009-04-10) to allow the user to say that hunks other than
what have already been chosen are undesirable, and exit the interactive
loop immediately.  It forgot that there may be an undecided hunk before
the current one.  In such a case, the interactive loop still goes back to
the beginning.

Clear all the USE bit for undecided hunks and exit the loop.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Apr 29, 2011
1 parent 9d15860 commit f5ea3f2
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions git-add--interactive.perl
Original file line number Diff line number Diff line change
Expand Up @@ -1366,14 +1366,13 @@ sub patch_update_file {
next;
}
elsif ($line =~ /^q/i) {
while ($ix < $num) {
if (!defined $hunk[$ix]{USE}) {
$hunk[$ix]{USE} = 0;
for ($i = 0; $i < $num; $i++) {
if (!defined $hunk[$i]{USE}) {
$hunk[$i]{USE} = 0;
}
$ix++;
}
$quit = 1;
next;
last;
}
elsif ($line =~ m|^/(.*)|) {
my $regex = $1;
Expand Down

0 comments on commit f5ea3f2

Please sign in to comment.