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