mailinfo: tests for RFC2047 examples
[gitweb.git] / builtin-read-tree.c
index 5a09e17f1ad4fe19cf4e7cc29235d14d35405168..38fef34d3fb6c24ab89043951f1ecf6c96e9bf51 100644 (file)
@@ -29,30 +29,6 @@ static int list_tree(unsigned char *sha1)
        return 0;
 }
 
-static int read_cache_unmerged(void)
-{
-       int i;
-       struct cache_entry **dst;
-       struct cache_entry *last = NULL;
-
-       read_cache();
-       dst = active_cache;
-       for (i = 0; i < active_nr; i++) {
-               struct cache_entry *ce = active_cache[i];
-               if (ce_stage(ce)) {
-                       remove_name_hash(ce);
-                       if (last && !strcmp(ce->name, last->name))
-                               continue;
-                       cache_tree_invalidate_path(active_cache_tree, ce->name);
-                       last = ce;
-                       continue;
-               }
-               *dst++ = ce;
-       }
-       active_nr = dst - active_cache;
-       return !!last;
-}
-
 static void prime_cache_tree_rec(struct cache_tree *it, struct tree *tree)
 {
        struct tree_desc desc;
@@ -88,7 +64,7 @@ static void prime_cache_tree(void)
 
 }
 
-static const char read_tree_usage[] = "git-read-tree (<sha> | [[-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>] [-u | -i]] [--exclude-per-directory=<gitignore>] [--index-output=<file>] <sha1> [<sha2> [<sha3>]])";
+static const char read_tree_usage[] = "git read-tree (<sha> | [[-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>] [-u | -i]] [--exclude-per-directory=<gitignore>] [--index-output=<file>] <sha1> [<sha2> [<sha3>]])";
 
 static struct lock_file lock_file;
 
@@ -218,6 +194,8 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
                usage(read_tree_usage);
        if ((opts.dir && !opts.update))
                die("--exclude-per-directory is meaningless unless -u");
+       if (opts.merge && !opts.index_only)
+               setup_work_tree();
 
        if (opts.merge) {
                if (stage < 2)
@@ -228,6 +206,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
                        break;
                case 2:
                        opts.fn = twoway_merge;
+                       opts.initial_checkout = is_cache_unborn();
                        break;
                case 3:
                default: