diff options
author | Thomas Rast <trast@student.ethz.ch> | 2009-02-02 22:46:29 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-02-04 00:52:52 -0800 |
commit | 68c02d7c462e1748578209346f050a587c040139 (patch) | |
tree | 8ba714071a8a75107ba07056ee7fd75b4e3c96d3 | |
parent | add -p: change prompt separator for 'g' (diff) | |
download | tgif-68c02d7c462e1748578209346f050a587c040139.tar.xz |
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>
-rwxr-xr-x | git-add--interactive.perl | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/git-add--interactive.perl b/git-add--interactive.perl index 551b4475b5..3bf0cda4ee 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 = <STDIN>; + if (!defined $response) { + $response = ''; + } chomp $response; } if ($response !~ /^\s*\d+\s*$/) { |