From: Thomas Rast Date: Mon, 2 Feb 2009 21:46:29 +0000 (+0100) Subject: add -p: trap Ctrl-D in 'goto' mode X-Git-Tag: v1.6.2-rc0~1^2~3 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=68c02d7c462e1748578209346f050a587c040139;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/git-add--interactive.perl b/git-add--interactive.perl index 551b4475b..3bf0cda4e 100755 --- a/git-add--interactive.perl +++ b/git-add--interactive.perl @@ -994,6 +994,9 @@ sub patch_update_file { } print "go to which hunk$extra? "; $response = ; + if (!defined $response) { + $response = ''; + } chomp $response; } if ($response !~ /^\s*\d+\s*$/) {