diff options
Diffstat (limited to 'unpack-trees.c')
-rw-r--r-- | unpack-trees.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/unpack-trees.c b/unpack-trees.c index dd5999c356..3df0de6005 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -436,6 +436,8 @@ static int same(struct cache_entry *a, struct cache_entry *b) return 0; if (!a && !b) return 1; + if ((a->ce_flags | b->ce_flags) & CE_CONFLICTED) + return 0; return a->ce_mode == b->ce_mode && !hashcmp(a->sha1, b->sha1); } @@ -666,7 +668,11 @@ static int merged_entry(struct cache_entry *merge, struct cache_entry *old, { int update = CE_UPDATE; - if (old) { + if (!old) { + if (verify_absent(merge, "overwritten", o)) + return -1; + invalidate_ce_path(merge, o); + } else if (!(old->ce_flags & CE_CONFLICTED)) { /* * See if we can re-use the old CE directly? * That way we get the uptodate stat info. @@ -682,11 +688,12 @@ static int merged_entry(struct cache_entry *merge, struct cache_entry *old, return -1; invalidate_ce_path(old, o); } - } - else { - if (verify_absent(merge, "overwritten", o)) - return -1; - invalidate_ce_path(merge, o); + } else { + /* + * Previously unmerged entry left as an existence + * marker by read_index_unmerged(); + */ + invalidate_ce_path(old, o); } add_entry(o, merge, update, CE_STAGEMASK); @@ -702,7 +709,7 @@ static int deleted_entry(struct cache_entry *ce, struct cache_entry *old, return -1; return 0; } - if (verify_uptodate(old, o)) + if (!(old->ce_flags & CE_CONFLICTED) && verify_uptodate(old, o)) return -1; add_entry(o, ce, CE_REMOVE, 0); invalidate_ce_path(ce, o); |