rerere: do not leak mmfile[] for a path with multiple stage #1 entries
authorJunio C Hamano <redacted>
Fri, 24 Jul 2015 22:10:52 +0000 (15:10 -0700)
committerJunio C Hamano <redacted>
Fri, 24 Jul 2015 22:11:02 +0000 (15:11 -0700)
commit7d4053b69b37927c0ccd98eac41f32707227eca0
treea9461bbf6bc0473d0013e80d01bb3a7c6e3083db
parent74444d4ec4c23d254040de7b2637660b7f141110
rerere: do not leak mmfile[] for a path with multiple stage #1 entries

A conflicted index can have multiple stage #1 entries when dealing
with a criss-cross merge and using the "resolve" merge strategy.

Plug the leak by reading only the first one of the same stage
entries.

Strictly speaking, this fix does change the semantics, in that we
used to use the last stage #1 entry as the common ancestor when
doing the plain-vanilla three-way merge, but with the leak fix, we
will use the first stage #1 entry.  But it is not a grave backward
compatibility breakage.  Either way, we are arbitrarily picking one
of multiple stage #1 entries and using it, ignoring others, and
there is no meaning in the ordering of these stage #1 entries.

Signed-off-by: Junio C Hamano <redacted>
rerere.c
git clone https://git.99rst.org/PROJECT