{"thread":{"id":"61809","subject":"Equivalent of difftool.prompt per tool?","startedAt":"2024-07-19T03:31:24Z","lastAt":"2024-07-19T14:50:23Z","messageCount":3,"participants":["Ryan Zoeller","Junio C Hamano","rsbecker@nexbridge.com"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"498955","messageId":"wglGbP7resY1dIKhfKqMcs6Xxu7f8iWSZ76k-MFC91eKTEWN2Aw4D6TqNAEndu5b1VZMVnOIS8m9HNoZPFxd6NZjKKmW0OmM8h5bAEuwoVY=@rtzoeller.com","threadId":"61809","inReplyTo":null,"subject":"Equivalent of difftool.prompt per tool?","fromName":"Ryan Zoeller","fromEmail":"rtzoeller@rtzoeller.com","sentAt":"2024-07-19T03:31:11Z","receivedAt":"2024-07-19T03:31:24Z","isPatch":false,"sender":{"key":"rtzoeller@rtzoeller.com","avatar":"https://avatars.githubusercontent.com/u/573497?v=4"},"body":"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?\n\nI 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.\n\nIf this isn't possible today, is difftool.<tool>.prompt something others would find useful?\n\n\nThanks,\nRyan Zoeller\n"},{"id":"498964","messageId":"xmqqa5idmops.fsf@gitster.g","threadId":"61809","inReplyTo":"wglGbP7resY1dIKhfKqMcs6Xxu7f8iWSZ76k-MFC91eKTEWN2Aw4D6TqNAEndu5b1VZMVnOIS8m9HNoZPFxd6NZjKKmW0OmM8h5bAEuwoVY=@rtzoeller.com","subject":"Re: Equivalent of difftool.prompt per tool?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-07-19T14:38:23Z","receivedAt":"2024-07-19T14:38:35Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ryan Zoeller <rtzoeller@rtzoeller.com> writes:\n\n> Is there a way to specify difftool.prompt on a per-tool basis,\n> without manually passing --prompt or --no-prompt to override the\n> global difftool.prompt setting?\n>\n> I generally want `difftool.prompt = false` set, but one specific\n> tool I use has a high startup time and I'd like confirmation\n> before launching it.\n>\n> If this isn't possible today, is difftool.<tool>.prompt something\n> others would find useful?\n\nI do not use difftool (nor mergetool) myself, but given how\ndifftool.<tool>.cmd and difftool.<tool>.path behave, it does not\nsound like an unreasonable feature wish.\n\nI'd imagine the feature itself should be trivial to add, but we'd\nprobably want to add test to t/t7800-difftool.sh, where there are\nalready existing tests for inteactions between difftool.prompt and\nvarious command line options.\n\nThanks.\n\n git-difftool--helper.sh | 4 +++-\n 1 file changed, 3 insertions(+), 1 deletion(-)\n\ndiff --git c/git-difftool--helper.sh w/git-difftool--helper.sh\nindex dd0c9a5b7f..872d787b09 100755\n--- c/git-difftool--helper.sh\n+++ w/git-difftool--helper.sh\n@@ -12,7 +12,9 @@ TOOL_MODE=diff\n # and is overridden with $GIT_DIFFTOOL*_PROMPT.\n should_prompt () {\n \tprompt_merge=$(git config --bool mergetool.prompt || echo true)\n-\tprompt=$(git config --bool difftool.prompt || echo $prompt_merge)\n+\tprompt=$(git config --bool \"difftool.$merge_tool.prompt\" ||\n+\t\t git config --bool difftool.prompt ||\n+\t\t echo $prompt_merge)\n \tif test \"$prompt\" = true\n \tthen\n \t\ttest -z \"$GIT_DIFFTOOL_NO_PROMPT\"\n\n"},{"id":"498965","messageId":"016801dad9ea$f50d5fc0$df281f40$@nexbridge.com","threadId":"61809","inReplyTo":"xmqqa5idmops.fsf@gitster.g","subject":"RE: Equivalent of difftool.prompt per tool?","fromName":"","fromEmail":"rsbecker@nexbridge.com","sentAt":"2024-07-19T14:50:05Z","receivedAt":"2024-07-19T14:50:23Z","isPatch":false,"sender":{"key":"randall.becker@nexbridge.ca","avatar":"https://avatars.githubusercontent.com/u/28956764?v=4"},"body":"On Friday, July 19, 2024 10:38 AM, Junio C Hamano wrote:\n>Ryan Zoeller <rtzoeller@rtzoeller.com> writes:\n>\n>> Is there a way to specify difftool.prompt on a per-tool basis, without\n>> manually passing --prompt or --no-prompt to override the global\n>> difftool.prompt setting?\n>>\n>> I generally want `difftool.prompt = false` set, but one specific tool\n>> I use has a high startup time and I'd like confirmation before\n>> launching it.\n>>\n>> If this isn't possible today, is difftool.<tool>.prompt something\n>> others would find useful?\n>\n>I do not use difftool (nor mergetool) myself, but given how\ndifftool.<tool>.cmd and\n>difftool.<tool>.path behave, it does not sound like an unreasonable feature\nwish.\n>\n>I'd imagine the feature itself should be trivial to add, but we'd probably\nwant to add\n>test to t/t7800-difftool.sh, where there are already existing tests for\ninteactions\n>between difftool.prompt and various command line options.\n>\n>Thanks.\n>\n> git-difftool--helper.sh | 4 +++-\n> 1 file changed, 3 insertions(+), 1 deletion(-)\n>\n>diff --git c/git-difftool--helper.sh w/git-difftool--helper.sh index\n>dd0c9a5b7f..872d787b09 100755\n>--- c/git-difftool--helper.sh\n>+++ w/git-difftool--helper.sh\n>@@ -12,7 +12,9 @@ TOOL_MODE=diff\n> # and is overridden with $GIT_DIFFTOOL*_PROMPT.\n> should_prompt () {\n> \tprompt_merge=$(git config --bool mergetool.prompt || echo true)\n>-\tprompt=$(git config --bool difftool.prompt || echo $prompt_merge)\n>+\tprompt=$(git config --bool \"difftool.$merge_tool.prompt\" ||\n>+\t\t git config --bool difftool.prompt ||\n>+\t\t echo $prompt_merge)\n> \tif test \"$prompt\" = true\n> \tthen\n> \t\ttest -z \"$GIT_DIFFTOOL_NO_PROMPT\"\n\nIs it possible that a textconv configuration might be able to assist here by\ndeclaring a tool under user control for displaying content of files? This\nmight give finer grain control prior to launching the diff so that the user\ncan set up their desired shell environment with the above to select the\nprompting software?\nJust a thought.\n--Randall\n\n"}]}