Skip to content

Commit

Permalink
add -p: trap Ctrl-D in 'goto' mode
Browse files Browse the repository at this point in the history
If the user hit Ctrl-D (EOF) while the script was in 'go to hunk?'
mode, it threw an undefined variable error.  Explicitly test for EOF
and have it re-enter the goto prompt loop.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Thomas Rast authored and Junio C Hamano committed Feb 4, 2009
1 parent 4404b2e commit 68c02d7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions git-add--interactive.perl
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,9 @@ sub patch_update_file {
}
print "go to which hunk$extra? ";
$response = <STDIN>;
if (!defined $response) {
$response = '';
}
chomp $response;
}
if ($response !~ /^\s*\d+\s*$/) {
Expand Down

0 comments on commit 68c02d7

Please sign in to comment.