summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b9d37a5)
raw | patch | inline | side by side (parent: b9d37a5)
author | Junio C Hamano <gitster@pobox.com> | |
Mon, 20 Apr 2009 10:58:19 +0000 (03:58 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 20 Apr 2009 11:16:41 +0000 (04:16 -0700) |
When switching to a new branch with "read-tree -m A B", the resulting
index must match tree B and we can prime the cache tree with it.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
index must match tree B and we can prime the cache tree with it.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-read-tree.c | patch | blob | history |
diff --git a/builtin-read-tree.c b/builtin-read-tree.c
index 9cd7d0738ed7018737196f03aa01c7bc7f720e26..391d709704320dba7a918fdd79b68c6c604d33b2 100644 (file)
--- a/builtin-read-tree.c
+++ b/builtin-read-tree.c
* "-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))