Am 31.07.2018 um 23:06 schrieb Junio C Hamano:
> Jeff King <p...@peff.net> writes:
> 
>> On Tue, Jul 31, 2018 at 01:23:04PM -0400, Jeff King wrote:
>> ...
>> So here it is fixed, and with a commit message. I'm not happy to omit a
>> regression test, but I actually couldn't come up with a minimal one that
>> tickled the problem, because we're playing around with heuristics.
How about something like this? (squashable)

---
 t/t6029-merge-subtree.sh | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/t/t6029-merge-subtree.sh b/t/t6029-merge-subtree.sh
index 3e692454a7..474a850de6 100755
--- a/t/t6029-merge-subtree.sh
+++ b/t/t6029-merge-subtree.sh
@@ -29,6 +29,34 @@ test_expect_success 'subtree available and works like 
recursive' '
 
 '
 
+test_expect_success 'setup branch sub' '
+       git checkout --orphan sub &&
+       git rm -rf . &&
+       test_commit foo
+'
+
+test_expect_success 'setup branch main' '
+       git checkout -b main master &&
+       git merge -s ours --no-commit --allow-unrelated-histories sub &&
+       git read-tree --prefix=dir/ -u sub &&
+       git commit -m "initial merge of sub into main" &&
+       test_path_is_file dir/foo.t &&
+       test_path_is_file hello
+'
+
+test_expect_success 'update branch sub' '
+       git checkout sub &&
+       test_commit bar
+'
+
+test_expect_success 'update branch main' '
+       git checkout main &&
+       git merge -s subtree sub -m "second merge of sub into main" &&
+       test_path_is_file dir/bar.t &&
+       test_path_is_file dir/foo.t &&
+       test_path_is_file hello
+'
+
 test_expect_success 'setup' '
        mkdir git-gui &&
        cd git-gui &&
-- 
2.18.0

Reply via email to