add -p: trap Ctrl-D in 'goto' mode

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>
This commit is contained in:
Thomas Rast 2009-02-02 22:46:29 +01:00 committed by Junio C Hamano
parent 4404b2e392
commit 68c02d7c46

View file

@ -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*$/) {