From: Junio C Hamano <gitster@pobox.com>
To: Clemens Buchacher <drizzd@aon.at>
Cc: git@vger.kernel.org, Dave Olszewski <cxreg@pobox.com>,
John Tapsell <johnflux@gmail.com>
Subject: Re: [PATCH] refuse to merge during a merge
Date: Sun, 31 May 2009 12:36:37 -0700 [thread overview]
Message-ID: <7vd49prrne.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <20090531104359.GA19094@localhost> (Clemens Buchacher's message of "Sun\, 31 May 2009 12\:43\:59 +0200")
Clemens Buchacher <drizzd@aon.at> writes:
> The following is an easy mistake to make for users coming from version
> control systems with an "update and commit"-style workflow.
>
> 1. git pull
> 2. resolve conflicts
> 3. git pull
>
> Step 3 overrides MERGE_HEAD, starting a new merge with dirty index.
I think the new condition that you added to stop the merge is more in line
with the original intent of the check. We never wanted to check "do we
still have unmerged entries?" but wanted to see "is another merge in
progress?"; not checking MERGE_HEAD was a simple omission.
But I do not necessarily agree with the combined check nor with the new
message. I think it would be more sensible to split the codepath like
this:
if (we see MERGE_HEAD)
die("You have not concluded your merge (MERGE_HEAD exists).");
if (the index is unmerged)
die("You are in the middle of a conflicted merge (index unmerged).");
Then in a _later_ patch, you could try to be more helpful by paying more
attention to the context. E.g.
if (we see MERGE_HEAD) {
figure out what was attempted by looking at
MERGE_MSG and other cues;
die("You have not concluded your merge with %s.\n"
"Perhaps you would want 'git reset' to recover?"
that);
}
if (the index is unmerged)
die("You are in the middle of a conflicted merge");
The point is that combining the checks makes it harder to later give more
appropriate diagnosis and suggestion to the end user.
For example, "git merge" may learn "git merge --abort" like other commands
that have "attempt, stop, let the user fix up to conclude" modes of
operations (i.e. rebase and am), and we may suggest to use that to recover
in the message, instead of 'git reset'. But that can only be used if we
stopped because we saw MERGE_HEAD; you definitely do not want to suggest
"git merge --abort" if the index is unmerged due to a conflicted rebase in
progress.
Note that I am not suggesting you to blow this up to one large patch by
adding fancier "what were we doing" logic; I am perfectly OK with the
minimum "detect MERGE_HEAD and refuse". I am only saying that I am
unhappy with the way two different error conditions are conflated.
Personally, I'd suggest not to give "you can do this to recover" message.
next prev parent reply other threads:[~2009-05-31 19:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-27 21:04 [PATCH] refuse to merge during a merge Clemens Buchacher
2009-05-28 16:00 ` Constantine Plotnikov
2009-05-28 16:12 ` John Tapsell
2009-05-30 8:37 ` Clemens Buchacher
2009-05-30 10:38 ` Jakub Narebski
2009-05-30 10:57 ` Thomas Rast
2009-05-31 10:43 ` Clemens Buchacher
2009-05-31 11:05 ` John Tapsell
2009-05-31 14:05 ` Clemens Buchacher
2009-05-31 19:36 ` Junio C Hamano [this message]
2009-06-01 9:20 ` [PATCH v3] " Clemens Buchacher
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=7vd49prrne.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=cxreg@pobox.com \
--cc=drizzd@aon.at \
--cc=git@vger.kernel.org \
--cc=johnflux@gmail.com \
/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).