Message ID | 20201228045427.1166911-3-seth@eseth.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | mergetool: add automerge configuration | expand |
> Subject: Re: [PATCH v8 2/4] mergetool: Add per-tool support for the autoMerge flag "git shortlog --no-merges --since=2.months" may tell you this but our convention is not to capitalize the word after "<area>:" on the title. > 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(-) > > 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`. > + This entry needs to mention how it relates to the big red button mergetool.autoMerge and vice versa. E.g. mergetool.autoMerge:: - Remove lines without conflicts from all the files. Defaults to `true`. + Remove lines without conflicts from all the files. Can be + overriden per-tool via `mergetool.<tool>.autoMerge` configuration + variable. Defaults to `true`. would be a good update to the documentation introduced by the previous step. It is somewhat misleading for the per-tool entry added in this patch to say "Defaults to `true`", as the value of the big red button configuration would be the real default. Remove ... the files when the mergetool '<tool>' is in use. See also `mergetool.autoMerge`. or something like that, perhaps.
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(-)