mirror of
https://github.com/git/git.git
synced 2024-11-24 02:17:02 +08:00
difftool--helper: exit when reading a prompt answer fails
An attempt to quit difftool by hitting Ctrl-D (EOF) at its prompt does not quit it, but is treated as if 'yes' was answered to the prompt and all following prompts, which is contrary to the user's intent. Fix the error check. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
3c2dc76f01
commit
25098690a0
@ -49,7 +49,8 @@ launch_merge_tool () {
|
||||
else
|
||||
printf "Launch '%s' [Y/n]: " "$merge_tool"
|
||||
fi
|
||||
if read ans && test "$ans" = n
|
||||
read ans || return
|
||||
if test "$ans" = n
|
||||
then
|
||||
return
|
||||
fi
|
||||
|
@ -301,6 +301,14 @@ test_expect_success PERL 'say no to the second file' '
|
||||
! grep br2 output
|
||||
'
|
||||
|
||||
test_expect_success PERL 'ending prompt input with EOF' '
|
||||
git difftool -x cat branch </dev/null >output &&
|
||||
! grep master output &&
|
||||
! grep branch output &&
|
||||
! grep m2 output &&
|
||||
! grep br2 output
|
||||
'
|
||||
|
||||
test_expect_success PERL 'difftool --tool-help' '
|
||||
git difftool --tool-help >output &&
|
||||
grep tool output
|
||||
|
Loading…
Reference in New Issue
Block a user