public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Ryan Zoeller <rtzoeller@rtzoeller•com>
Cc: "git@vger•kernel.org" <git@vger•kernel.org>
Subject: Re: Equivalent of difftool.prompt per tool?
Date: Fri, 19 Jul 2024 07:38:23 -0700	[thread overview]
Message-ID: <xmqqa5idmops.fsf@gitster.g> (raw)
In-Reply-To: <wglGbP7resY1dIKhfKqMcs6Xxu7f8iWSZ76k-MFC91eKTEWN2Aw4D6TqNAEndu5b1VZMVnOIS8m9HNoZPFxd6NZjKKmW0OmM8h5bAEuwoVY=@rtzoeller.com> (Ryan Zoeller's message of "Fri, 19 Jul 2024 03:31:11 +0000")

Ryan Zoeller <rtzoeller@rtzoeller•com> writes:

> Is there a way to specify difftool.prompt on a per-tool basis,
> without manually passing --prompt or --no-prompt to override the
> global difftool.prompt setting?
>
> I generally want `difftool.prompt = false` set, but one specific
> tool I use has a high startup time and I'd like confirmation
> before launching it.
>
> If this isn't possible today, is difftool.<tool>.prompt something
> others would find useful?

I do not use difftool (nor mergetool) myself, but given how
difftool.<tool>.cmd and difftool.<tool>.path behave, it does not
sound like an unreasonable feature wish.

I'd imagine the feature itself should be trivial to add, but we'd
probably want to add test to t/t7800-difftool.sh, where there are
already existing tests for inteactions between difftool.prompt and
various command line options.

Thanks.

 git-difftool--helper.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git c/git-difftool--helper.sh w/git-difftool--helper.sh
index dd0c9a5b7f..872d787b09 100755
--- c/git-difftool--helper.sh
+++ w/git-difftool--helper.sh
@@ -12,7 +12,9 @@ TOOL_MODE=diff
 # and is overridden with $GIT_DIFFTOOL*_PROMPT.
 should_prompt () {
 	prompt_merge=$(git config --bool mergetool.prompt || echo true)
-	prompt=$(git config --bool difftool.prompt || echo $prompt_merge)
+	prompt=$(git config --bool "difftool.$merge_tool.prompt" ||
+		 git config --bool difftool.prompt ||
+		 echo $prompt_merge)
 	if test "$prompt" = true
 	then
 		test -z "$GIT_DIFFTOOL_NO_PROMPT"


  reply	other threads:[~2024-07-19 14:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-19  3:31 Equivalent of difftool.prompt per tool? Ryan Zoeller
2024-07-19 14:38 ` Junio C Hamano [this message]
2024-07-19 14:50   ` rsbecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqa5idmops.fsf@gitster.g \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=rtzoeller@rtzoeller$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox