summaryrefslogtreecommitdiff
path: root/unpack-trees.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-12-17 19:32:04 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-12-17 19:32:17 (GMT)
commit4766036ecdee2d45b5a955409da5e6751c3e2f05 (patch)
tree7adcc5c39b32dc7e0cd850bcfad22e0bae7064c6 /unpack-trees.c
parent66c24cd8a4b8db93b5fee81f144d6411ac7e5391 (diff)
parent77b43cac9feac1079f3643988cfadee63e4365f7 (diff)
downloadgit-4766036ecdee2d45b5a955409da5e6751c3e2f05.zip
git-4766036ecdee2d45b5a955409da5e6751c3e2f05.tar.gz
git-4766036ecdee2d45b5a955409da5e6751c3e2f05.tar.bz2
Merge branch 'jk/two-way-merge-corner-case-fix' into maint
"git am --abort" sometimes complained about not being able to write a tree with an 0{40} object in it. * jk/two-way-merge-corner-case-fix: t1005: add test for "read-tree --reset -u A B" t1005: reindent unpack-trees: fix "read-tree -u --reset A B" with conflicted index
Diffstat (limited to 'unpack-trees.c')
-rw-r--r--unpack-trees.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/unpack-trees.c b/unpack-trees.c
index 35cb05e..ad3e9a0 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -1763,14 +1763,23 @@ int twoway_merge(const struct cache_entry * const *src,
newtree = NULL;
if (current) {
- if ((!oldtree && !newtree) || /* 4 and 5 */
- (!oldtree && newtree &&
- same(current, newtree)) || /* 6 and 7 */
- (oldtree && newtree &&
- same(oldtree, newtree)) || /* 14 and 15 */
- (oldtree && newtree &&
- !same(oldtree, newtree) && /* 18 and 19 */
- same(current, newtree))) {
+ if (current->ce_flags & CE_CONFLICTED) {
+ if (same(oldtree, newtree) || o->reset) {
+ if (!newtree)
+ return deleted_entry(current, current, o);
+ else
+ return merged_entry(newtree, current, o);
+ }
+ return o->gently ? -1 : reject_merge(current, o);
+ }
+ else if ((!oldtree && !newtree) || /* 4 and 5 */
+ (!oldtree && newtree &&
+ same(current, newtree)) || /* 6 and 7 */
+ (oldtree && newtree &&
+ same(oldtree, newtree)) || /* 14 and 15 */
+ (oldtree && newtree &&
+ !same(oldtree, newtree) && /* 18 and 19 */
+ same(current, newtree))) {
return keep_entry(current, o);
}
else if (oldtree && !newtree && same(current, oldtree)) {