]> git.ipfire.org Git - thirdparty/git.git/commit - rerere.c
rerere: delay the recording of preimage
authorJunio C Hamano <gitster@pobox.com>
Mon, 20 Jul 2015 22:19:44 +0000 (15:19 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 15 Mar 2016 22:29:54 +0000 (15:29 -0700)
commitc0a5423b6f09f0c08749697b8d2860f956e905e9
treed4933befe95fbce1ed236bc48908403a2c0948a4
parent05dd9f139d6a7e4c7cd22d8d3b57faf5be88a571
rerere: delay the recording of preimage

We record the preimage only when there is no directory to record the
conflict we encountered, i.e. when $GIT_DIR/rr-cache/$ID does not
exist.  As the plan is to allow multiple <preimage,postimage> pairs
as variants for the same conflict ID eventually, this logic needs to
go.

As the first step in that direction, stop the "did we create the
directory?  Then we record the preimage" logic.  Instead, we record
if a preimage does not exist when we saw a conflict in a path.  Also
make sure that we remove a stale postimage, which most likely is
totally unrelated to the resolution of this new conflict, when we
create a new preimage under $ID when $GIT_DIR/rr-cache/$ID already
exists.

In later patches, we will further update this logic to be "do we
have <preimage,postimage> pair that cleanly resolve the current
conflicts?  If not, record a new preimage as a new variant", but
that does not happen at this stage yet.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
rerere.c