am: suppress apply errors when using 3-way
authorStephen Boyd <bebarino@gmail.com>
Tue, 16 Jun 2009 22:32:58 +0000 (15:32 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 18 Jun 2009 16:50:25 +0000 (09:50 -0700)
git-am with 3-way outputs errors when applying, even though the
3-way will usually be successful. We suppress these errors from
git-apply because they are not "true" errors until the 3-way has been
attempted.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-am.sh
index 578780be138b216dc89333e1fde87ddcb91e5e54..e26c54a3e24265d26b6d7acb07d0bf89135bb4bc 100755 (executable)
--- a/git-am.sh
+++ b/git-am.sh
@@ -502,7 +502,14 @@ do
 
        case "$resolved" in
        '')
-               eval 'git apply '"$git_apply_opt"' --index "$dotest/patch"'
+               # When we are allowed to fall back to 3-way later, don't give
+               # false errors during the initial attempt.
+               squelch=
+               if test "$threeway" = t
+               then
+                       squelch='>/dev/null 2>&1 '
+               fi
+               eval "git apply $squelch$git_apply_opt"' --index "$dotest/patch"'
                apply_status=$?
                ;;
        t)