All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Sixt <j6t@kdbg.org>
To: Seth House <seth@eseth.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v8 3/4] mergetool: Break setup_tool out into separate initialization function
Date: Mon, 28 Dec 2020 12:48:29 +0100	[thread overview]
Message-ID: <cc8c5d6e-eee3-afdb-55cc-633455a5dcfa@kdbg.org> (raw)
In-Reply-To: <20201228045427.1166911-4-seth@eseth.com>

Am 28.12.20 um 05:54 schrieb Seth House:
> The tool-specific functions are sometimes needed in scope earlier than
> when run_merge_tool is called.

You should answer why this change is needed. "are sometimes needed in
scope earlier" cannot be true, else we would have a bug that is fixed by
this change. But this isn't a bug fix, is it?

It would be ok to say "We are going to add another thing that we will
need before run_merge_tool; this is a preparation" or something.

Which brings me to another point: I do not see that something is added
to initialize_merge_tool in a later patch. You are only replacing
setup_tool calls by initialize_merge_tool, which forwards to setup_tool.
Why do we need a new function?

> 
> Signed-off-by: Seth House <seth@eseth.com>
> ---
>  Documentation/git-mergetool--lib.txt | 4 ++++
>  git-difftool--helper.sh              | 2 ++
>  git-mergetool--lib.sh                | 7 ++++---
>  git-mergetool.sh                     | 2 ++
>  4 files changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/git-mergetool--lib.txt b/Documentation/git-mergetool--lib.txt
> index 4da9d24096..3e8f59ac0e 100644
> --- a/Documentation/git-mergetool--lib.txt
> +++ b/Documentation/git-mergetool--lib.txt
> @@ -38,6 +38,10 @@ get_merge_tool_cmd::
>  get_merge_tool_path::
>  	returns the custom path for a merge tool.
>  
> +initialize_merge_tool::
> +	bring merge tool specific functions into scope so they can be used or
> +	overridden.
> +
>  run_merge_tool::
>  	launches a merge tool given the tool name and a true/false
>  	flag to indicate whether a merge base is present.

[ swapped hunks for better sentence structure ]

> diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
> index 7225abd811..e059b3559e 100644
> --- a/git-mergetool--lib.sh
> +++ b/git-mergetool--lib.sh
> @@ -248,6 +248,10 @@ trust_exit_code () {
>  	fi
>  }
>
> +initialize_merge_tool () {
> +	# Bring tool-specific functions into scope
> +	setup_tool "$1" || return 1
> +}
>
>  # Entry point for running tools
>  run_merge_tool () {
> @@ -259,9 +263,6 @@ run_merge_tool () {
>  	merge_tool_path=$(get_merge_tool_path "$1") || exit
>  	base_present="$2"
>
> -	# Bring tool-specific functions into scope
> -	setup_tool "$1" || return 1
> -

Before this change, run_merge_tool would exit here when there was an
error during setup_tool. But...

> diff --git a/git-difftool--helper.sh b/git-difftool--helper.sh
> index 46af3e60b7..c47a6d4253 100755
> --- a/git-difftool--helper.sh
> +++ b/git-difftool--helper.sh
> @@ -61,6 +61,7 @@ launch_merge_tool () {
>  		export BASE
>  		eval $GIT_DIFFTOOL_EXTCMD '"$LOCAL"' '"$REMOTE"'
>  	else
> +		initialize_merge_tool "$merge_tool"
>  		run_merge_tool "$merge_tool"
>  	fi

... after the change we do not exit anymore. Does it matter?

Perhaps

		initialize_merge_tool "$merge_tool" &&
  		run_merge_tool "$merge_tool"

>  }
> @@ -79,6 +80,7 @@ if test -n "$GIT_DIFFTOOL_DIRDIFF"
>  then
>  	LOCAL="$1"
>  	REMOTE="$2"
> +	initialize_merge_tool "$merge_tool"
>  	run_merge_tool "$merge_tool" false
>  else
>  	# Launch the merge tool on each path provided by 'git diff'


> diff --git a/git-mergetool.sh b/git-mergetool.sh
> index e3c7d78d1d..929192d0f8 100755
> --- a/git-mergetool.sh
> +++ b/git-mergetool.sh
> @@ -334,6 +334,8 @@ merge_file () {
>  	checkout_staged_file 2 "$MERGED" "$LOCAL"
>  	checkout_staged_file 3 "$MERGED" "$REMOTE"
>  
> +	initialize_merge_tool "$merge_tool"
> +
>  	if test "$(
>  		git config --get --bool "mergetool.$merge_tool.automerge" ||
>  		git config --get --bool "mergetool.automerge" ||
> 


  reply	other threads:[~2020-12-28 11:49 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-23  4:53 [PATCH v5 0/1] mergetool: remove unconflicted lines Felipe Contreras
2020-12-23  4:53 ` [PATCH v5 1/1] mergetool: add automerge configuration Felipe Contreras
2020-12-23 13:34   ` Junio C Hamano
2020-12-23 14:23     ` Felipe Contreras
2020-12-23 20:21       ` Junio C Hamano
2020-12-24  0:14         ` Felipe Contreras
2020-12-24  0:32           ` Junio C Hamano
2020-12-24  1:36             ` Felipe Contreras
2020-12-24  6:17               ` Junio C Hamano
2020-12-24 15:59                 ` Felipe Contreras
2020-12-24 22:32                   ` Junio C Hamano
2020-12-27 18:01                     ` Felipe Contreras
2020-12-24  9:24 ` [PATCH v5 0/1] mergetool: remove unconflicted lines Junio C Hamano
2020-12-24 16:16   ` Felipe Contreras
2020-12-30  5:47   ` Johannes Schindelin
2020-12-30 22:33     ` Felipe Contreras
2020-12-27 20:58 ` [PATCH v6 0/1] mergetool: add automerge configuration Seth House
2020-12-27 20:58   ` [PATCH v6 1/2] " Seth House
2020-12-27 22:06     ` Junio C Hamano
2020-12-27 22:29       ` Seth House
2020-12-27 22:59         ` Junio C Hamano
2020-12-27 20:58   ` [PATCH v6 2/2] mergetool: Add per-tool support for the autoMerge flag Seth House
2020-12-27 22:31     ` Junio C Hamano
2020-12-28  0:41   ` [PATCH v7 0/2] mergetool: add automerge configuration Seth House
2020-12-28  0:41     ` [PATCH v7 1/2] " Seth House
2020-12-28  0:41     ` [PATCH v7 2/2] mergetool: Add per-tool support for the autoMerge flag Seth House
2020-12-28  1:18       ` Felipe Contreras
2020-12-28  4:54     ` [PATCH v8 0/4] mergetool: add automerge configuration Seth House
2020-12-28  4:54       ` [PATCH v8 1/4] " Seth House
2020-12-28 11:30         ` Johannes Sixt
2020-12-28  4:54       ` [PATCH v8 2/4] mergetool: Add per-tool support for the autoMerge flag Seth House
2020-12-28 13:09         ` Junio C Hamano
2020-12-28  4:54       ` [PATCH v8 3/4] mergetool: Break setup_tool out into separate initialization function Seth House
2020-12-28 11:48         ` Johannes Sixt [this message]
2020-12-28  4:54       ` [PATCH v8 4/4] mergetool: Add automerge_enabled tool-specific override function Seth House
2020-12-28 11:57         ` Johannes Sixt
2020-12-28 13:19         ` Junio C Hamano
2020-12-28 19:29       ` [PATCH v9 0/5] mergetool: add automerge configuration Seth House
2020-12-28 19:29         ` [PATCH v9 1/5] " Seth House
2020-12-28 19:29         ` [PATCH v9 2/5] mergetool: alphabetize the mergetool config docs Seth House
2020-12-28 19:29         ` [PATCH v9 3/5] mergetool: add per-tool support for the autoMerge flag Seth House
2020-12-28 19:29         ` [PATCH v9 4/5] mergetool: break setup_tool out into separate initialization function Seth House
2020-12-29  8:50           ` Johannes Sixt
2020-12-29 17:23             ` Seth House
2020-12-28 19:29         ` [PATCH v9 5/5] mergetool: add automerge_enabled tool-specific override function Seth House
2020-12-29  2:01           ` Felipe Contreras
2021-01-06  5:55           ` Junio C Hamano
2021-01-07  3:58             ` Seth House
2021-01-07  6:38               ` Junio C Hamano
2021-01-07  9:27                 ` Seth House
2021-01-07 21:26                   ` Junio C Hamano
2021-01-08 15:04                     ` Johannes Schindelin
2021-01-30  5:46         ` [PATCH v10 0/3] mergetool: add hideResolved configuration (was automerge) Seth House
2021-01-30  5:46           ` [PATCH v10 1/3] mergetool: add hideResolved configuration Seth House
2021-01-30  8:08             ` Junio C Hamano
2021-01-30  5:46           ` [PATCH v10 2/3] mergetool: break setup_tool out into separate initialization function Seth House
2021-01-30  5:46           ` [PATCH v10 3/3] mergetool: add per-tool support and overrides for the hideResolved flag Seth House
2021-01-30  8:08             ` Junio C Hamano
2021-02-09 20:07           ` [PATCH v11 0/3] mergetool: add hideResolved configuration (was automerge) Seth House
2021-02-09 20:07             ` [PATCH v11 1/3] mergetool: add hideResolved configuration Seth House
2021-03-09  2:29               ` [PATCH] mergetool: do not enable hideResolved by default Jonathan Nieder
2021-03-09  5:42                 ` Seth House
2021-03-10  1:23                   ` Jonathan Nieder
2021-03-10  8:06                 ` Junio C Hamano
2021-03-11  1:57                   ` Junio C Hamano
2021-03-12 23:12                     ` Junio C Hamano
2021-03-12 23:29                       ` Jonathan Nieder
2021-03-12 23:36                         ` Junio C Hamano
2021-03-13  8:36                           ` [PATCH v2 0/2] " Jonathan Nieder
2021-03-13  8:38                             ` [PATCH 1/2] " Jonathan Nieder
2021-03-13  8:41                             ` [PATCH 2/2] doc: describe mergetool configuration in git-mergetool(1) Jonathan Nieder
2021-03-13 23:34                               ` Junio C Hamano
2021-03-13 23:37                               ` Junio C Hamano
2021-02-09 20:07             ` [PATCH v11 2/3] mergetool: break setup_tool out into separate initialization function Seth House
2021-02-09 20:07             ` [PATCH v11 3/3] mergetool: add per-tool support and overrides for the hideResolved flag Seth House
2021-02-09 22:11             ` [PATCH v11 0/3] mergetool: add hideResolved configuration (was automerge) Junio C Hamano
2021-02-09 23:27               ` Seth House
2020-12-28 10:29     ` [PATCH v7 0/2] mergetool: add automerge configuration Junio C Hamano
2020-12-28 14:40       ` Felipe Contreras
2020-12-28  1:02   ` [PATCH v6 0/1] " Felipe Contreras

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=cc8c5d6e-eee3-afdb-55cc-633455a5dcfa@kdbg.org \
    --to=j6t@kdbg.org \
    --cc=git@vger.kernel.org \
    --cc=seth@eseth.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.