Re: [PATCH v6 2/2] mergetool: Add per-tool support for the autoMerge flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Seth House <seth@xxxxxxxxx> writes:

> Keep the global mergetool flag and add a per-tool override flag so that
> users may enable the flag for one tool and disable it for another.
>
> Signed-off-by: Seth House <seth@xxxxxxxxx>
> ---
>  Documentation/config/mergetool.txt | 3 +++
>  git-mergetool.sh                   | 5 ++++-
>  2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/config/mergetool.txt b/Documentation/config/mergetool.txt
> index 43af7a96f9..7f32281a61 100644
> --- a/Documentation/config/mergetool.txt
> +++ b/Documentation/config/mergetool.txt
> @@ -21,6 +21,9 @@ mergetool.<tool>.trustExitCode::
>  	if the file has been updated, otherwise the user is prompted to
>  	indicate the success of the merge.
>  
> +mergetool.<tool>.autoMerge::
> +	Automatically resolve conflicts that don't require user intervention.
> +
>  mergetool.meld.hasOutput::
>  	Older versions of `meld` do not support the `--output` option.
>  	Git will attempt to detect whether `meld` supports `--output`
> diff --git a/git-mergetool.sh b/git-mergetool.sh
> index 6e86d3b492..81df301734 100755
> --- a/git-mergetool.sh
> +++ b/git-mergetool.sh
> @@ -323,7 +323,10 @@ merge_file () {
>  	checkout_staged_file 2 "$MERGED" "$LOCAL"
>  	checkout_staged_file 3 "$MERGED" "$REMOTE"
>  
> -	if test "$(git config --bool mergetool.autoMerge)" = "true"
> +	if test "$(
> +		git config --get --bool "mergetool.$merge_tool.automerge" ||
> +		git config --get --bool "mergetool.automerge" ||
> +		echo true)" = true

Your [v6 1/2] that you build this step on does not enable the
feature by default, but this step does; it deserves to be documented
and mentioned in the proposed log message.

But I think you'd want to build this step on top of newer one, if
only to take the portability fix to the tests, and that patch
enables the feature by default, so ...

>  	then
>  		git merge-file --diff3 -q -p "$LOCAL" "$BASE" "$REMOTE" >"$DIFF3"
>  		sed -e '/^<<<<<<< /,/^||||||| /d' -e '/^=======\r\?$/,/^>>>>>>> /d' "$DIFF3" >"$BASE"

Thanks.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux