Merge branch 'cc/reset-more'
authorJunio C Hamano <gitster@pobox.com>
Wed, 13 Jan 2010 19:58:56 +0000 (11:58 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 13 Jan 2010 19:58:56 +0000 (11:58 -0800)
* 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

1  2 
Documentation/git-reset.txt
builtin-reset.c
cache.h
read-cache.c
unpack-trees.c
Simple merge
diff --cc builtin-reset.c
index 5b647422d6d23c31ce568ea9ba3bf69eb39cec44,2c880a7e7acf05f3d1ed162ffc503ca2adbd5298..0f5022eed24f980f6fedee49f8602fefa6fe85e4
@@@ -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 46606477b626c9bdb6a60f9c0cf826c8fc435e00,7759c2cf94e41c4b85e178b77411293fe2a6d3e1..3e52c4efb1fba0577b18529afb8fcf75f51ddc2b
+++ 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 read-cache.c
Simple merge
diff --cc unpack-trees.c
index 7570475b453bbaceab74fa04826ff0d23f9e6e8f,3df0de60054a2cd82b1284f5c223ff8c44a0768b..acdd3117370e596716a0bdb751d6255690e6c700
@@@ -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);