From: Junio C Hamano Date: Wed, 13 Jan 2010 19:58:56 +0000 (-0800) Subject: Merge branch 'cc/reset-more' X-Git-Tag: v1.7.0-rc0~102 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=dc96c5ee703fb7265619b1ecb2b5f2c5ab3ef40d;p=git.git 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 --- dc96c5ee703fb7265619b1ecb2b5f2c5ab3ef40d diff --cc builtin-reset.c index 5b647422d,2c880a7e7..0f5022eed --- a/builtin-reset.c +++ b/builtin-reset.c @@@ -285,9 -305,15 +304,13 @@@ int cmd_reset(int argc, const char **ar if (reset_type == NONE) reset_type = MIXED; /* by default */ - if ((reset_type == HARD || reset_type == MERGE) - && !is_inside_work_tree()) - die("%s reset requires a work tree", - reset_type_names[reset_type]); + if (reset_type == HARD || reset_type == MERGE) + setup_work_tree(); + if (reset_type == MIXED && is_bare_repository()) + die("%s reset is not allowed in a bare repository", + reset_type_names[reset_type]); + /* Soft reset does not touch the index file nor the working tree * at all, but requires them in a good order. Other resets reset * the index file to the tree object we are switching to. */ diff --cc cache.h index 46606477b,7759c2cf9..3e52c4efb --- a/cache.h +++ b/cache.h @@@ -177,10 -177,8 +177,11 @@@ struct cache_entry #define CE_HASHED (0x100000) #define CE_UNHASHED (0x200000) + #define CE_CONFLICTED (0x800000) +/* Only remove in work directory, not index */ +#define CE_WT_REMOVE (0x400000) + /* * Extended on-disk flags */ diff --cc unpack-trees.c index 7570475b4,3df0de600..acdd31173 --- a/unpack-trees.c +++ b/unpack-trees.c @@@ -823,15 -686,14 +829,16 @@@ static int merged_entry(struct cache_en } else { if (verify_uptodate(old, o)) return -1; + if (ce_skip_worktree(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);