]> git.proxmox.com Git - libgit2.git/commitdiff
merge_trees: introduce test for submodule renames
authorEdward Thomson <ethomson@github.com>
Thu, 9 Feb 2017 16:52:03 +0000 (16:52 +0000)
committerEdward Thomson <ethomson@github.com>
Thu, 9 Feb 2017 18:13:06 +0000 (18:13 +0000)
Test that shows that submodules are incorrectly considered in renames,
and `git_merge_trees` will fail to lookup the submodule as a blob.

17 files changed:
tests/merge/trees/renames.c
tests/resources/merge-resolve/.gitted/objects/2a/f2d9bcbc73723ac988bb202d4397f72a6ca7a0 [new file with mode: 0644]
tests/resources/merge-resolve/.gitted/objects/37/f53a5a14f64e91089a39ea58e71c87d81df765 [new file with mode: 0644]
tests/resources/merge-resolve/.gitted/objects/4d/d1ef7569b18d92d93c0a35bb6b93049137b355 [new file with mode: 0644]
tests/resources/merge-resolve/.gitted/objects/63/ec604d491161ddafdae4179843c26d54bd999a [new file with mode: 0644]
tests/resources/merge-resolve/.gitted/objects/68/f7c02064019d89e40e51d7776b6f67914420a2 [new file with mode: 0644]
tests/resources/merge-resolve/.gitted/objects/94/29c05dd6f6f39fc567b4ce923b16df5d3d7a7a [new file with mode: 0644]
tests/resources/merge-resolve/.gitted/objects/a1/07e18a58f38c46086c8f8f1dcd54c40154eeb6 [new file with mode: 0644]
tests/resources/merge-resolve/.gitted/objects/a2/d8d1824c68541cca94ffb90f79291eba495921 [new file with mode: 0644]
tests/resources/merge-resolve/.gitted/objects/bc/85d1aad435ff3705a8c30ace85f7542c5736cb [new file with mode: 0644]
tests/resources/merge-resolve/.gitted/objects/c8/26ef8b17b5cd2c4a0023f265f3a423b3aa0388 [new file with mode: 0644]
tests/resources/merge-resolve/.gitted/objects/cd/3e8d4aa06bdc781f264171030bc28f2b370fee [new file with mode: 0644]
tests/resources/merge-resolve/.gitted/objects/e2/6b8888956137218d8589368a3e606cf50fbb56 [new file with mode: 0644]
tests/resources/merge-resolve/.gitted/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 [new file with mode: 0644]
tests/resources/merge-resolve/.gitted/objects/f9/7da95f156121bea8f978623628f4cbdbf30b36 [new file with mode: 0644]
tests/resources/merge-resolve/.gitted/refs/heads/submodule_rename1 [new file with mode: 0644]
tests/resources/merge-resolve/.gitted/refs/heads/submodule_rename2 [new file with mode: 0644]

index 6f5c36b0a2548f9d807a440fcb054d98ea9b86d8..853bf2fa0ce6bb29f946cdbb4759cd3e39c22b12 100644 (file)
@@ -252,3 +252,25 @@ void test_merge_trees_renames__no_rename_index(void)
 
        git_index_free(index);
 }
+
+void test_merge_trees_renames__submodules(void)
+{
+       git_index *index;
+       git_merge_options *opts = NULL;
+
+       struct merge_index_entry merge_index_entries[] = {
+               { 0100644, "cd3e8d4aa06bdc781f264171030bc28f2b370fee", 0, ".gitmodules" },
+               { 0100644, "4dd1ef7569b18d92d93c0a35bb6b93049137b355", 1, "file.txt" },
+               { 0100644, "a2d8d1824c68541cca94ffb90f79291eba495921", 2, "file.txt" },
+               { 0100644, "63ec604d491161ddafdae4179843c26d54bd999a", 3, "file.txt" },
+               { 0160000, "0000000000000000000000000000000000000001", 1, "submodule1" },
+               { 0160000, "0000000000000000000000000000000000000002", 3, "submodule1" },
+               { 0160000, "0000000000000000000000000000000000000003", 0, "submodule2" },
+       };
+
+       cl_git_pass(merge_trees_from_branches(&index, repo,
+               "submodule_rename1", "submodule_rename2",
+               opts));
+       cl_assert(merge_test_index(index, merge_index_entries, 7));
+       git_index_free(index);
+}
diff --git a/tests/resources/merge-resolve/.gitted/objects/2a/f2d9bcbc73723ac988bb202d4397f72a6ca7a0 b/tests/resources/merge-resolve/.gitted/objects/2a/f2d9bcbc73723ac988bb202d4397f72a6ca7a0
new file mode 100644 (file)
index 0000000..0d65823
Binary files /dev/null and b/tests/resources/merge-resolve/.gitted/objects/2a/f2d9bcbc73723ac988bb202d4397f72a6ca7a0 differ
diff --git a/tests/resources/merge-resolve/.gitted/objects/37/f53a5a14f64e91089a39ea58e71c87d81df765 b/tests/resources/merge-resolve/.gitted/objects/37/f53a5a14f64e91089a39ea58e71c87d81df765
new file mode 100644 (file)
index 0000000..95327ed
--- /dev/null
@@ -0,0 +1 @@
+x\ 1\95\8eAjC1\fD»ö)´\ f\14Ù\91e}\b%\10z\83^Àß\96ã,þwp\1drý:\90\vtVÃÀ\9b\99Ô¶í6À\1dÃÇèªÀRBB\87Lh\97,\8b\12ª·9\84À+\17\ e\8b%r\18\9d¹Ç®û\80h1¨\95è¥\1c%\11£p\92"Åæ\94=¥ÙâIue\13\1f£¶\ eßù\19{\86\9fڶ߶ÃIgúrçëmÔÇú\99Úö\ 5\96\84ÙÏ-\a\a\9c23\9d/\87þ\93'|óæRã~U\98\8bk\8f{ªæ\ f£dJï
\ No newline at end of file
diff --git a/tests/resources/merge-resolve/.gitted/objects/4d/d1ef7569b18d92d93c0a35bb6b93049137b355 b/tests/resources/merge-resolve/.gitted/objects/4d/d1ef7569b18d92d93c0a35bb6b93049137b355
new file mode 100644 (file)
index 0000000..86a21ad
Binary files /dev/null and b/tests/resources/merge-resolve/.gitted/objects/4d/d1ef7569b18d92d93c0a35bb6b93049137b355 differ
diff --git a/tests/resources/merge-resolve/.gitted/objects/63/ec604d491161ddafdae4179843c26d54bd999a b/tests/resources/merge-resolve/.gitted/objects/63/ec604d491161ddafdae4179843c26d54bd999a
new file mode 100644 (file)
index 0000000..bc74da5
Binary files /dev/null and b/tests/resources/merge-resolve/.gitted/objects/63/ec604d491161ddafdae4179843c26d54bd999a differ
diff --git a/tests/resources/merge-resolve/.gitted/objects/68/f7c02064019d89e40e51d7776b6f67914420a2 b/tests/resources/merge-resolve/.gitted/objects/68/f7c02064019d89e40e51d7776b6f67914420a2
new file mode 100644 (file)
index 0000000..809a5b3
Binary files /dev/null and b/tests/resources/merge-resolve/.gitted/objects/68/f7c02064019d89e40e51d7776b6f67914420a2 differ
diff --git a/tests/resources/merge-resolve/.gitted/objects/94/29c05dd6f6f39fc567b4ce923b16df5d3d7a7a b/tests/resources/merge-resolve/.gitted/objects/94/29c05dd6f6f39fc567b4ce923b16df5d3d7a7a
new file mode 100644 (file)
index 0000000..d4d93f5
Binary files /dev/null and b/tests/resources/merge-resolve/.gitted/objects/94/29c05dd6f6f39fc567b4ce923b16df5d3d7a7a differ
diff --git a/tests/resources/merge-resolve/.gitted/objects/a1/07e18a58f38c46086c8f8f1dcd54c40154eeb6 b/tests/resources/merge-resolve/.gitted/objects/a1/07e18a58f38c46086c8f8f1dcd54c40154eeb6
new file mode 100644 (file)
index 0000000..598c6a7
--- /dev/null
@@ -0,0 +1,3 @@
+x\ 1\9d\8dK
+\ 21\10\ 5\14½\17$\93Ä|`\107.Ü{\81Îg\9c\ 6\93@&£×7^ÁZ=
+\1e\15jÎÔa²îÐ[J p\11Ñùà\83\91FH\fÎZï\ 5\17QIg\16#P\a\19î}­\r\83-Âc­y«\ 5æ4ìo]\9fÔ×Ý\9f\17\98\94Õúl¬Vpä\ 36ì¨öôï\9fÝ\v\17´ô¦\8dja_É\f?H
\ No newline at end of file
diff --git a/tests/resources/merge-resolve/.gitted/objects/a2/d8d1824c68541cca94ffb90f79291eba495921 b/tests/resources/merge-resolve/.gitted/objects/a2/d8d1824c68541cca94ffb90f79291eba495921
new file mode 100644 (file)
index 0000000..2d3d947
Binary files /dev/null and b/tests/resources/merge-resolve/.gitted/objects/a2/d8d1824c68541cca94ffb90f79291eba495921 differ
diff --git a/tests/resources/merge-resolve/.gitted/objects/bc/85d1aad435ff3705a8c30ace85f7542c5736cb b/tests/resources/merge-resolve/.gitted/objects/bc/85d1aad435ff3705a8c30ace85f7542c5736cb
new file mode 100644 (file)
index 0000000..ae529fe
Binary files /dev/null and b/tests/resources/merge-resolve/.gitted/objects/bc/85d1aad435ff3705a8c30ace85f7542c5736cb differ
diff --git a/tests/resources/merge-resolve/.gitted/objects/c8/26ef8b17b5cd2c4a0023f265f3a423b3aa0388 b/tests/resources/merge-resolve/.gitted/objects/c8/26ef8b17b5cd2c4a0023f265f3a423b3aa0388
new file mode 100644 (file)
index 0000000..b655d7c
Binary files /dev/null and b/tests/resources/merge-resolve/.gitted/objects/c8/26ef8b17b5cd2c4a0023f265f3a423b3aa0388 differ
diff --git a/tests/resources/merge-resolve/.gitted/objects/cd/3e8d4aa06bdc781f264171030bc28f2b370fee b/tests/resources/merge-resolve/.gitted/objects/cd/3e8d4aa06bdc781f264171030bc28f2b370fee
new file mode 100644 (file)
index 0000000..144225d
Binary files /dev/null and b/tests/resources/merge-resolve/.gitted/objects/cd/3e8d4aa06bdc781f264171030bc28f2b370fee differ
diff --git a/tests/resources/merge-resolve/.gitted/objects/e2/6b8888956137218d8589368a3e606cf50fbb56 b/tests/resources/merge-resolve/.gitted/objects/e2/6b8888956137218d8589368a3e606cf50fbb56
new file mode 100644 (file)
index 0000000..d4ec2b9
Binary files /dev/null and b/tests/resources/merge-resolve/.gitted/objects/e2/6b8888956137218d8589368a3e606cf50fbb56 differ
diff --git a/tests/resources/merge-resolve/.gitted/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 b/tests/resources/merge-resolve/.gitted/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
new file mode 100644 (file)
index 0000000..7112238
Binary files /dev/null and b/tests/resources/merge-resolve/.gitted/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 differ
diff --git a/tests/resources/merge-resolve/.gitted/objects/f9/7da95f156121bea8f978623628f4cbdbf30b36 b/tests/resources/merge-resolve/.gitted/objects/f9/7da95f156121bea8f978623628f4cbdbf30b36
new file mode 100644 (file)
index 0000000..d785511
--- /dev/null
@@ -0,0 +1 @@
+x\ 1\9d\8e1\ e\ 2!\10E­9\ 5½\89\81\85\81)\8c±±´ó\ 2Ã0¸[¬\18\96\8d×\17¯à¯^^ò\92Ïu]\97®§)\1ez\13Ñ\89\11²%ÊÞA).\1a dg\88\ 5¡Dð\13Ct\81\93zS\93W×dM\14\8b\ 4X\1c²\ f\ 6\ 3cÁb3gðì\8d\ 5/\92\82¢½Ïµé[þPËú1×u«/}\96a\7ft}.}ÞÓ\89ëzÑÖc\b\80Æ¡>\9a15ìxÙåß^Ýi\eµú\ 2êòHø
\ No newline at end of file
diff --git a/tests/resources/merge-resolve/.gitted/refs/heads/submodule_rename1 b/tests/resources/merge-resolve/.gitted/refs/heads/submodule_rename1
new file mode 100644 (file)
index 0000000..0ed914f
--- /dev/null
@@ -0,0 +1 @@
+f97da95f156121bea8f978623628f4cbdbf30b36
diff --git a/tests/resources/merge-resolve/.gitted/refs/heads/submodule_rename2 b/tests/resources/merge-resolve/.gitted/refs/heads/submodule_rename2
new file mode 100644 (file)
index 0000000..8e020cc
--- /dev/null
@@ -0,0 +1 @@
+37f53a5a14f64e91089a39ea58e71c87d81df765