From b1f47514f207b0601de7b0936cf13b3c0ae70081 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 8 Jul 2010 17:27:43 -0700 Subject: Fix "read-tree -m A B" priming the cache-tree In 456156d a shortcut to priming the index tree reference was introduced, but the justification for it was completely bogus. "read-tree -m A B" is to take the index (and the working tree) that is largely based on (but does not have to match exactly) A and update it to B, while carrying the local change that does not overlap the difference between A and B, so there is no reason to expect that the resulting index should match the tree B. Noticed and test provided by Heiko Voigt. Signed-off-by: Junio C Hamano --- t/t1001-read-tree-m-2way.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 't') diff --git a/t/t1001-read-tree-m-2way.sh b/t/t1001-read-tree-m-2way.sh index 271bc4e17..6e3b60110 100755 --- a/t/t1001-read-tree-m-2way.sh +++ b/t/t1001-read-tree-m-2way.sh @@ -392,4 +392,20 @@ test_expect_success \ git ls-files --stage | tee >treeMcheck.out && test_cmp treeM.out treeMcheck.out' +test_expect_success '-m references the correct modified tree' ' + echo >file-a && + echo >file-b && + git add file-a file-b && + git commit -a -m "test for correct modified tree" + git branch initial-mod && + echo b >file-b && + git commit -a -m "B" && + echo a >file-a && + git add file-a && + git ls-tree $(git write-tree) file-a >expect && + git read-tree -m HEAD initial-mod && + git ls-tree $(git write-tree) file-a >actual && + test_cmp expect actual +' + test_done -- cgit v1.2.1