Skip to content

Commit 49806e9

Browse files
author
Edward Thomson
committed
merge_trees: introduce test for submodule renames
Test that shows that submodules are incorrectly considered in renames, and `git_merge_trees` will fail to lookup the submodule as a blob.
1 parent b4bd5e8 commit 49806e9

17 files changed

+29
-0
lines changed

tests/merge/trees/renames.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,3 +252,25 @@ void test_merge_trees_renames__no_rename_index(void)
252252

253253
git_index_free(index);
254254
}
255+
256+
void test_merge_trees_renames__submodules(void)
257+
{
258+
git_index *index;
259+
git_merge_options *opts = NULL;
260+
261+
struct merge_index_entry merge_index_entries[] = {
262+
{ 0100644, "cd3e8d4aa06bdc781f264171030bc28f2b370fee", 0, ".gitmodules" },
263+
{ 0100644, "4dd1ef7569b18d92d93c0a35bb6b93049137b355", 1, "file.txt" },
264+
{ 0100644, "a2d8d1824c68541cca94ffb90f79291eba495921", 2, "file.txt" },
265+
{ 0100644, "63ec604d491161ddafdae4179843c26d54bd999a", 3, "file.txt" },
266+
{ 0160000, "0000000000000000000000000000000000000001", 1, "submodule1" },
267+
{ 0160000, "0000000000000000000000000000000000000002", 3, "submodule1" },
268+
{ 0160000, "0000000000000000000000000000000000000003", 0, "submodule2" },
269+
};
270+
271+
cl_git_pass(merge_trees_from_branches(&index, repo,
272+
"submodule_rename1", "submodule_rename2",
273+
opts));
274+
cl_assert(merge_test_index(index, merge_index_entries, 7));
275+
git_index_free(index);
276+
}
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
x��AjC1 D��)�ّe}%z�^�ߖ�,�wpr�:� tV����Զ�6�����RBB�Lh�,���9��+�%r��Ǯ��h1���%�p�"��=���Iue����{��ڶ߶�Ig�r��m����������-�23�/���'|��R�~U��k�{���dJ�
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

tests/resources/merge-resolve/.gitted/objects/a1/07e18a58f38c46086c8f8f1dcd54c40154eeb6

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
x��K
2+
1]��$��|`7.�{��g��@&��7^�Z=
3+
j��a���[J p�����FH �Z�QIg#P4��}�n�-�c�y��4�o]���ݟB�����l�Vp�6����� u�����ja_� ?H
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)