summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 64fdc08)
raw | patch | inline | side by side (parent: 64fdc08)
author | Charles Bailey <charles@hashpling.org> | |
Fri, 20 Aug 2010 15:25:09 +0000 (16:25 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 20 Aug 2010 21:09:04 +0000 (14:09 -0700) |
mergetool used /dev/tty to switch back to receiving input from the user
via inside a block with a redirected stdin.
This harms testability, so change mergetool to save its original stdin
to an alternative fd in this block and restore it for those sub-commands
that need the original stdin.
Includes additional compatibility fix from Jonathan Nieder.
Tested-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
via inside a block with a redirected stdin.
This harms testability, so change mergetool to save its original stdin
to an alternative fd in this block and restore it for those sub-commands
that need the original stdin.
Includes additional compatibility fix from Jonathan Nieder.
Tested-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-mergetool--lib.sh | patch | blob | history | |
git-mergetool.sh | patch | blob | history |
diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index 51dd0d67ba951873df4f26b1707a1e8a713082b9..b5e1943b1d166b543998c80579c65e82de36516a 100644 (file)
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
while true; do
echo "$MERGED seems unchanged."
printf "Was the merge successful? [y/n] "
- read answer < /dev/tty
+ read answer
case "$answer" in
y*|Y*) status=0; break ;;
n*|N*) status=1; break ;;
diff --git a/git-mergetool.sh b/git-mergetool.sh
index b52a7410bcb7b37dce0f4d6213dddedd2c1e42e7..e7fa67bd9c227b703dd4852c18b064463c8c92d6 100755 (executable)
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
echo "No files need merging"
exit 0
fi
+
+ # Save original stdin
+ exec 3<&0
+
echo Merging the files: "$files"
git ls-files -u |
sed -e 's/^[^ ]* //' |
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