Code

Extend sample pre-commit hook to check for non ascii filenames
[git.git] / builtin-read-tree.c
index 9cd7d0738ed7018737196f03aa01c7bc7f720e26..82e25eaa0758d8b9584592f4072f81eeccb0bf1d 100644 (file)
@@ -135,7 +135,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
                                die("more than one --exclude-per-directory are given.");
 
                        dir = xcalloc(1, sizeof(*opts.dir));
-                       dir->show_ignored = 1;
+                       dir->flags |= DIR_SHOW_IGNORED;
                        dir->exclude_per_dir = arg + 24;
                        opts.dir = dir;
                        /* We do not need to nor want to do read-directory
@@ -199,9 +199,14 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
         * "-m ent" or "--reset ent" form), we can obtain a fully
         * valid cache-tree because the index must match exactly
         * what came from the tree.
+        *
+        * The same holds true if we are switching between two trees
+        * using read-tree -m A B.  The index must match B after that.
         */
        if (nr_trees == 1 && !opts.prefix)
                prime_cache_tree(&active_cache_tree, trees[0]);
+       else if (nr_trees == 2 && opts.merge)
+               prime_cache_tree(&active_cache_tree, trees[1]);
 
        if (write_cache(newfd, active_cache, active_nr) ||
            commit_locked_index(&lock_file))