match-trees: compute buffer offset correctly when splicing
[gitweb.git] / builtin / read-tree.c
index fbbc98e5161f011a25743a528e6bb3f85e415f51..ac255ad2c243192a9afd3b4578a2a501eb250aff 100644 (file)
@@ -44,6 +44,7 @@ static const char * const read_tree_usage[] = {
 static int index_output_cb(const struct option *opt, const char *arg,
                                 int unset)
 {
+       BUG_ON_OPT_NEG(unset);
        set_alternate_index_output(arg);
        return 0;
 }
@@ -54,6 +55,8 @@ static int exclude_per_directory_cb(const struct option *opt, const char *arg,
        struct dir_struct *dir;
        struct unpack_trees_options *opts;
 
+       BUG_ON_OPT_NEG(unset);
+
        opts = (struct unpack_trees_options *)opt->value;
 
        if (opts->dir)
@@ -255,7 +258,9 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
         * what came from the tree.
         */
        if (nr_trees == 1 && !opts.prefix)
-               prime_cache_tree(&the_index, trees[0]);
+               prime_cache_tree(the_repository,
+                                the_repository->index,
+                                trees[0]);
 
        if (write_locked_index(&the_index, &lock_file, COMMIT_LOCK))
                die("unable to write new index file");