diff options
author | nulltoken <emeric.fermas@gmail.com> | 2013-05-13 23:57:37 +0400 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2013-05-16 00:41:30 +0400 |
commit | 1fed6b07f0722c8b4349ff3709a49df3d3c9ae61 (patch) | |
tree | 2c1b791be59a061bebab3392575a0b90dc323b23 /tests-clar/merge | |
parent | f0ab73720a4e7a9b37c901a27519ea65eafeb8a6 (diff) |
Fix trailing whitespaces
Diffstat (limited to 'tests-clar/merge')
-rw-r--r-- | tests-clar/merge/merge_helpers.c | 100 | ||||
-rw-r--r-- | tests-clar/merge/trees/automerge.c | 28 | ||||
-rw-r--r-- | tests-clar/merge/trees/modeconflict.c | 4 | ||||
-rw-r--r-- | tests-clar/merge/trees/renames.c | 25 | ||||
-rw-r--r-- | tests-clar/merge/trees/treediff.c | 105 | ||||
-rw-r--r-- | tests-clar/merge/trees/trivial.c | 38 |
6 files changed, 149 insertions, 151 deletions
diff --git a/tests-clar/merge/merge_helpers.c b/tests-clar/merge/merge_helpers.c index 71bb96781..bc31b1f44 100644 --- a/tests-clar/merge/merge_helpers.c +++ b/tests-clar/merge/merge_helpers.c @@ -56,11 +56,11 @@ void merge__dump_index_entries(git_vector *index_entries) { size_t i; const git_index_entry *index_entry; - + printf ("\nINDEX [%d]:\n", (int)index_entries->length); for (i = 0; i < index_entries->length; i++) { index_entry = index_entries->contents[i]; - + printf("%o ", index_entry->mode); printf("%s ", git_oid_allocfmt(&index_entry->oid)); printf("%d ", git_index_entry_stage(index_entry)); @@ -77,7 +77,7 @@ void merge__dump_names(git_index *index) for (i = 0; i < git_index_name_entrycount(index); i++) { conflict_name = git_index_name_get_byindex(index, i); - + printf("%s %s %s\n", conflict_name->ancestor, conflict_name->ours, conflict_name->theirs); } printf("\n"); @@ -91,7 +91,7 @@ void merge__dump_reuc(git_index *index) printf ("\nREUC:\n"); for (i = 0; i < git_index_reuc_entrycount(index); i++) { reuc = git_index_reuc_get_byindex(index, i); - + printf("%s ", reuc->path); printf("%o ", reuc->mode[0]); printf("%s\n", git_oid_allocfmt(&reuc->oid[0])); @@ -114,18 +114,18 @@ static int index_entry_eq_merge_index_entry(const struct merge_index_entry *expe test_oid = 1; } else test_oid = 0; - + if (actual->mode != expected->mode || (test_oid && git_oid_cmp(&actual->oid, &expected_oid) != 0) || git_index_entry_stage(actual) != expected->stage) return 0; - + if (actual->mode == 0 && (actual->path != NULL || strlen(expected->path) > 0)) return 0; if (actual->mode != 0 && (strcmp(actual->path, expected->path) != 0)) return 0; - + return 1; } @@ -133,7 +133,7 @@ static int name_entry_eq(const char *expected, const char *actual) { if (strlen(expected) == 0) return (actual == NULL) ? 1 : 0; - + return (strcmp(expected, actual) == 0) ? 1 : 0; } @@ -153,11 +153,11 @@ static int index_conflict_data_eq_merge_diff(const struct merge_index_conflict_d !index_entry_eq_merge_index_entry(&expected->ours.entry, &actual->our_entry) || !index_entry_eq_merge_index_entry(&expected->theirs.entry, &actual->their_entry)) return 0; - + if (expected->ours.status != actual->our_status || expected->theirs.status != actual->their_status) return 0; - + return 1; } @@ -165,48 +165,48 @@ int merge_test_merge_conflicts(git_vector *conflicts, const struct merge_index_c { git_merge_diff *actual; size_t i; - + if (conflicts->length != expected_len) return 0; for (i = 0; i < expected_len; i++) { actual = conflicts->contents[i]; - + if (!index_conflict_data_eq_merge_diff(&expected[i], actual)) return 0; } - return 1; + return 1; } int merge_test_index(git_index *index, const struct merge_index_entry expected[], size_t expected_len) { - size_t i; - const git_index_entry *index_entry; - + size_t i; + const git_index_entry *index_entry; + /* dump_index_entries(&index->entries); */ - if (git_index_entrycount(index) != expected_len) - return 0; - - for (i = 0; i < expected_len; i++) { - if ((index_entry = git_index_get_byindex(index, i)) == NULL) - return 0; - + if (git_index_entrycount(index) != expected_len) + return 0; + + for (i = 0; i < expected_len; i++) { + if ((index_entry = git_index_get_byindex(index, i)) == NULL) + return 0; + if (!index_entry_eq_merge_index_entry(&expected[i], index_entry)) return 0; - } - - return 1; + } + + return 1; } int merge_test_names(git_index *index, const struct merge_name_entry expected[], size_t expected_len) { size_t i; const git_index_name_entry *name_entry; - + /* dump_names(index); */ @@ -221,26 +221,26 @@ int merge_test_names(git_index *index, const struct merge_name_entry expected[], if (! name_entry_eq_merge_name_entry(&expected[i], name_entry)) return 0; } - + return 1; } int merge_test_reuc(git_index *index, const struct merge_reuc_entry expected[], size_t expected_len) { - size_t i; + size_t i; const git_index_reuc_entry *reuc_entry; - git_oid expected_oid; - + git_oid expected_oid; + /* dump_reuc(index); */ - - if (git_index_reuc_entrycount(index) != expected_len) - return 0; - - for (i = 0; i < expected_len; i++) { - if ((reuc_entry = git_index_reuc_get_byindex(index, i)) == NULL) - return 0; + + if (git_index_reuc_entrycount(index) != expected_len) + return 0; + + for (i = 0; i < expected_len; i++) { + if ((reuc_entry = git_index_reuc_get_byindex(index, i)) == NULL) + return 0; if (strcmp(reuc_entry->path, expected[i].path) != 0 || reuc_entry->mode[0] != expected[i].ancestor_mode || @@ -268,19 +268,19 @@ int merge_test_reuc(git_index *index, const struct merge_reuc_entry expected[], if (git_oid_cmp(&reuc_entry->oid[2], &expected_oid) != 0) return 0; } - } - - return 1; + } + + return 1; } int dircount(void *payload, git_buf *pathbuf) { int *entries = payload; size_t len = git_buf_len(pathbuf); - + if (len < 5 || strcmp(pathbuf->ptr + (git_buf_len(pathbuf) - 5), "/.git") != 0) (*entries)++; - + return 0; } @@ -289,22 +289,22 @@ int merge_test_workdir(git_repository *repo, const struct merge_index_entry expe size_t actual_len = 0, i; git_oid actual_oid, expected_oid; git_buf wd = GIT_BUF_INIT; - - git_buf_puts(&wd, repo->workdir); + + git_buf_puts(&wd, repo->workdir); git_path_direach(&wd, dircount, &actual_len); - + if (actual_len != expected_len) return 0; - + for (i = 0; i < expected_len; i++) { git_blob_create_fromworkdir(&actual_oid, repo, expected[i].path); git_oid_fromstr(&expected_oid, expected[i].oid_str); - + if (git_oid_cmp(&actual_oid, &expected_oid) != 0) return 0; } - + git_buf_free(&wd); - + return 1; } diff --git a/tests-clar/merge/trees/automerge.c b/tests-clar/merge/trees/automerge.c index 7592a926e..04a7beff6 100644 --- a/tests-clar/merge/trees/automerge.c +++ b/tests-clar/merge/trees/automerge.c @@ -93,7 +93,7 @@ void test_merge_trees_automerge__automerge(void) const git_index_entry *entry; git_merge_tree_opts opts = GIT_MERGE_TREE_OPTS_INIT; git_blob *blob; - + struct merge_index_entry merge_index_entries[] = { ADDED_IN_MASTER_INDEX_ENTRY, AUTOMERGEABLE_INDEX_ENTRY, @@ -105,7 +105,7 @@ void test_merge_trees_automerge__automerge(void) { 0100644, "2bd0a343aeef7a2cf0d158478966a6e587ff3863", 3, "conflicting.txt" }, UNCHANGED_INDEX_ENTRY, - }; + }; struct merge_reuc_entry merge_reuc_entries[] = { AUTOMERGEABLE_REUC_ENTRY, @@ -120,10 +120,10 @@ void test_merge_trees_automerge__automerge(void) cl_assert((entry = git_index_get_bypath(index, "automergeable.txt", 0)) != NULL); cl_assert(entry->file_size == strlen(AUTOMERGEABLE_MERGED_FILE)); - + cl_git_pass(git_object_lookup((git_object **)&blob, repo, &entry->oid, GIT_OBJ_BLOB)); cl_assert(memcmp(git_blob_rawcontent(blob), AUTOMERGEABLE_MERGED_FILE, entry->file_size) == 0); - + git_index_free(index); git_blob_free(blob); } @@ -132,7 +132,7 @@ void test_merge_trees_automerge__favor_ours(void) { git_index *index; git_merge_tree_opts opts = GIT_MERGE_TREE_OPTS_INIT; - + struct merge_index_entry merge_index_entries[] = { ADDED_IN_MASTER_INDEX_ENTRY, AUTOMERGEABLE_INDEX_ENTRY, @@ -148,9 +148,9 @@ void test_merge_trees_automerge__favor_ours(void) REMOVED_IN_BRANCH_REUC_ENTRY, REMOVED_IN_MASTER_REUC_ENTRY, }; - + opts.automerge_flags = GIT_MERGE_AUTOMERGE_FAVOR_OURS; - + cl_git_pass(merge_trees_from_branches(&index, repo, "master", THEIRS_AUTOMERGE_BRANCH, &opts)); cl_assert(merge_test_index(index, merge_index_entries, 6)); @@ -163,7 +163,7 @@ void test_merge_trees_automerge__favor_theirs(void) { git_index *index; git_merge_tree_opts opts = GIT_MERGE_TREE_OPTS_INIT; - + struct merge_index_entry merge_index_entries[] = { ADDED_IN_MASTER_INDEX_ENTRY, AUTOMERGEABLE_INDEX_ENTRY, @@ -181,12 +181,12 @@ void test_merge_trees_automerge__favor_theirs(void) }; opts.automerge_flags = GIT_MERGE_AUTOMERGE_FAVOR_THEIRS; - + cl_git_pass(merge_trees_from_branches(&index, repo, "master", THEIRS_AUTOMERGE_BRANCH, &opts)); cl_assert(merge_test_index(index, merge_index_entries, 6)); cl_assert(merge_test_reuc(index, merge_reuc_entries, 4)); - + git_index_free(index); } @@ -194,7 +194,7 @@ void test_merge_trees_automerge__unrelated(void) { git_index *index; git_merge_tree_opts opts = GIT_MERGE_TREE_OPTS_INIT; - + struct merge_index_entry merge_index_entries[] = { { 0100644, "233c0919c998ed110a4b6ff36f353aec8b713487", 0, "added-in-master.txt" }, { 0100644, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf", 2, "automergeable.txt" }, @@ -208,10 +208,10 @@ void test_merge_trees_automerge__unrelated(void) { 0100644, "dfe3f22baa1f6fce5447901c3086bae368de6bdd", 0, "removed-in-branch.txt" }, { 0100644, "c8f06f2e3bb2964174677e91f0abead0e43c9e5d", 0, "unchanged.txt" }, }; - + cl_git_pass(merge_trees_from_branches(&index, repo, "master", THEIRS_UNRELATED_BRANCH, &opts)); - + cl_assert(merge_test_index(index, merge_index_entries, 11)); - + git_index_free(index); } diff --git a/tests-clar/merge/trees/modeconflict.c b/tests-clar/merge/trees/modeconflict.c index 0661ce5b3..d858b8f66 100644 --- a/tests-clar/merge/trees/modeconflict.c +++ b/tests-clar/merge/trees/modeconflict.c @@ -27,7 +27,7 @@ void test_merge_trees_modeconflict__cleanup(void) void test_merge_trees_modeconflict__df_conflict(void) { git_index *index; - + struct merge_index_entry merge_index_entries[] = { { 0100644, "49130a28ef567af9a6a6104c38773fedfa5f9742", 2, "dir-10" }, { 0100644, "6c06dcd163587c2cc18be44857e0b71116382aeb", 3, "dir-10" }, @@ -49,7 +49,7 @@ void test_merge_trees_modeconflict__df_conflict(void) { 0100644, "e49f917b448d1340b31d76e54ba388268fd4c922", 0, "file-4/new" }, { 0100644, "cab2cf23998b40f1af2d9d9a756dc9e285a8df4b", 2, "file-5/new" }, { 0100644, "f5504f36e6f4eb797a56fc5bac6c6c7f32969bf2", 3, "file-5/new" }, - }; + }; cl_git_pass(merge_trees_from_branches(&index, repo, DF_SIDE1_BRANCH, DF_SIDE2_BRANCH, NULL)); diff --git a/tests-clar/merge/trees/renames.c b/tests-clar/merge/trees/renames.c index dc0564bc4..427b6bd8f 100644 --- a/tests-clar/merge/trees/renames.c +++ b/tests-clar/merge/trees/renames.c @@ -72,14 +72,14 @@ void test_merge_trees_renames__index(void) { 0100644, "b42712cfe99a1a500b2a51fe984e0b8a7702ba11", 2, "7-both-renamed.txt" }, { 0100644, "b69fe837e4cecfd4c9a40cdca7c138468687df07", 3, "7-both-renamed.txt" }, }; - + struct merge_name_entry merge_name_entries[] = { { "3a-renamed-in-ours-deleted-in-theirs.txt", "3a-newname-in-ours-deleted-in-theirs.txt", "" }, - + { "3b-renamed-in-theirs-deleted-in-ours.txt", "", @@ -97,7 +97,7 @@ void test_merge_trees_renames__index(void) "", "4b-newname-in-theirs-added-in-ours.txt", }, - + { "5a-renamed-in-ours-added-in-theirs.txt", "5a-newname-in-ours-added-in-theirs.txt", @@ -115,13 +115,13 @@ void test_merge_trees_renames__index(void) "6-both-renamed-1-to-2-ours.txt", "6-both-renamed-1-to-2-theirs.txt", }, - + { "7-both-renamed-side-1.txt", "7-both-renamed.txt", "7-both-renamed-side-1.txt", }, - + { "7-both-renamed-side-2.txt", "7-both-renamed-side-2.txt", @@ -159,7 +159,7 @@ void test_merge_trees_renames__index(void) "", "", "241a1005cd9b980732741b74385b891142bcba28" }, - + { "1b-newname-in-theirs.txt", 0, 0, 0100644, "", @@ -194,11 +194,11 @@ void test_merge_trees_renames__index(void) cl_git_pass(merge_trees_from_branches(&index, repo, BRANCH_RENAME_OURS, BRANCH_RENAME_THEIRS, opts)); - + cl_assert(merge_test_index(index, merge_index_entries, 41)); cl_assert(merge_test_names(index, merge_name_entries, 9)); cl_assert(merge_test_reuc(index, merge_reuc_entries, 10)); - + git_index_free(index); } @@ -206,7 +206,7 @@ void test_merge_trees_renames__no_rename_index(void) { git_index *index; git_merge_tree_opts opts = GIT_MERGE_TREE_OPTS_INIT; - + struct merge_index_entry merge_index_entries[] = { { 0100644, "68c6c84b091926c7d90aa6a79b2bc3bb6adccd8e", 0, "0a-no-change.txt" }, { 0100644, "f0ce2b8e4986084d9b308fb72709e414c23eb5e6", 0, "0b-duplicated-in-ours.txt" }, @@ -241,13 +241,12 @@ void test_merge_trees_renames__no_rename_index(void) { 0100644, "b42712cfe99a1a500b2a51fe984e0b8a7702ba11", 2, "7-both-renamed.txt" }, { 0100644, "b69fe837e4cecfd4c9a40cdca7c138468687df07", 3, "7-both-renamed.txt" }, }; - + cl_git_pass(merge_trees_from_branches(&index, repo, BRANCH_RENAME_OURS, BRANCH_RENAME_THEIRS, &opts)); - + cl_assert(merge_test_index(index, merge_index_entries, 32)); - + git_index_free(index); } - diff --git a/tests-clar/merge/trees/treediff.c b/tests-clar/merge/trees/treediff.c index 06ea94e0d..357859df3 100644 --- a/tests-clar/merge/trees/treediff.c +++ b/tests-clar/merge/trees/treediff.c @@ -58,37 +58,37 @@ static void test_find_differences( opts.metric->similarity = git_diff_find_similar__calc_similarity; opts.metric->payload = (void *)GIT_HASHSIG_SMART_WHITESPACE; - cl_git_pass(git_oid_fromstr(&ancestor_oid, ancestor_oidstr)); - cl_git_pass(git_oid_fromstr(&ours_oid, ours_oidstr)); - cl_git_pass(git_oid_fromstr(&theirs_oid, theirs_oidstr)); - - cl_git_pass(git_tree_lookup(&ancestor_tree, repo, &ancestor_oid)); - cl_git_pass(git_tree_lookup(&ours_tree, repo, &ours_oid)); - cl_git_pass(git_tree_lookup(&theirs_tree, repo, &theirs_oid)); - + cl_git_pass(git_oid_fromstr(&ancestor_oid, ancestor_oidstr)); + cl_git_pass(git_oid_fromstr(&ours_oid, ours_oidstr)); + cl_git_pass(git_oid_fromstr(&theirs_oid, theirs_oidstr)); + + cl_git_pass(git_tree_lookup(&ancestor_tree, repo, &ancestor_oid)); + cl_git_pass(git_tree_lookup(&ours_tree, repo, &ours_oid)); + cl_git_pass(git_tree_lookup(&theirs_tree, repo, &theirs_oid)); + cl_git_pass(git_merge_diff_list__find_differences(merge_diff_list, ancestor_tree, ours_tree, theirs_tree)); cl_git_pass(git_merge_diff_list__find_renames(repo, merge_diff_list, &opts)); /* dump_merge_index(merge_index); */ - - cl_assert(treediff_conflict_data_len == merge_diff_list->conflicts.length); + + cl_assert(treediff_conflict_data_len == merge_diff_list->conflicts.length); cl_assert(merge_test_merge_conflicts(&merge_diff_list->conflicts, treediff_conflict_data, treediff_conflict_data_len)); - git_tree_free(ancestor_tree); - git_tree_free(ours_tree); - git_tree_free(theirs_tree); - + git_tree_free(ancestor_tree); + git_tree_free(ours_tree); + git_tree_free(theirs_tree); + git_merge_diff_list__free(merge_diff_list); - + git__free(opts.metric); } void test_merge_trees_treediff__simple(void) { - struct merge_index_conflict_data treediff_conflict_data[] = { + struct merge_index_conflict_data treediff_conflict_data[] = { { { { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED }, { { 0100644, "233c0919c998ed110a4b6ff36f353aec8b713487", 0, "added-in-master.txt" }, GIT_DELTA_ADDED }, @@ -96,41 +96,41 @@ void test_merge_trees_treediff__simple(void) GIT_MERGE_DIFF_NONE }, - { + { { { 0100644, "6212c31dab5e482247d7977e4f0dd3601decf13b", 0, "automergeable.txt" }, GIT_DELTA_UNMODIFIED }, { { 0100644, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf", 0, "automergeable.txt" }, GIT_DELTA_MODIFIED }, { { 0100644, "058541fc37114bfc1dddf6bd6bffc7fae5c2e6fe", 0, "automergeable.txt" }, GIT_DELTA_MODIFIED }, GIT_MERGE_DIFF_BOTH_MODIFIED }, - + { { { 0100644, "ab6c44a2e84492ad4b41bb6bac87353e9d02ac8b", 0, "changed-in-branch.txt" }, GIT_DELTA_UNMODIFIED }, { { 0100644, "ab6c44a2e84492ad4b41bb6bac87353e9d02ac8b", 0, "changed-in-branch.txt" }, GIT_DELTA_UNMODIFIED }, { { 0100644, "4eb04c9e79e88f6640d01ff5b25ca2a60764f216", 0, "changed-in-branch.txt" }, GIT_DELTA_MODIFIED }, GIT_MERGE_DIFF_NONE }, - + { { { 0100644, "ab6c44a2e84492ad4b41bb6bac87353e9d02ac8b", 0, "changed-in-master.txt" }, GIT_DELTA_UNMODIFIED }, { { 0100644, "11deab00b2d3a6f5a3073988ac050c2d7b6655e2", 0, "changed-in-master.txt" }, GIT_DELTA_MODIFIED }, { { 0100644, "ab6c44a2e84492ad4b41bb6bac87353e9d02ac8b", 0, "changed-in-master.txt" }, GIT_DELTA_UNMODIFIED }, GIT_MERGE_DIFF_NONE }, - + { { { 0100644, "d427e0b2e138501a3d15cc376077a3631e15bd46", 0, "conflicting.txt" }, GIT_DELTA_UNMODIFIED }, { { 0100644, "4e886e602529caa9ab11d71f86634bd1b6e0de10", 0, "conflicting.txt" }, GIT_DELTA_MODIFIED }, { { 0100644, "2bd0a343aeef7a2cf0d158478966a6e587ff3863", 0, "conflicting.txt" }, GIT_DELTA_MODIFIED }, GIT_MERGE_DIFF_BOTH_MODIFIED }, - + { { { 0100644, "dfe3f22baa1f6fce5447901c3086bae368de6bdd", 0, "removed-in-branch.txt" }, GIT_DELTA_UNMODIFIED }, { { 0100644, "dfe3f22baa1f6fce5447901c3086bae368de6bdd", 0, "removed-in-branch.txt" }, GIT_DELTA_UNMODIFIED }, { { 0, "", 0, "" }, GIT_DELTA_DELETED }, GIT_MERGE_DIFF_NONE }, - + { { { 0100644, "5c3b68a71fc4fa5d362fd3875e53137c6a5ab7a5", 0, "removed-in-master.txt" }, GIT_DELTA_UNMODIFIED }, { { 0, "", 0, "" }, GIT_DELTA_DELETED }, @@ -138,13 +138,13 @@ void test_merge_trees_treediff__simple(void) GIT_MERGE_DIFF_NONE }, }; - + test_find_differences(TREE_OID_ANCESTOR, TREE_OID_MASTER, TREE_OID_BRANCH, treediff_conflict_data, 7); } void test_merge_trees_treediff__df_conflicts(void) { - struct merge_index_conflict_data treediff_conflict_data[] = { + struct merge_index_conflict_data treediff_conflict_data[] = { { { { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED }, { { 0100644, "49130a28ef567af9a6a6104c38773fedfa5f9742", 0, "dir-10" }, GIT_DELTA_ADDED }, @@ -158,7 +158,7 @@ void test_merge_trees_treediff__df_conflicts(void) { { 0, "", 0, "" }, GIT_DELTA_DELETED }, GIT_MERGE_DIFF_BOTH_DELETED, }, - + { { { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED }, { { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED }, @@ -172,7 +172,7 @@ void test_merge_trees_treediff__df_conflicts(void) { { 0, "", 0, "" }, GIT_DELTA_DELETED }, GIT_MERGE_DIFF_NONE, }, - + { { { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED }, { { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED }, @@ -186,7 +186,7 @@ void test_merge_trees_treediff__df_conflicts(void) { { 0, "", 0, "" }, GIT_DELTA_DELETED }, GIT_MERGE_DIFF_DF_CHILD, }, - + { { { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED }, { { 0100644, "e9ad6ec3e38364a3d07feda7c4197d4d845c53b5", 0, "dir-8" }, GIT_DELTA_ADDED }, @@ -200,7 +200,7 @@ void test_merge_trees_treediff__df_conflicts(void) { { 0100644, "f20c9063fa0bda9a397c96947a7b687305c49753", 0, "dir-8/file.txt" }, GIT_DELTA_UNMODIFIED }, GIT_MERGE_DIFF_NONE, }, - + { { { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED }, { { 0100644, "3ef4d30382ca33fdeba9fda895a99e0891ba37aa", 0, "dir-9" }, GIT_DELTA_ADDED }, @@ -235,7 +235,7 @@ void test_merge_trees_treediff__df_conflicts(void) { { 0, "", 0, "" }, GIT_DELTA_DELETED }, GIT_MERGE_DIFF_DIRECTORY_FILE, }, - + { { { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED }, { { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED }, @@ -277,7 +277,7 @@ void test_merge_trees_treediff__df_conflicts(void) { { 0, "", 0, "" }, GIT_DELTA_DELETED }, GIT_MERGE_DIFF_BOTH_DELETED, }, - + { { { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED }, { { 0100644, "cab2cf23998b40f1af2d9d9a756dc9e285a8df4b", 0, "file-5/new" }, GIT_DELTA_ADDED }, @@ -285,7 +285,7 @@ void test_merge_trees_treediff__df_conflicts(void) GIT_MERGE_DIFF_BOTH_ADDED, }, }; - + test_find_differences(TREE_OID_DF_ANCESTOR, TREE_OID_DF_SIDE1, TREE_OID_DF_SIDE2, treediff_conflict_data, 20); } @@ -298,7 +298,7 @@ void test_merge_trees_treediff__strict_renames(void) { { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED }, GIT_MERGE_DIFF_NONE, }, - + { { { 0100644, "6212c31dab5e482247d7977e4f0dd3601decf13b", 0, "automergeable.txt" }, GIT_DELTA_UNMODIFIED }, { { 0100644, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf", 0, "automergeable.txt" }, GIT_DELTA_MODIFIED }, @@ -348,8 +348,8 @@ void test_merge_trees_treediff__strict_renames(void) GIT_MERGE_DIFF_NONE, }, }; - - test_find_differences(TREE_OID_ANCESTOR, TREE_OID_MASTER, TREE_OID_RENAMES1, treediff_conflict_data, 8); + + test_find_differences(TREE_OID_ANCESTOR, TREE_OID_MASTER, TREE_OID_RENAMES1, treediff_conflict_data, 8); } void test_merge_trees_treediff__rename_conflicts(void) @@ -375,7 +375,7 @@ void test_merge_trees_treediff__rename_conflicts(void) { { 0100644, "2f56120107d680129a5d9791b521cb1e73a2ed31", 0, "0c-duplicated-in-theirs.txt" }, GIT_DELTA_ADDED }, GIT_MERGE_DIFF_NONE, }, - + { { { 0100644, "2f56120107d680129a5d9791b521cb1e73a2ed31", 0, "0c-rewritten-in-theirs.txt" }, GIT_DELTA_UNMODIFIED }, { { 0100644, "efc9121fdedaf08ba180b53ebfbcf71bd488ed09", 0, "0c-rewritten-in-theirs.txt" }, GIT_DELTA_MODIFIED }, @@ -389,21 +389,21 @@ void test_merge_trees_treediff__rename_conflicts(void) { { 0100644, "0d872f8e871a30208305978ecbf9e66d864f1638", 0, "1a-renamed-in-ours-edited-in-theirs.txt" }, GIT_DELTA_MODIFIED }, GIT_MERGE_DIFF_RENAMED_MODIFIED, }, - + { { { 0100644, "d0d4594e16f2e19107e3fa7ea63e7aaaff305ffb", 0, "1a-renamed-in-ours.txt" }, GIT_DELTA_UNMODIFIED }, { { 0100644, "d0d4594e16f2e19107e3fa7ea63e7aaaff305ffb", 0, "1a-newname-in-ours.txt" }, GIT_DELTA_RENAMED }, { { 0100644, "d0d4594e16f2e19107e3fa7ea63e7aaaff305ffb", 0, "1a-renamed-in-ours.txt" }, GIT_DELTA_UNMODIFIED }, GIT_MERGE_DIFF_NONE, }, - + { { { 0100644, "241a1005cd9b980732741b74385b891142bcba28", 0, "1b-renamed-in-theirs-edited-in-ours.txt" }, GIT_DELTA_UNMODIFIED }, { { 0100644, "ed9523e62e453e50dd9be1606af19399b96e397a", 0, "1b-renamed-in-theirs-edited-in-ours.txt" }, GIT_DELTA_MODIFIED }, { { 0100644, "241a1005cd9b980732741b74385b891142bcba28", 0, "1b-newname-in-theirs-edited-in-ours.txt" }, GIT_DELTA_RENAMED }, GIT_MERGE_DIFF_RENAMED_MODIFIED, }, - + { { { 0100644, "2b5f1f181ee3b58ea751f5dd5d8f9b445520a136", 0, "1b-renamed-in-theirs.txt" }, GIT_DELTA_UNMODIFIED }, { { 0100644, "2b5f1f181ee3b58ea751f5dd5d8f9b445520a136", 0, "1b-renamed-in-theirs.txt" }, GIT_DELTA_UNMODIFIED }, @@ -417,28 +417,28 @@ void test_merge_trees_treediff__rename_conflicts(void) { { 0100644, "178940b450f238a56c0d75b7955cb57b38191982", 0, "2-newname-in-both.txt" }, GIT_DELTA_RENAMED }, GIT_MERGE_DIFF_BOTH_RENAMED, }, - + { { { 0100644, "18cb316b1cefa0f8a6946f0e201a8e1a6f845ab9", 0, "3a-renamed-in-ours-deleted-in-theirs.txt" }, GIT_DELTA_UNMODIFIED }, { { 0100644, "18cb316b1cefa0f8a6946f0e201a8e1a6f845ab9", 0, "3a-newname-in-ours-deleted-in-theirs.txt" }, GIT_DELTA_RENAMED }, { { 0, "", 0, "" }, GIT_DELTA_DELETED }, GIT_MERGE_DIFF_RENAMED_DELETED, }, - + { { { 0100644, "36219b49367146cb2e6a1555b5a9ebd4d0328495", 0, "3b-renamed-in-theirs-deleted-in-ours.txt" }, GIT_DELTA_UNMODIFIED }, { { 0, "", 0, "" }, GIT_DELTA_DELETED }, { { 0100644, "36219b49367146cb2e6a1555b5a9ebd4d0328495", 0, "3b-newname-in-theirs-deleted-in-ours.txt" }, GIT_DELTA_RENAMED }, GIT_MERGE_DIFF_RENAMED_DELETED, }, - + { { { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED }, { { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED }, { { 0100644, "8b5b53cb2aa9ceb1139f5312fcfa3cc3c5a47c9a", 0, "4a-newname-in-ours-added-in-theirs.txt" }, GIT_DELTA_ADDED }, GIT_MERGE_DIFF_RENAMED_ADDED, - }, - + }, + { { { 0100644, "227792b52aaa0b238bea00ec7e509b02623f168c", 0, "4a-renamed-in-ours-added-in-theirs.txt" }, GIT_DELTA_UNMODIFIED }, { { 0100644, "227792b52aaa0b238bea00ec7e509b02623f168c", 0, "4a-newname-in-ours-added-in-theirs.txt" }, GIT_DELTA_RENAMED }, @@ -459,21 +459,21 @@ void test_merge_trees_treediff__rename_conflicts(void) { { 0100644, "98d52d07c0b0bbf2b46548f6aa521295c2cb55db", 0, "4b-newname-in-theirs-added-in-ours.txt" }, GIT_DELTA_RENAMED }, GIT_MERGE_DIFF_RENAMED_ADDED, }, - + { { { 0100644, "d8fa77b6833082c1ea36b7828a582d4c43882450", 0, "5-both-renamed-1-to-2.txt" }, GIT_DELTA_UNMODIFIED }, { { 0100644, "d8fa77b6833082c1ea36b7828a582d4c43882450", 0, "5-both-renamed-1-to-2-ours.txt" }, GIT_DELTA_RENAMED }, { { 0100644, "d8fa77b6833082c1ea36b7828a582d4c43882450", 0, "5-both-renamed-1-to-2-theirs.txt" }, GIT_DELTA_RENAMED }, GIT_MERGE_DIFF_BOTH_RENAMED_1_TO_2, }, - + { { { 0100644, "b42712cfe99a1a500b2a51fe984e0b8a7702ba11", 0, "6-both-renamed-side-1.txt" }, GIT_DELTA_UNMODIFIED }, { { 0100644, "b42712cfe99a1a500b2a51fe984e0b8a7702ba11", 0, "6-both-renamed.txt" }, GIT_DELTA_RENAMED }, { { 0100644, "b42712cfe99a1a500b2a51fe984e0b8a7702ba11", 0, "6-both-renamed-side-1.txt" }, GIT_DELTA_UNMODIFIED }, GIT_MERGE_DIFF_BOTH_RENAMED_2_TO_1, }, - + { { { 0100644, "b69fe837e4cecfd4c9a40cdca7c138468687df07", 0, "6-both-renamed-side-2.txt" }, GIT_DELTA_UNMODIFIED }, { { 0100644, "b69fe837e4cecfd4c9a40cdca7c138468687df07", 0, "6-both-renamed-side-2.txt" }, GIT_DELTA_UNMODIFIED }, @@ -481,8 +481,7 @@ void test_merge_trees_treediff__rename_conflicts(void) GIT_MERGE_DIFF_BOTH_RENAMED_2_TO_1, }, }; - - test_find_differences(TREE_OID_RENAME_CONFLICT_ANCESTOR, + test_find_differences(TREE_OID_RENAME_CONFLICT_ANCESTOR, TREE_OID_RENAME_CONFLICT_OURS, TREE_OID_RENAME_CONFLICT_THEIRS, treediff_conflict_data, 18); } @@ -494,7 +493,7 @@ void test_merge_trees_treediff__best_renames(void) { { 0100644, "233c0919c998ed110a4b6ff36f353aec8b713487", 0, "added-in-master.txt" }, GIT_DELTA_ADDED }, { { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED }, GIT_MERGE_DIFF_NONE, - }, + }, { { { 0100644, "6212c31dab5e482247d7977e4f0dd3601decf13b", 0, "automergeable.txt" }, GIT_DELTA_UNMODIFIED }, @@ -502,7 +501,7 @@ void test_merge_trees_treediff__best_renames(void) { { 0100644, "45299c1ca5e07bba1fd90843056fb559f96b1f5a", 0, "renamed-90.txt" }, GIT_DELTA_RENAMED }, GIT_MERGE_DIFF_RENAMED_MODIFIED, }, - + { { { 0100644, "ab6c44a2e84492ad4b41bb6bac87353e9d02ac8b", 0, "changed-in-master.txt" }, GIT_DELTA_UNMODIFIED }, { { 0100644, "11deab00b2d3a6f5a3073988ac050c2d7b6655e2", 0, "changed-in-master.txt" }, GIT_DELTA_MODIFIED }, @@ -523,7 +522,7 @@ void test_merge_trees_treediff__best_renames(void) { { 0100644, "5c3b68a71fc4fa5d362fd3875e53137c6a5ab7a5", 0, "removed-in-master.txt" }, GIT_DELTA_UNMODIFIED }, GIT_MERGE_DIFF_MODIFIED_DELETED, }, - + { { { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED }, { { 0, "", 0, "" }, GIT_DELTA_UNMODIFIED }, @@ -538,6 +537,6 @@ void test_merge_trees_treediff__best_renames(void) GIT_MERGE_DIFF_NONE, }, }; - - test_find_differences(TREE_OID_ANCESTOR, TREE_OID_MASTER, TREE_OID_RENAMES2, treediff_conflict_data, 7); + + test_find_differences(TREE_OID_ANCESTOR, TREE_OID_MASTER, TREE_OID_RENAMES2, treediff_conflict_data, 7); } diff --git a/tests-clar/merge/trees/trivial.c b/tests-clar/merge/trees/trivial.c index e6096e2dc..bfd5dfed3 100644 --- a/tests-clar/merge/trees/trivial.c +++ b/tests-clar/merge/trees/trivial.c @@ -34,7 +34,7 @@ static int merge_trivial(git_index **index, const char *ours, const char *theirs git_merge_tree_opts opts = GIT_MERGE_TREE_OPTS_INIT; opts.automerge_flags |= automerge ? 0 : GIT_MERGE_AUTOMERGE_NONE; - + git_buf_printf(&branch_buf, "%s%s", GIT_REFS_HEADS_DIR, ours); cl_git_pass(git_reference_name_to_id(&our_oid, repo, branch_buf.ptr)); cl_git_pass(git_commit_lookup(&our_commit, repo, &our_oid)); @@ -46,7 +46,7 @@ static int merge_trivial(git_index **index, const char *ours, const char *theirs cl_git_pass(git_merge_base(&ancestor_oid, repo, git_commit_id(our_commit), git_commit_id(their_commit))); cl_git_pass(git_commit_lookup(&ancestor_commit, repo, &ancestor_oid)); - + cl_git_pass(git_commit_tree(&ancestor_tree, ancestor_commit)); cl_git_pass(git_commit_tree(&our_tree, our_commit)); cl_git_pass(git_commit_tree(&their_tree, their_commit)); @@ -106,7 +106,7 @@ void test_merge_trees_trivial__3alt(void) cl_assert(entry = git_index_get_bypath(result, "new-in-3alt.txt", 0)); cl_assert(git_index_reuc_entrycount(result) == 0); cl_assert(merge_trivial_conflict_entrycount(result) == 0); - + git_index_free(result); } @@ -124,7 +124,7 @@ void test_merge_trees_trivial__4(void) cl_assert(merge_trivial_conflict_entrycount(result) == 2); cl_assert(entry = git_index_get_bypath(result, "new-and-different.txt", 2)); cl_assert(entry = git_index_get_bypath(result, "new-and-different.txt", 3)); - + git_index_free(result); } @@ -139,7 +139,7 @@ void test_merge_trees_trivial__5alt_1(void) cl_assert(entry = git_index_get_bypath(result, "new-and-same.txt", 0)); cl_assert(git_index_reuc_entrycount(result) == 0); cl_assert(merge_trivial_conflict_entrycount(result) == 0); - + git_index_free(result); } @@ -154,7 +154,7 @@ void test_merge_trees_trivial__5alt_2(void) cl_assert(entry = git_index_get_bypath(result, "modified-to-same.txt", 0)); cl_assert(git_index_reuc_entrycount(result) == 0); cl_assert(merge_trivial_conflict_entrycount(result) == 0); - + git_index_free(result); } @@ -171,7 +171,7 @@ void test_merge_trees_trivial__6(void) cl_assert(merge_trivial_conflict_entrycount(result) == 1); cl_assert(entry = git_index_get_bypath(result, "removed-in-both.txt", 1)); - + git_index_free(result); } @@ -189,7 +189,7 @@ void test_merge_trees_trivial__6_automerge(void) cl_assert(reuc = git_index_reuc_get_bypath(result, "removed-in-both.txt")); cl_assert(merge_trivial_conflict_entrycount(result) == 0); - + git_index_free(result); } @@ -207,7 +207,7 @@ void test_merge_trees_trivial__8(void) cl_assert(merge_trivial_conflict_entrycount(result) == 2); cl_assert(entry = git_index_get_bypath(result, "removed-in-8.txt", 1)); cl_assert(entry = git_index_get_bypath(result, "removed-in-8.txt", 3)); - + git_index_free(result); } @@ -226,7 +226,7 @@ void test_merge_trees_trivial__8_automerge(void) cl_assert(reuc = git_index_reuc_get_bypath(result, "removed-in-8.txt")); cl_assert(merge_trivial_conflict_entrycount(result) == 0); - + git_index_free(result); } @@ -244,7 +244,7 @@ void test_merge_trees_trivial__7(void) cl_assert(merge_trivial_conflict_entrycount(result) == 2); cl_assert(entry = git_index_get_bypath(result, "removed-in-7.txt", 1)); cl_assert(entry = git_index_get_bypath(result, "removed-in-7.txt", 3)); - + git_index_free(result); } @@ -262,7 +262,7 @@ void test_merge_trees_trivial__7_automerge(void) cl_assert(merge_trivial_conflict_entrycount(result) == 2); cl_assert(entry = git_index_get_bypath(result, "removed-in-7.txt", 1)); cl_assert(entry = git_index_get_bypath(result, "removed-in-7.txt", 3)); - + git_index_free(result); } @@ -280,7 +280,7 @@ void test_merge_trees_trivial__10(void) cl_assert(merge_trivial_conflict_entrycount(result) == 2); cl_assert(entry = git_index_get_bypath(result, "removed-in-10-branch.txt", 1)); cl_assert(entry = git_index_get_bypath(result, "removed-in-10-branch.txt", 2)); - + git_index_free(result); } @@ -299,7 +299,7 @@ void test_merge_trees_trivial__10_automerge(void) cl_assert(reuc = git_index_reuc_get_bypath(result, "removed-in-10-branch.txt")); cl_assert(merge_trivial_conflict_entrycount(result) == 0); - + git_index_free(result); } @@ -317,7 +317,7 @@ void test_merge_trees_trivial__9(void) cl_assert(merge_trivial_conflict_entrycount(result) == 2); cl_assert(entry = git_index_get_bypath(result, "removed-in-9-branch.txt", 1)); cl_assert(entry = git_index_get_bypath(result, "removed-in-9-branch.txt", 2)); - + git_index_free(result); } @@ -335,7 +335,7 @@ void test_merge_trees_trivial__9_automerge(void) cl_assert(merge_trivial_conflict_entrycount(result) == 2); cl_assert(entry = git_index_get_bypath(result, "removed-in-9-branch.txt", 1)); cl_assert(entry = git_index_get_bypath(result, "removed-in-9-branch.txt", 2)); - + git_index_free(result); } @@ -354,7 +354,7 @@ void test_merge_trees_trivial__13(void) cl_assert(git_index_reuc_entrycount(result) == 0); cl_assert(merge_trivial_conflict_entrycount(result) == 0); - + git_index_free(result); } @@ -373,7 +373,7 @@ void test_merge_trees_trivial__14(void) cl_assert(git_index_reuc_entrycount(result) == 0); cl_assert(merge_trivial_conflict_entrycount(result) == 0); - + git_index_free(result); } @@ -392,6 +392,6 @@ void test_merge_trees_trivial__11(void) cl_assert(entry = git_index_get_bypath(result, "modified-in-both.txt", 1)); cl_assert(entry = git_index_get_bypath(result, "modified-in-both.txt", 2)); cl_assert(entry = git_index_get_bypath(result, "modified-in-both.txt", 3)); - + git_index_free(result); } |