Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> writes: > 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. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html