summaryrefslogtreecommitdiff
path: root/unpack-trees.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-01-13 11:58:56 -0800
committerJunio C Hamano <gitster@pobox.com>2010-01-13 11:58:56 -0800
commitdc96c5ee703fb7265619b1ecb2b5f2c5ab3ef40d (patch)
tree2d81a990aa60381e5ab751e1c88a7e7e6e2142ae /unpack-trees.c
parent73d66323ac78c750ba42fef23b1cb8fd2110e023 (diff)
parentd7eed8cbef2d15e87e9002f5e3ce08830b40b292 (diff)
downloadgit-dc96c5ee703fb7265619b1ecb2b5f2c5ab3ef40d.tar.gz
Merge branch 'cc/reset-more'
* cc/reset-more: t7111: check that reset options work as described in the tables Documentation: reset: add some missing tables Fix bit assignment for CE_CONFLICTED "reset --merge": fix unmerged case reset: use "unpack_trees()" directly instead of "git read-tree" reset: add a few tests for "git reset --merge" Documentation: reset: add some tables to describe the different options reset: improve mixed reset error message when in a bare repo
Diffstat (limited to 'unpack-trees.c')
-rw-r--r--unpack-trees.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/unpack-trees.c b/unpack-trees.c
index 7570475b45..acdd311737 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -550,6 +550,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);
}
@@ -809,7 +811,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.
@@ -827,11 +833,12 @@ static int merged_entry(struct cache_entry *merge, struct cache_entry *old,
update |= CE_SKIP_WORKTREE;
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);
@@ -847,7 +854,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);