Message ID | 20201228004152.522421-3-seth@eseth.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | mergetool: add automerge configuration | expand |
Seth House wrote: > diff --git a/git-mergetool.sh b/git-mergetool.sh > index f4db0cac8d..e3c7d78d1d 100755 > --- a/git-mergetool.sh > +++ b/git-mergetool.sh > @@ -334,7 +334,10 @@ merge_file () { > checkout_staged_file 2 "$MERGED" "$LOCAL" > checkout_staged_file 3 "$MERGED" "$REMOTE" > > - if test "$(git config --bool mergetool.autoMerge)" != "false" > + if test "$( > + git config --get --bool "mergetool.$merge_tool.automerge" || > + git config --get --bool "mergetool.automerge" || > + echo true)" = true This is a per-tool user configuration. Wasn't your argument that some tools would want to disable this flag? That is; the tool, not the user. For example, the author of diffconflicts might want to disable this flag for all its users, or at least disable it by default. How can the winmerge difftool disable this flag? > then > auto_merge > fi
diff --git a/Documentation/config/mergetool.txt b/Documentation/config/mergetool.txt index 7ce6d0d3ac..ef147fc118 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:: + Remove lines without conflicts from all the files. Defaults to `true`. + 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 f4db0cac8d..e3c7d78d1d 100755 --- a/git-mergetool.sh +++ b/git-mergetool.sh @@ -334,7 +334,10 @@ merge_file () { checkout_staged_file 2 "$MERGED" "$LOCAL" checkout_staged_file 3 "$MERGED" "$REMOTE" - if test "$(git config --bool mergetool.autoMerge)" != "false" + if test "$( + git config --get --bool "mergetool.$merge_tool.automerge" || + git config --get --bool "mergetool.automerge" || + echo true)" = true then auto_merge fi
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@eseth.com> --- Documentation/config/mergetool.txt | 3 +++ git-mergetool.sh | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-)