git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [IRC/patches] Failed octopus merge does not clean up

From
Andreas Ericsson <ae@op5.se>
Date
Sep 17, 2008, 06:45 UTC
Message-ID
<48D0A776.1000009@op5.se>
In-Reply-To
<200809170053.15341.jnareb@gmail.com>
Jakub Narebski wrote:
Show 54 quoted lines
> 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"?
> 

No. Git merges all the sub-things together and then merges the result of that jumble into the branch you're on.

Someone might have to correct me on that, but that's as far as I've understood it.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
Previous: Jakub NarebskiNext: Jakub Narebski
Message 14 of 17 in “[IRC/patches] Failed octopus merge does not clean up”
  1. Thomas RastSep 15, 2008
  2. Add test that checks octopus merge cleanupThomas Rast, Sep 15, 2008
  3. Documentation: warn against merging in a dirty treeThomas Rast, Sep 15, 2008
  4. Junio C HamanoSep 15, 2008
  5. Avery PennarunSep 15, 2008
  6. Junio C HamanoSep 16, 2008
  7. Linus TorvaldsSep 18, 2008
  8. Avery PennarunSep 18, 2008
  9. Junio C HamanoSep 19, 2008
  10. Junio C HamanoSep 15, 2008
  11. Thomas RastSep 15, 2008
  12. Junio C HamanoSep 16, 2008
  13. Jakub NarebskiSep 16, 2008
  14. Andreas EricssonSep 17, 2008
  15. Jakub NarebskiSep 17, 2008
  16. Miklos VajnaSep 17, 2008
  17. Andreas EricssonSep 17, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.