rebase: factor out command line option processing
[gitweb.git] / git-mergetool.sh
index bd7ab02f1161d2d97ea57b2a2ceacc307f6a74e8..2f8dc441c6d575323f2fad920ecdb7b20e1445e6 100755 (executable)
@@ -289,6 +289,10 @@ if test $# -eq 0 ; then
        echo "No files need merging"
        exit 0
     fi
+
+    # Save original stdin
+    exec 3<&0
+
     printf "Merging:\n"
     printf "$files\n"
 
@@ -296,10 +300,10 @@ if test $# -eq 0 ; then
     while IFS= read i
     do
        if test $last_status -ne 0; then
-           prompt_after_failed_merge < /dev/tty || exit 1
+           prompt_after_failed_merge <&3 || exit 1
        fi
        printf "\n"
-       merge_file "$i" < /dev/tty > /dev/tty
+       merge_file "$i" <&3
        last_status=$?
        if test $last_status -ne 0; then
            rollup_status=1