Skip to content

Commit 68c02d7

Browse files
trastgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4404b2e commit 68c02d7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

git-add--interactive.perl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,9 @@ sub patch_update_file {
994994
}
995995
print "go to which hunk$extra? ";
996996
$response = <STDIN>;
997+
if (!defined $response) {
998+
$response = '';
999+
}
9971000
chomp $response;
9981001
}
9991002
if ($response !~ /^\s*\d+\s*$/) {

0 commit comments

Comments
 (0)