Re: Strange merge failure (would be overwritten by merge / cannot merge)
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 6, 2009, 20:36 UTC
- Message-ID
- <7vws4bzu7w.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <alpine.LFD.2.01.0909061248470.8946@localhost.localdomain>
Linus Torvalds <torvalds@linux-foundation.org> writes:
Show 20 quoted lines
> On Sun, 6 Sep 2009, Junio C Hamano wrote: >... >> * traverse_trees() takes a callback from the caller in info->fn(). It >> feeds the callback the entries with the same name most of the time, but >> that is not a guarantee, and the bug we are seeing is coming from a >> caller, unpack_trees_callback(), assuming it. > > This is the level I'm looking at. In fact, I'm going to cheat. I'm not > going to do it when we call info->fn(), I'm going to do it _before_ the > call, and have a special "find conflicts" phase inside traverse_trees() > itself. > > That way, any traverse_trees() user will see the conflicts exactly like > they used to, because I'm just going to add a special "find conflicts" > phase there that does the right thing. It's a hack, but it's a "useful" > hack, and it at least avoids being the current "it can't work for the > special case" thing. > ... > I think I have a good solution, give me half an hour to actually get it to > work.
Thanks.
The reason I brought up adding the "candidate for the earliest name" interface to the function was to avoid a case where the index has
blob "t"
blob "t-f"and all the trees being merged have
blob "t-f"
tree "t"in which case the "Are we supposed to look at the index too?" logic in unpack_callback() may not catch the "t-f" entry from the index when the first callback from traverse_trees() feeds it "t-f". It would notice that the entry at o->pos is "t". When that happens, I did not think of a clean way to avoid the codepath from emitting "t" as "only exists in the index". With the "candidate" addition, traverse_trees() could say "You asked me that I may have to return 't' to you, and here are the entries from all the trees." before giving "t-f" back.
Other than that, I think find_conflicts() phase in the traverse_trees() makes sense.