git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] difftool: honor --trust-exit-code for builtin tools
@ 2014-11-14 21:33 David Aguilar
  2014-11-14 21:51 ` Junio C Hamano
  2014-11-16  8:18 ` [PATCH] " Andreas Schwab
  0 siblings, 2 replies; 10+ messages in thread
From: David Aguilar @ 2014-11-14 21:33 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Adri Farr

run_merge_tool() was not setting $status, which prevented the
exit code for builtin tools from being forwarded to the caller.

Capture the exit status and add a test to guarantee the behavior.

Reported-by: Adria Farres <14farresa@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
 git-mergetool--lib.sh | 1 +
 t/t7800-difftool.sh   | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index a40d3df..2b66351 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -221,6 +221,7 @@ run_merge_tool () {
 	else
 		run_diff_cmd "$1"
 	fi
+	status=$?
 	return $status
 }
 
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index 69bde7a..ea35a02 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -86,6 +86,11 @@ test_expect_success PERL 'difftool forwards exit code with --trust-exit-code' '
 	test_must_fail git difftool -y --trust-exit-code -t error branch
 '
 
+test_expect_success PERL 'difftool forwards exit code with --trust-exit-code for built-ins' '
+	test_config difftool.vimdiff.path false &&
+	test_must_fail git difftool -y --trust-exit-code -t vimdiff branch
+'
+
 test_expect_success PERL 'difftool honors difftool.trustExitCode = true' '
 	test_config difftool.error.cmd false &&
 	test_config difftool.trustExitCode true &&
-- 
2.2.0.rc1.23.gf570943.dirty

^ permalink raw reply related	[flat|nested] 10+ messages in thread
* Re: [PATCH] difftool: honor --trust-exit-code for builtin tools
@ 2014-11-15  0:27 David Aguilar
  2014-11-15 14:22 ` Adri Farr
  0 siblings, 1 reply; 10+ messages in thread
From: David Aguilar @ 2014-11-15  0:27 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Adri Farr


Adri sent me this directly but I think it should have gone to the list.

Adri, if you don't mind, Junio can add:

Tested-by: Adri Farr <14farresa@gmail.com>

...to the commit message trailer since it looks like it's happy.

Thanks for testing!

cheers,
David

----- Forwarded message from Adri Farr <14farresa@gmail.com> -----

Date: Sat, 15 Nov 2014 00:10:12 +0100
From: Adri Farr <14farresa@gmail.com>
To: David Aguilar <davvid@gmail.com>
Subject: Re: [PATCH] difftool: honor --trust-exit-code for builtin tools

I have tested this patch both in vim and meld and it works
wonderfully. Thank you for the time put into this. I should have
provided feedback back when the patch was proposed. I guess it's never
too late :).

2014-11-14 22:57 GMT+01:00 David Aguilar <davvid@gmail.com>:
> [snip]

----- End forwarded message -----

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-11-17 22:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-14 21:33 [PATCH] difftool: honor --trust-exit-code for builtin tools David Aguilar
2014-11-14 21:51 ` Junio C Hamano
2014-11-14 21:57   ` David Aguilar
2014-11-16  1:51   ` Mikael Magnusson
2014-11-16  2:36     ` David Aguilar
2014-11-16 18:11     ` Junio C Hamano
2014-11-17 22:15       ` Aaron Schrab
2014-11-16  8:18 ` [PATCH] " Andreas Schwab
  -- strict thread matches above, loose matches on Subject: below --
2014-11-15  0:27 David Aguilar
2014-11-15 14:22 ` Adri Farr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).