@matheusbsbs / matheus-bagliano / commits / 68c02d7c46
Fork 0

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>

Thomas Rast committed Feb 2, 2009 at 22:46 UTC 68c02d7c462e1748578209346f050a587c040139
1 file changed +3
git-add--interactive.perl
+3
@@ -994,6 +994,9 @@ sub patch_update_file {
994 }
995 print "go to which hunk$extra? ";
996 $response = <STDIN>;
997 + if (!defined $response) {
998 + $response = '';
999 + }
1000 chomp $response;
1001 }
1002 if ($response !~ /^\s*\d+\s*$/) {