{"thread":{"id":"22305","subject":"[PATCH 1/2] Allow to override mergetool.prompt with $GIT_MERGETOOL*_PROMPT","startedAt":"2010-01-20T15:30:26Z","lastAt":"2010-01-22T01:58:02Z","messageCount":6,"participants":["Sebastian Schuberth","Johannes Sixt","David Aguilar"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"132196","messageId":"4B572192.2020606@gmail.com","threadId":"22305","inReplyTo":null,"subject":"[PATCH 1/2] Allow to override mergetool.prompt with $GIT_MERGETOOL*_PROMPT","fromName":"Sebastian Schuberth","fromEmail":"sschuberth@gmail.com","sentAt":"2010-01-20T15:30:26Z","receivedAt":"2010-01-20T15:30:26Z","isPatch":true,"sender":{"key":"sschuberth@gmail.com","avatar":"https://avatars.githubusercontent.com/u/349154?v=4"},"body":"This is for symmetry with git-difftool, and to make should_prompt_merge ()\nreusable from within git-difftool--helper.\n\nSigned-off-by: Sebastian Schuberth <sschuberth@gmail.com>\n---\n git-mergetool--lib.sh |    9 +++++++++\n git-mergetool.sh      |    3 ++-\n 2 files changed, 11 insertions(+), 1 deletions(-)\n\ndiff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh\nindex 5b62785..16b0343 100644\n--- a/git-mergetool--lib.sh\n+++ b/git-mergetool--lib.sh\n@@ -7,6 +7,15 @@ merge_mode() {\n \ttest \"$TOOL_MODE\" = merge\n }\n \n+should_prompt_merge () {\n+\tlocal prompt=$(git config --bool mergetool.prompt || echo true)\n+\tif test \"$prompt\" = true; then\n+\t\ttest -z \"$GIT_MERGETOOL_NO_PROMPT\"\n+\telse\n+\t\ttest -n \"$GIT_MERGETOOL_PROMPT\"\n+\tfi\n+}\n+\n translate_merge_tool_path () {\n \tcase \"$1\" in\n \tvimdiff)\ndiff --git a/git-mergetool.sh b/git-mergetool.sh\nindex b52a741..d453cb0 100755\n--- a/git-mergetool.sh\n+++ b/git-mergetool.sh\n@@ -202,7 +202,8 @@ merge_file () {\n     return 0\n }\n \n-prompt=$(git config --bool mergetool.prompt || echo true)\n+should_prompt_merge\n+prompt=$?\n \n while test $# != 0\n do\n-- \n1.6.5.1.1373.g71d1\n"},{"id":"132198","messageId":"4B572870.6090001@viscovery.net","threadId":"22305","inReplyTo":"4B572192.2020606@gmail.com","subject":"Re: [PATCH 1/2] Allow to override mergetool.prompt with $GIT_MERGETOOL*_PROMPT","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2010-01-20T15:59:44Z","receivedAt":"2010-01-20T15:59:44Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Sebastian Schuberth schrieb:\n> +should_prompt_merge () {\n> +\tlocal prompt=$(git config --bool mergetool.prompt || echo true)\n\n'local' is not portable. (The next patch shouldn't introduce it, either.)\n\n> -prompt=$(git config --bool mergetool.prompt || echo true)\n> +should_prompt_merge\n> +prompt=$?\n\nPreviously, prompt was either \"true\" or \"false\", but now it is a number.\nThis is not what the user (function merge_file) expects.\n\n-- Hannes\n"},{"id":"132199","messageId":"4B572AED.1040801@gmail.com","threadId":"22305","inReplyTo":"4B572870.6090001@viscovery.net","subject":"Re: [PATCH 1/2] Allow to override mergetool.prompt with $GIT_MERGETOOL*_PROMPT","fromName":"Sebastian Schuberth","fromEmail":"sschuberth@gmail.com","sentAt":"2010-01-20T16:10:21Z","receivedAt":"2010-01-20T16:10:21Z","isPatch":true,"sender":{"key":"sschuberth@gmail.com","avatar":"https://avatars.githubusercontent.com/u/349154?v=4"},"body":"This is for symmetry with git-difftool, and to make should_prompt_merge ()\nreusable from within git-difftool--helper.\n\nSigned-off-by: Sebastian Schuberth <sschuberth@gmail.com>\n---\n git-mergetool--lib.sh |    9 +++++++++\n git-mergetool.sh      |    2 +-\n 2 files changed, 10 insertions(+), 1 deletions(-)\n\ndiff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh\nindex 5b62785..b0e4156 100644\n--- a/git-mergetool--lib.sh\n+++ b/git-mergetool--lib.sh\n@@ -7,6 +7,15 @@ merge_mode() {\n \ttest \"$TOOL_MODE\" = merge\n }\n \n+should_prompt_merge () {\n+\tprompt=$(git config --bool mergetool.prompt || echo true)\n+\tif test \"$prompt\" = true; then\n+\t\ttest -z \"$GIT_MERGETOOL_NO_PROMPT\"\n+\telse\n+\t\ttest -n \"$GIT_MERGETOOL_PROMPT\"\n+\tfi\n+}\n+\n translate_merge_tool_path () {\n \tcase \"$1\" in\n \tvimdiff)\ndiff --git a/git-mergetool.sh b/git-mergetool.sh\nindex b52a741..69f1627 100755\n--- a/git-mergetool.sh\n+++ b/git-mergetool.sh\n@@ -202,7 +202,7 @@ merge_file () {\n     return 0\n }\n \n-prompt=$(git config --bool mergetool.prompt || echo true)\n+prompt=$(should_prompt_merge && echo true || echo false)\n \n while test $# != 0\n do\n-- \n1.6.6.266.g55d982.dirty\n"},{"id":"132276","messageId":"20100121074427.GA26973@gmail.com","threadId":"22305","inReplyTo":"4B572192.2020606@gmail.com","subject":"Re: [PATCH 1/2] Allow to override mergetool.prompt with $GIT_MERGETOOL*_PROMPT","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2010-01-21T07:44:28Z","receivedAt":"2010-01-21T07:44:28Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"Hi,\n\nOn Wed, Jan 20, 2010 at 04:30:26PM +0100, Sebastian Schuberth wrote:\n> This is for symmetry with git-difftool, and to make should_prompt_merge ()\n> reusable from within git-difftool--helper.\n> \n> Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>\n> ---\n>  git-mergetool--lib.sh |    9 +++++++++\n>  git-mergetool.sh      |    3 ++-\n>  2 files changed, 11 insertions(+), 1 deletions(-)\n> \n> diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh\n> index 5b62785..16b0343 100644\n> --- a/git-mergetool--lib.sh\n> +++ b/git-mergetool--lib.sh\n> @@ -7,6 +7,15 @@ merge_mode() {\n>  \ttest \"$TOOL_MODE\" = merge\n>  }\n>  \n> +should_prompt_merge () {\n> +\tlocal prompt=$(git config --bool mergetool.prompt || echo true)\n> +\tif test \"$prompt\" = true; then\n> +\t\ttest -z \"$GIT_MERGETOOL_NO_PROMPT\"\n> +\telse\n> +\t\ttest -n \"$GIT_MERGETOOL_PROMPT\"\n> +\tfi\n> +}\n\nSomeone already mentioned dropping \"local\" here.\n\nThe GIT_DIFFTOOL*_PROMPT variables are implementation details\nabout how git-difftool passes options to git-difftool--helper.\nWe don't advertise them in the documentation so we probably\nshouldn't support them aside from what is needed for\ngit-difftool.  We can drop this part.\n\n61ed71dc just recently removed git-difftool--helper's use of\nGIT_MERGE_TOOL based on this rationale.\n\n\n> diff --git a/git-mergetool.sh b/git-mergetool.sh\n> index b52a741..d453cb0 100755\n> --- a/git-mergetool.sh\n> +++ b/git-mergetool.sh\n> @@ -202,7 +202,8 @@ merge_file () {\n>      return 0\n>  }\n>  \n> -prompt=$(git config --bool mergetool.prompt || echo true)\n> +should_prompt_merge\n> +prompt=$?\n>  \n>  while test $# != 0\n>  do\n\ngit-difftool falling back to mergetool.prompt when\ndifftool.prompt is not available is good, especially\nsince we advertise that feature.\n\nOnce you drop the local declarations and the env. variable\nit should be good to go.  Patch v2, soon?\n\n-- \n\n\tDavid\n"},{"id":"132292","messageId":"4B582807.8070504@gmail.com","threadId":"22305","inReplyTo":"20100121074427.GA26973@gmail.com","subject":"Re: [PATCH 1/2] Allow to override mergetool.prompt with $GIT_MERGETOOL*_PROMPT","fromName":"Sebastian Schuberth","fromEmail":"sschuberth@gmail.com","sentAt":"2010-01-21T10:10:15Z","receivedAt":"2010-01-21T10:10:15Z","isPatch":true,"sender":{"key":"sschuberth@gmail.com","avatar":"https://avatars.githubusercontent.com/u/349154?v=4"},"body":"On 21.01.2010 08:44, David Aguilar wrote:\n\n> The GIT_DIFFTOOL*_PROMPT variables are implementation details\n> about how git-difftool passes options to git-difftool--helper.\n> We don't advertise them in the documentation so we probably\n> shouldn't support them aside from what is needed for\n> git-difftool.  We can drop this part.\n\nThanks for the explanation, I already was wondering why they don't \nappear in the docs.\n\n> git-difftool falling back to mergetool.prompt when\n> difftool.prompt is not available is good, especially\n> since we advertise that feature.\n>\n> Once you drop the local declarations and the env. variable\n> it should be good to go.  Patch v2, soon?\n\nIf I drop env. variable support, I don't see much reason to introduce \nthe should_prompt_merge () at all. I'd then leave git-mergetool* as-is, \nand directly run \"git config --bool mergetool.prompt\" inside \nshould_prompt_diff (). Would that be OK with you?\n\n-- \nSebastian Schuberth\n"},{"id":"132356","messageId":"20100122015802.GA20620@gmail.com","threadId":"22305","inReplyTo":"4B582807.8070504@gmail.com","subject":"Re: [PATCH 1/2] Allow to override mergetool.prompt with $GIT_MERGETOOL*_PROMPT","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2010-01-22T01:58:02Z","receivedAt":"2010-01-22T01:58:02Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Thu, Jan 21, 2010 at 11:10:15AM +0100, Sebastian Schuberth wrote:\n> On 21.01.2010 08:44, David Aguilar wrote:\n>\n>> The GIT_DIFFTOOL*_PROMPT variables are implementation details\n>> about how git-difftool passes options to git-difftool--helper.\n>> We don't advertise them in the documentation so we probably\n>> shouldn't support them aside from what is needed for\n>> git-difftool.  We can drop this part.\n>\n> Thanks for the explanation, I already was wondering why they don't  \n> appear in the docs.\n>\n>> git-difftool falling back to mergetool.prompt when\n>> difftool.prompt is not available is good, especially\n>> since we advertise that feature.\n>>\n>> Once you drop the local declarations and the env. variable\n>> it should be good to go.  Patch v2, soon?\n>\n> If I drop env. variable support, I don't see much reason to introduce  \n> the should_prompt_merge () at all. I'd then leave git-mergetool* as-is,  \n> and directly run \"git config --bool mergetool.prompt\" inside  \n> should_prompt_diff (). Would that be OK with you?\n>\n> -- \n> Sebastian Schuberth\n\nSounds good.\n\nThanks,\n\n-- \n\t\tDavid\n"}]}