# Equivalent of difftool.prompt per tool?

3 messages from 2024-07-19 to 2024-07-19. Participants: Ryan Zoeller, Junio C Hamano, rsbecker@nexbridge.com.
Thread: https://gitlist.dev/t/61809

## Ryan Zoeller, 2024-07-19 03:31

Subject: Equivalent of difftool.prompt per tool?
Message-ID: <wglGbP7resY1dIKhfKqMcs6Xxu7f8iWSZ76k-MFC91eKTEWN2Aw4D6TqNAEndu5b1VZMVnOIS8m9HNoZPFxd6NZjKKmW0OmM8h5bAEuwoVY=@rtzoeller.com>
URL: https://gitlist.dev/e/wglGbP7resY1dIKhfKqMcs6Xxu7f8iWSZ76k-MFC91eKTEWN2Aw4D6TqNAEndu5b1VZMVnOIS8m9HNoZPFxd6NZjKKmW0OmM8h5bAEuwoVY%3D%40rtzoeller.com

```
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?


Thanks,
Ryan Zoeller

```

## Junio C Hamano, 2024-07-19 14:38

Subject: Re: Equivalent of difftool.prompt per tool?
Message-ID: <xmqqa5idmops.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqqa5idmops.fsf%40gitster.g
In-Reply-To: <wglGbP7resY1dIKhfKqMcs6Xxu7f8iWSZ76k-MFC91eKTEWN2Aw4D6TqNAEndu5b1VZMVnOIS8m9HNoZPFxd6NZjKKmW0OmM8h5bAEuwoVY=@rtzoeller.com>

```
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"


```

## rsbecker@nexbridge.com, 2024-07-19 14:50

Subject: RE: Equivalent of difftool.prompt per tool?
Message-ID: <016801dad9ea$f50d5fc0$df281f40$@nexbridge.com>
URL: https://gitlist.dev/e/016801dad9ea%24f50d5fc0%24df281f40%24%40nexbridge.com
In-Reply-To: <xmqqa5idmops.fsf@gitster.g>

```
On Friday, July 19, 2024 10:38 AM, Junio C Hamano wrote:
>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"

Is it possible that a textconv configuration might be able to assist here by
declaring a tool under user control for displaying content of files? This
might give finer grain control prior to launching the diff so that the user
can set up their desired shell environment with the above to select the
prompting software?
Just a thought.
--Randall


```
