提交 6b445773 编写于 作者: J Junio C Hamano

mergetool: check return value from read

The process may not even have the standard input open in which case it
will get stuck in an infinite loop to prompt and read nothing.
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 76c82f90
...@@ -100,7 +100,7 @@ resolve_deleted_merge () { ...@@ -100,7 +100,7 @@ resolve_deleted_merge () {
else else
printf "Use (c)reated or (d)eleted file, or (a)bort? " printf "Use (c)reated or (d)eleted file, or (a)bort? "
fi fi
read ans read ans || return 1
case "$ans" in case "$ans" in
[mMcC]*) [mMcC]*)
git add -- "$MERGED" git add -- "$MERGED"
...@@ -122,7 +122,7 @@ resolve_deleted_merge () { ...@@ -122,7 +122,7 @@ resolve_deleted_merge () {
resolve_submodule_merge () { resolve_submodule_merge () {
while true; do while true; do
printf "Use (l)ocal or (r)emote, or (a)bort? " printf "Use (l)ocal or (r)emote, or (a)bort? "
read ans read ans || return 1
case "$ans" in case "$ans" in
[lL]*) [lL]*)
if ! local_present; then if ! local_present; then
...@@ -249,7 +249,7 @@ merge_file () { ...@@ -249,7 +249,7 @@ merge_file () {
describe_file "$remote_mode" "remote" "$REMOTE" describe_file "$remote_mode" "remote" "$REMOTE"
if "$prompt" = true; then if "$prompt" = true; then
printf "Hit return to start merge resolution tool (%s): " "$merge_tool" printf "Hit return to start merge resolution tool (%s): " "$merge_tool"
read ans read ans || return 1
fi fi
if base_present; then if base_present; then
...@@ -320,7 +320,7 @@ done ...@@ -320,7 +320,7 @@ done
prompt_after_failed_merge() { prompt_after_failed_merge() {
while true; do while true; do
printf "Continue merging other unresolved paths (y/n) ? " printf "Continue merging other unresolved paths (y/n) ? "
read ans read ans || return 1
case "$ans" in case "$ans" in
[yY]*) [yY]*)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册