summaryrefslogtreecommitdiff
path: root/t/t1005-read-tree-reset.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2012-12-29 15:51:54 -0500
committerJunio C Hamano <gitster@pobox.com>2013-11-04 10:13:27 -0800
commitb018ff60857ee7d79e3c4a8772bac08656a2a3c6 (patch)
treeca5ce5d71a14eece1b243b73444456995dbcf8ea /t/t1005-read-tree-reset.sh
parentc479d14a80743b1cb86d77695607f4c81f7d8797 (diff)
downloadgit-b018ff60857ee7d79e3c4a8772bac08656a2a3c6.tar.gz
unpack-trees: fix "read-tree -u --reset A B" with conflicted index
When we call "read-tree --reset -u HEAD ORIG_HEAD", the first thing we do with the index is to call read_cache_unmerged. Originally that would read the index, leaving aside any unmerged entries. However, as of d1a43f2 (reset --hard/read-tree --reset -u: remove unmerged new paths, 2008-10-15), it actually creates a new cache entry to serve as a placeholder, so that we later know to update the working tree. However, we later noticed that the sha1 of that unmerged entry was just copied from some higher stage, leaving you with random content in the index. That was fixed by e11d7b5 ("reset --merge": fix unmerged case, 2009-12-31), which instead puts the null sha1 into the newly created entry, and sets a CE_CONFLICTED flag. At the same time, it teaches the unpack-trees machinery to pay attention to this flag, so that oneway_merge throws away the current value. However, it did not update the code paths for twoway_merge, which is where we end up in the two-way read-tree with --reset. We notice that the HEAD and ORIG_HEAD versions are the same, and say "oh, we can just reuse the current version". But that's not true. The current version is bogus. Notice this case and make sure we do not keep the bogus entry; either we do not have that path in the tree we are moving to (i.e. remove it), or we want to have the cache entry we created for the tree we are moving to (i.e. resolve by explicitly saying the "newtree" version is what we want). [jc: this is from the almost year-old $gmane/212316] Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1005-read-tree-reset.sh')
0 files changed, 0 insertions, 0 deletions