From: David Aguilar <davvid@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: John Keeping <john@keeping.me.uk>,
Git Mailing List <git@vger.kernel.org>,
Charles Bailey <charles@hashpling.org>,
"Theodore Ts'o" <tytso@mit.edu>
Subject: Re: [RFC PATCH 2/3] mergetools/kdiff3: allow opting-out of auto-merges
Date: Thu, 9 May 2013 15:17:30 -0700 [thread overview]
Message-ID: <CAJDDKr4S6=U1d1fWixaiAzf46KLBDNsi85fgvXy0Uu_aRJyoyw@mail.gmail.com> (raw)
In-Reply-To: <7v38tw9d7r.fsf@alter.siamese.dyndns.org>
On Thu, May 9, 2013 at 12:15 PM, Junio C Hamano <gitster@pobox.com> wrote:
> John Keeping <john@keeping.me.uk> writes:
>
>> On Thu, May 09, 2013 at 09:10:51AM -0700, Junio C Hamano wrote:
>>> David Aguilar <davvid@gmail.com> writes:
>>>
>>> > Marked "RFC" because I am kinda against adding more configuration
>>> > variables.
>>>
>>> Just like "git merge" has -X<option> escape hatch to allow us to
>>> pass backend-specific options, perhaps you can add a mechanism to
>>> "git mergetool" to let the user pass --no-auto from the command
>>> line?
>>
>> We already have "mergetool.<tool>.cmd" which allows a completely custom
>> command line to be specified.
>
> Then probably it is a good idea to drop this patch and replace it
> with a documentation patch to suggest those who do not want --auto
> to use that mechanism?
Generally, "mergetool.<tool>.cmd" is not general enough since we've
always special cased the base vs. no-base code paths and we run
different commands depending on whether a base is available.
It might make sense to extend that mechanism to allow
"mergetool.<tool>.merge2cmd" for the no-base form and allow .cmd to
remain as-is for the full 3-arg base form, but IMO that's an even
worse solution for the end user as they now need to configure two
separate variables and know all the intimate details about how to
configure it. OTOH, a boolean git configuration flag is much easier
and simpler for the user.
The -X--no-auto idea could work, but I was hoping for a "set once and
forget" fix I could hand to a user, which would remove the need for
such a feature.
Here's the background behind why I wrote this patch -- yesterday
someone at work asked, "does git mergetool not work with stash?" This
caught me by surprise, "yes, of course it does", I replied, but they
showed me a case where the behavior was confusing.
They had done "git stash && git pull --rebase && git stash pop". That
last pop created a merge conflict in one file.
They then ran "git mergetool" to resolve the merge but they never saw
the GUI and their changes were automatically staged. From a user's
POV this is unintuitive and confusing behavior because they were
expecting to run kdiff3, but instead it silently staged the file with
kdiff3's auto-merged result.
We could drop --auto altogether, which maybe is a better course of
action since it makes the behavior predictable and un-surprising, but
I do not know if anyone has come to rely on kdiff3's "auto-merge"
feature (hence the extended Cc: list).
Because I do not know exactly why "kdiff3" thinks these are "trivial
merges" it can resolve while "git stash pop" disagrees and cannot
trivially merge them, I seems that dropping "--auto" really may be the
better choice all around. In general, git tries to be extremely
careful and defers to the user in the face of ambiguity. Dropping
--auto would make sense from that POV since kdiff3 is preventing the
user from inspecting the result.
In other words, if there are no strong reasons to keep --auto then I
would not be opposed to changing the default. OTOH if there are users
that want it and some that don't, then the config variable is helpful,
and maybe it can be flipped the other way: call it
"mergetool.kdiff3.autoMerge", keep it False today, and maybe change
the default to True with Git 2.0.
But I would really prefer no configuration and the most intuitive and
least-surprising behavior. I think I've convinced myself that
dropping --auto altogether could accomplish this, but I do not want to
pull the rug out from under existing users, *if they exist*. If
everyone in this discussion is in the camp of, "I didn't even know it
worked that way" then changing the behavior is not so big a deal and
we can do without extra variables.
Would it be acceptable for me to rework this patch to drop --auto altogether?
--
David
next prev parent reply other threads:[~2013-05-09 22:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-09 9:13 [PATCH 1/3] mergetools/kdiff3: do not use --auto when diffing David Aguilar
2013-05-09 9:13 ` [RFC PATCH 2/3] mergetools/kdiff3: allow opting-out of auto-merges David Aguilar
2013-05-09 9:13 ` [RFC PATCH 3/3] Makefile: avoid deprecation warnings on OS X 10.8 David Aguilar
2013-05-09 15:14 ` John Keeping
2013-05-09 23:21 ` David Aguilar
2013-05-09 16:10 ` [RFC PATCH 2/3] mergetools/kdiff3: allow opting-out of auto-merges Junio C Hamano
2013-05-09 17:23 ` John Keeping
2013-05-09 19:15 ` Junio C Hamano
2013-05-09 22:17 ` David Aguilar [this message]
2013-05-10 5:41 ` Charles Bailey
2013-05-10 18:40 ` David Aguilar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJDDKr4S6=U1d1fWixaiAzf46KLBDNsi85fgvXy0Uu_aRJyoyw@mail.gmail.com' \
--to=davvid@gmail.com \
--cc=charles@hashpling.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=john@keeping.me.uk \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).