Skip to content

Commit 1998f4c

Browse files
committed
Merge branch 'cb/maint-mergetool-no-tty'
* cb/maint-mergetool-no-tty: mergetool: Remove explicit references to /dev/tty Conflicts: git-mergetool.sh
2 parents 9502751 + af31471 commit 1998f4c

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

git-mergetool--lib.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ check_unchanged () {
3535
while true; do
3636
echo "$MERGED seems unchanged."
3737
printf "Was the merge successful? [y/n] "
38-
read answer < /dev/tty
38+
read answer
3939
case "$answer" in
4040
y*|Y*) status=0; break ;;
4141
n*|N*) status=1; break ;;

git-mergetool.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,17 +289,21 @@ if test $# -eq 0 ; then
289289
echo "No files need merging"
290290
exit 0
291291
fi
292+
293+
# Save original stdin
294+
exec 3<&0
295+
292296
printf "Merging:\n"
293297
printf "$files\n"
294298

295299
files_to_merge |
296300
while IFS= read i
297301
do
298302
if test $last_status -ne 0; then
299-
prompt_after_failed_merge < /dev/tty || exit 1
303+
prompt_after_failed_merge <&3 || exit 1
300304
fi
301305
printf "\n"
302-
merge_file "$i" < /dev/tty > /dev/tty
306+
merge_file "$i" <&3
303307
last_status=$?
304308
if test $last_status -ne 0; then
305309
rollup_status=1

0 commit comments

Comments
 (0)