* [PATCH] mergetools: add config option to disable auto-merge
@ 2015-06-16 21:35 Michael Rappazzo
2015-06-16 21:35 ` Michael Rappazzo
0 siblings, 1 reply; 6+ messages in thread
From: Michael Rappazzo @ 2015-06-16 21:35 UTC (permalink / raw)
To: davvid, ssaasen, john, gitster; +Cc: git, Michael Rappazzo
During conflict resolution, invoking a mergetool which supports
auto-merge will pass that option by default to the underlying tool.
This patch is intended to allow one to set 'merge.automerge' to
'false' in order to override this behavior.
Michael Rappazzo (1):
mergetools: add config option to disable auto-merge
Documentation/config.txt | 6 ++++++
Documentation/git-mergetool.txt | 19 +++++++++++++------
mergetools/araxis | 4 +++-
mergetools/diffmerge | 4 +++-
mergetools/kdiff3 | 4 +++-
5 files changed, 28 insertions(+), 9 deletions(-)
--
2.4.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] mergetools: add config option to disable auto-merge
2015-06-16 21:35 [PATCH] mergetools: add config option to disable auto-merge Michael Rappazzo
@ 2015-06-16 21:35 ` Michael Rappazzo
2015-06-17 19:41 ` Junio C Hamano
0 siblings, 1 reply; 6+ messages in thread
From: Michael Rappazzo @ 2015-06-16 21:35 UTC (permalink / raw)
To: davvid, ssaasen, john, gitster; +Cc: git, Michael Rappazzo
For some mergetools, the current invocation of git mergetool will
include an auto-merge flag. By default the flag is included, however if
the git config option 'merge.automerge' is set to 'false', then that
flag will now be omitted.
Signed-off-by: Michael Rappazzo <rappazzo@gmail.com>
---
Documentation/config.txt | 6 ++++++
Documentation/git-mergetool.txt | 19 +++++++++++++------
mergetools/araxis | 4 +++-
mergetools/diffmerge | 4 +++-
mergetools/kdiff3 | 4 +++-
5 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 43bb53c..658d8f7 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1864,6 +1864,12 @@ mergetool.meld.hasOutput::
to `true` tells Git to unconditionally use the `--output` option,
and `false` avoids using `--output`.
+mergetool.automerge::
+ When invoking a custom merge tool which includes an auto-merge
+ option, Git will include that option by default. If this variable
+ is set to `false` then the auto-merge option is not used when
+ invoking the custom merge tool.
+
mergetool.keepBackup::
After performing a merge, the original file with conflict markers
can be saved as a file with a `.orig` extension. If this variable
diff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt
index e846c2e..3461d3a 100644
--- a/Documentation/git-mergetool.txt
+++ b/Documentation/git-mergetool.txt
@@ -79,16 +79,23 @@ success of the resolution after the custom tool has exited.
Prompt before each invocation of the merge resolution program
to give the user a chance to skip the path.
-TEMPORARY FILES
----------------
-`git mergetool` creates `*.orig` backup files while resolving merges.
-These are safe to remove once a file has been merged and its
-`git mergetool` session has completed.
-
+CONFIGURATION OPTIONS
+---------------------
+mergetool.keepBackup::
+ `git mergetool` creates `*.orig` backup files while resolving merges.
+ These are safe to remove once a file has been merged and its
+ `git mergetool` session has completed.
++
Setting the `mergetool.keepBackup` configuration variable to `false`
causes `git mergetool` to automatically remove the backup as files
are successfully merged.
+mergetool.automerge::
+ For some mergetools, the current invocation of git mergetool will
+ include an auto-merge flag. By default the flag is included, however if
+ the git config option `merge.automerge` is set to `false`, then that
+ flag will be omitted.
+
GIT
---
Part of the linkgit:git[1] suite
diff --git a/mergetools/araxis b/mergetools/araxis
index 64f97c5..00e63da 100644
--- a/mergetools/araxis
+++ b/mergetools/araxis
@@ -6,7 +6,9 @@ merge_cmd () {
touch "$BACKUP"
if $base_present
then
- "$merge_tool_path" -wait -merge -3 -a1 \
+ automerge="-merge"
+ test "$(git config --get --bool mergetool.automerge)" = false && automerge=''
+ "$merge_tool_path" -wait ${automerge} -3 -a1 \
"$BASE" "$LOCAL" "$REMOTE" "$MERGED" >/dev/null 2>&1
else
"$merge_tool_path" -wait -2 \
diff --git a/mergetools/diffmerge b/mergetools/diffmerge
index f138cb4..287489b 100644
--- a/mergetools/diffmerge
+++ b/mergetools/diffmerge
@@ -5,7 +5,9 @@ diff_cmd () {
merge_cmd () {
if $base_present
then
- "$merge_tool_path" --merge --result="$MERGED" \
+ automerge="--merge"
+ test "$(git config --get --bool mergetool.automerge)" = false && automerge=''
+ "$merge_tool_path" ${automerge} --result="$MERGED" \
"$LOCAL" "$BASE" "$REMOTE"
else
"$merge_tool_path" --merge \
diff --git a/mergetools/kdiff3 b/mergetools/kdiff3
index 793d129..8e1d063 100644
--- a/mergetools/kdiff3
+++ b/mergetools/kdiff3
@@ -7,7 +7,9 @@ diff_cmd () {
merge_cmd () {
if $base_present
then
- "$merge_tool_path" --auto \
+ automerge="--auto"
+ test "$(git config --get --bool mergetool.automerge)" = false && automerge=''
+ "$merge_tool_path" ${automerge} \
--L1 "$MERGED (Base)" \
--L2 "$MERGED (Local)" \
--L3 "$MERGED (Remote)" \
--
2.4.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] mergetools: add config option to disable auto-merge
2015-06-16 21:35 ` Michael Rappazzo
@ 2015-06-17 19:41 ` Junio C Hamano
2015-06-18 2:27 ` Mike Rappazzo
0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2015-06-17 19:41 UTC (permalink / raw)
To: Michael Rappazzo; +Cc: davvid, ssaasen, john, git
Michael Rappazzo <rappazzo@gmail.com> writes:
> For some mergetools, the current invocation of git mergetool will
> include an auto-merge flag. By default the flag is included, however if
> the git config option 'merge.automerge' is set to 'false', then that
> flag will now be omitted.
... and why is the "automerge" a bad thing that user would want to
avoid triggering under which condition? That description may not
have to be in the proposed log message, but it would help users when
they decide if they want to use the configuration to describe it in
the mergetool.automerge configuration.
And depending on the answer to the above question, a configuration
variable may turn out be a bad mechanism to customize this (namely,
set-and-forget configuration variable is a bad match for a knob that
is more "per invocation" than "user taste").
Is this not about "automerge" but more about "always-show-UI because
I like GUI?" Then that may be a "user taste" thing that is a good
match for a configuration variable. I simply cannot tell from what
was in the message I am responding to.
> -TEMPORARY FILES
> ----------------
> -`git mergetool` creates `*.orig` backup files while resolving merges.
> -These are safe to remove once a file has been merged and its
> -`git mergetool` session has completed.
> -
> +CONFIGURATION OPTIONS
> +---------------------
> +mergetool.keepBackup::
> + `git mergetool` creates `*.orig` backup files while resolving merges.
> + These are safe to remove once a file has been merged and its
> + `git mergetool` session has completed.
> ++
This is an unrelated change; I think it is a good change, though.
I however suspect that we would not want to repeat the configuration
description in this file and instead mention these in "see also"
section referring the readers to git-config(1).
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mergetools: add config option to disable auto-merge
2015-06-17 19:41 ` Junio C Hamano
@ 2015-06-18 2:27 ` Mike Rappazzo
2015-06-18 8:42 ` David Aguilar
0 siblings, 1 reply; 6+ messages in thread
From: Mike Rappazzo @ 2015-06-18 2:27 UTC (permalink / raw)
To: Junio C Hamano; +Cc: David Aguilar, ssaasen, john, Git List
On Wed, Jun 17, 2015 at 3:41 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Michael Rappazzo <rappazzo@gmail.com> writes:
>
>> For some mergetools, the current invocation of git mergetool will
>> include an auto-merge flag. By default the flag is included, however if
>> the git config option 'merge.automerge' is set to 'false', then that
>> flag will now be omitted.
>
> ... and why is the "automerge" a bad thing that user would want to
> avoid triggering under which condition? That description may not
> have to be in the proposed log message, but it would help users when
> they decide if they want to use the configuration to describe it in
> the mergetool.automerge configuration.
>
> And depending on the answer to the above question, a configuration
> variable may turn out be a bad mechanism to customize this (namely,
> set-and-forget configuration variable is a bad match for a knob that
> is more "per invocation" than "user taste").
>
> Is this not about "automerge" but more about "always-show-UI because
> I like GUI?" Then that may be a "user taste" thing that is a good
> match for a configuration variable. I simply cannot tell from what
> was in the message I am responding to.
I feel that the auto-merge takes away the context of the changes.
I use araxis merge as my mergetool of choice. I almost always immediately
undo the auto-merge. After taking a moment to look at each file, I will
then (usually) use the keyboard shortcut for auto-merge.
It sure would be nice to "set-and-forget" a config variable to remove the
annoyance of having to undo the auto-merge. I think that this config
option is reasonable. Perhaps my documentation leaves something to be
desired. I can take another stab at it.
>
>> -TEMPORARY FILES
>> ----------------
>> -`git mergetool` creates `*.orig` backup files while resolving merges.
>> -These are safe to remove once a file has been merged and its
>> -`git mergetool` session has completed.
>> -
>> +CONFIGURATION OPTIONS
>> +---------------------
>> +mergetool.keepBackup::
>> + `git mergetool` creates `*.orig` backup files while resolving merges.
>> + These are safe to remove once a file has been merged and its
>> + `git mergetool` session has completed.
>> ++
>
> This is an unrelated change; I think it is a good change, though.
>
> I however suspect that we would not want to repeat the configuration
> description in this file and instead mention these in "see also"
> section referring the readers to git-config(1).
>
I felt that adding a separate header for a different config option was more
appropriate, so I went with this. Pointing to the config.txt doc is
probably better.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mergetools: add config option to disable auto-merge
2015-06-18 2:27 ` Mike Rappazzo
@ 2015-06-18 8:42 ` David Aguilar
2015-06-18 15:14 ` Mike Rappazzo
0 siblings, 1 reply; 6+ messages in thread
From: David Aguilar @ 2015-06-18 8:42 UTC (permalink / raw)
To: Mike Rappazzo; +Cc: Junio C Hamano, ssaasen, john, Git List
On Wed, Jun 17, 2015 at 10:27:58PM -0400, Mike Rappazzo wrote:
> On Wed, Jun 17, 2015 at 3:41 PM, Junio C Hamano <gitster@pobox.com> wrote:
> > Michael Rappazzo <rappazzo@gmail.com> writes:
> >
> >> For some mergetools, the current invocation of git mergetool will
> >> include an auto-merge flag. By default the flag is included, however if
> >> the git config option 'merge.automerge' is set to 'false', then that
> >> flag will now be omitted.
> >
> > ... and why is the "automerge" a bad thing that user would want to
> > avoid triggering under which condition? That description may not
> > have to be in the proposed log message, but it would help users when
> > they decide if they want to use the configuration to describe it in
> > the mergetool.automerge configuration.
> >
> > And depending on the answer to the above question, a configuration
> > variable may turn out be a bad mechanism to customize this (namely,
> > set-and-forget configuration variable is a bad match for a knob that
> > is more "per invocation" than "user taste").
> >
> > Is this not about "automerge" but more about "always-show-UI because
> > I like GUI?" Then that may be a "user taste" thing that is a good
> > match for a configuration variable. I simply cannot tell from what
> > was in the message I am responding to.
>
> I feel that the auto-merge takes away the context of the changes.
>
> I use araxis merge as my mergetool of choice. I almost always immediately
> undo the auto-merge. After taking a moment to look at each file, I will
> then (usually) use the keyboard shortcut for auto-merge.
>
> It sure would be nice to "set-and-forget" a config variable to remove the
> annoyance of having to undo the auto-merge. I think that this config
> option is reasonable. Perhaps my documentation leaves something to be
> desired. I can take another stab at it.
If this is the case then I would recommend making it more
granular. Just because Araxis' automerge is undesirable does
not mean that some other tools' automerge is as well.
e.g. the config variable could be "mergetool.<tool>.automerge"
rather than the top-level "mergetool.automerge" variable.
But, as Junio suggested, having a command-line flag to skip the
behavior might be a better first step. Something like,
"git mergetool --no-automerge".
Most of Git's behavior that can be modified via configuration
can also be modified on the command-line, so exposing this
feature as a flag would probably be a good idea.
Even without a config variable, it can still be fire-and-forget
convenient by using a git alias to supply the flag.
In lieu of any of these features, another option is that you can
override the default command by setting "mergetool.araxis.cmd",
and "git mergetool" will use your definition rather than its
built-in command. We left that escape hatch in for just this
purpose.
I'm curious, is this a common use case? I'm personally not a
good judge of that, but I'll let the list chime in. Thoughts?
--
David
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mergetools: add config option to disable auto-merge
2015-06-18 8:42 ` David Aguilar
@ 2015-06-18 15:14 ` Mike Rappazzo
0 siblings, 0 replies; 6+ messages in thread
From: Mike Rappazzo @ 2015-06-18 15:14 UTC (permalink / raw)
To: David Aguilar; +Cc: Junio C Hamano, Stefan Saasen, john, Git List
On Thu, Jun 18, 2015 at 4:43 AM David Aguilar <davvid@gmail.com> wrote:
>
> On Wed, Jun 17, 2015 at 10:27:58PM -0400, Mike Rappazzo wrote:
> >
> > I feel that the auto-merge takes away the context of the changes.
> >
> > I use araxis merge as my mergetool of choice. I almost always immediately
> > undo the auto-merge. After taking a moment to look at each file, I will
> > then (usually) use the keyboard shortcut for auto-merge.
> >
> > It sure would be nice to "set-and-forget" a config variable to remove the
> > annoyance of having to undo the auto-merge. I think that this config
> > option is reasonable. Perhaps my documentation leaves something to be
> > desired. I can take another stab at it.
>
> If this is the case then I would recommend making it more
> granular. Just because Araxis' automerge is undesirable does
> not mean that some other tools' automerge is as well.
> e.g. the config variable could be "mergetool.<tool>.automerge"
> rather than the top-level "mergetool.automerge" variable.
I don't necessarily think that araxis' automerge is bad, but I like to look
at the before and after to understand the context of a conflict. I can't
imagine that this is a quirk of araxis, but is probably something that
exists for any auto-merging tool. The feature doesn't seem to be that
widely supported among the other tooling. I only found the three to use
such a feature.
Since the automerge option is not available on every merge tool, it seems
reasonable to use "mergetool.<tool>.automerge" instead of "merge.automerge".
>
>
> But, as Junio suggested, having a command-line flag to skip the
> behavior might be a better first step. Something like,
> "git mergetool --no-automerge".
>
> Most of Git's behavior that can be modified via configuration
> can also be modified on the command-line, so exposing this
> feature as a flag would probably be a good idea.
This makes sense, and if this change is to go forward, I will implement the
command line option.
>
> Even without a config variable, it can still be fire-and-forget
> convenient by using a git alias to supply the flag.
>
> In lieu of any of these features, another option is that you can
> override the default command by setting "mergetool.araxis.cmd",
> and "git mergetool" will use your definition rather than its
> built-in command. We left that escape hatch in for just this
> purpose.
I guess that if this patch does not go forward, I will have to use this
workaround.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-06-18 15:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-16 21:35 [PATCH] mergetools: add config option to disable auto-merge Michael Rappazzo
2015-06-16 21:35 ` Michael Rappazzo
2015-06-17 19:41 ` Junio C Hamano
2015-06-18 2:27 ` Mike Rappazzo
2015-06-18 8:42 ` David Aguilar
2015-06-18 15:14 ` Mike Rappazzo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).