From: Jakub Narebski <jnareb@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Thomas Rast <trast@student.ethz.ch>,
git@vger.kernel.org, Miklos Vajna <vmiklos@frugalware.org>
Subject: Re: [IRC/patches] Failed octopus merge does not clean up
Date: Wed, 17 Sep 2008 00:53:13 +0200 [thread overview]
Message-ID: <200809170053.15341.jnareb@gmail.com> (raw)
In-Reply-To: <7vhc8h7xgj.fsf@gitster.siamese.dyndns.org>
Dnia wtorek 16. września 2008 02:20, Junio C Hamano napisał:
> Junio C Hamano <gitster@pobox.com> writes:
>> Thomas Rast <trast@student.ethz.ch> writes:
>>
>>> The merge says
>>>
>>> Trying simple merge with 5b3e4bb1c2d88d6967fb575729fbfc86df5eaec9
>>> Simple merge did not work, trying automatic merge.
>>> Auto-merging foo
>>> ERROR: Merge conflict in foo
>>> fatal: merge program failed
>>> Automated merge did not work.
>>> Should not be doing an Octopus.
>>> Merge with strategy octopus failed.
>> ...
>> Read the second from the last line of what you were told by git. Run "git
>> reset --hard" after that, perhaps.
The problem, as far as I understand it, is not that octopus merge fails.
The problem is that it fails halfway, and it leaves working are in
inconsistent state: git-status output with its "unmerged" suggests that
we are in the middle of the merge, but we are not.
> By the way, there are three failure modes in Octopus.
>
> (0) your index (not work tree) is dirty; this is not limited to octopus
> merge but any merge will be refused;
IIRC the idea of stashing away changes, doing merge, and then unstashing
was shot down as encouraging bad workflows, and more often than not
leading only to mess in workdir and index.
> (1) while it merges other heads one-by-one, it gets conflicts on an
> earlier one, before it even attempts to merge all of them. Recording
> the heads that it so far attempted to merge in MERGE_HEAD is wrong
> (the result won't be an Octopus the end user wanted to carete), and
> recording all the heads the user gave in MERGE_HEAD is even more
> wrong (it hasn't even looked at the later heads yet, so there is no
> way for the index or work tree to contain anything from them).
>
> The above is hitting this case.
IMVHO the correct solution would be to rollback changes to the state
before attempting a merge. I'd rather 'octopus' did its thing as
transaction; contrary to ordinary merges if merge fails it doesn't
mean necessary that it is in the state of resolvable conflict, state
we can stop at. Perhaps (if it is still a shell script, doing git-stash
at beginning, and either dropping or popping the stash at the end;
or just saving old index if it is built-in).
BTW. does it mean that "git merge a b" might be not the same as
"git merge b a"?
> (2) it gets conflicts while merging the _last_ head. It records
> MERGE_HEAD and allows you to record the resolved result.
>
> I think originally we treated (1) and (2) the same way, because an Octopus
> is to record the most trivial merge with more than 2 legs, and a rough
> definition of "the most trivial" is "tracks of totally independent works;
> you could merge them one by one and _in any order_, and the result won't
> matter because they are logically independent. However if they are _so_
> independent, why not record them as merged in one step (i.e. octopus),
> instead of insisting on recording in what order you merged them".
>
> Obviously, if you get a conflict during Octopus creation, they were not
> tracks of totally independent works, and that is where the "Should not" in
> the message comes from.
>
> We later relaxed it to allow a conflict at the last step, not because
> recording an Octopus with nontrivial merge is particuarly a good idea we
> should encourage, but because there simply weren't reason not to.
Well, octopus merge could simply fail when merge is nontrivial (not
limited to being tree-level merge only).
--
Jakub Narebski
Poland
next prev parent reply other threads:[~2008-09-16 22:54 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-15 22:48 [IRC/patches] Failed octopus merge does not clean up Thomas Rast
2008-09-15 22:49 ` [PATCH] Add test that checks octopus merge cleanup Thomas Rast
2008-09-15 22:49 ` [PATCH] Documentation: warn against merging in a dirty tree Thomas Rast
2008-09-15 23:42 ` Junio C Hamano
2008-09-15 23:53 ` Avery Pennarun
2008-09-16 0:06 ` Junio C Hamano
2008-09-18 15:15 ` Linus Torvalds
2008-09-18 18:18 ` Avery Pennarun
2008-09-19 20:28 ` Junio C Hamano
2008-09-15 23:36 ` [IRC/patches] Failed octopus merge does not clean up Junio C Hamano
2008-09-15 23:47 ` Thomas Rast
2008-09-16 0:20 ` Junio C Hamano
2008-09-16 22:53 ` Jakub Narebski [this message]
2008-09-17 6:45 ` Andreas Ericsson
2008-09-17 8:11 ` Jakub Narebski
2008-09-17 15:59 ` Miklos Vajna
2008-09-17 16:40 ` Andreas Ericsson
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=200809170053.15341.jnareb@gmail.com \
--to=jnareb@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=trast@student.ethz.ch \
--cc=vmiklos@frugalware.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.