Commit fa78782f by Edward Thomson Committed by Edward Thomson

merge: rename `git_merge_tree_flags_t` -> `git_merge_flags_t`

parent c4f60543
......@@ -34,6 +34,14 @@ v0.23 + 1
### Breaking API changes
* The `git_merge_tree_flag_t` is now `git_merge_flag_t`. Subsequently,
its members are no longer prefixed with `GIT_MERGE_TREE_FLAG` but are
now prefixed with `GIT_MERGE_FLAG`, and the `tree_flags` field of the
`git_merge_options` structure is now named `flags`.
* The `git_merge_file_flags_t` enum is now `git_merge_file_flag_t` for
consistency with other enum type names.
* `git_cert` descendent types now have a proper `parent` member
* It is the responsibility of the refdb backend to decide what to do
......
......@@ -62,8 +62,8 @@ GIT_EXTERN(int) git_merge_file_init_input(
unsigned int version);
/**
* Flags for `git_merge_tree` options. A combination of these flags can be
* passed in via the `tree_flags` value in the `git_merge_options`.
* Flags for `git_merge` options. A combination of these flags can be
* passed in via the `flags` value in the `git_merge_options`.
*/
typedef enum {
/**
......@@ -71,20 +71,20 @@ typedef enum {
* side or the common ancestor and the "theirs" side. This will enable
* the ability to merge between a modified and renamed file.
*/
GIT_MERGE_TREE_FIND_RENAMES = (1 << 0),
GIT_MERGE_FIND_RENAMES = (1 << 0),
/**
* If a conflict occurs, exit immediately instead of attempting to
* continue resolving conflicts. The merge operation will fail with
* GIT_EMERGECONFLICT and no index will be returned.
* Do not write the REUC extension on the generated index
*/
GIT_MERGE_TREE_FAIL_ON_CONFLICT = (1 << 1),
GIT_MERGE_SKIP_REUC = (1 << 2),
/**
* Do not write the REUC extension on the generated index
* If a conflict occurs, exit immediately instead of attempting to
* continue resolving conflicts. The merge operation will fail with
* GIT_EMERGECONFLICT and no index will be returned.
*/
GIT_MERGE_TREE_SKIP_REUC = (1 << 2),
} git_merge_tree_flag_t;
GIT_MERGE_FAIL_ON_CONFLICT = (1 << 1),
} git_merge_flag_t;
/**
* Merge file favor options for `git_merge_options` instruct the file-level
......@@ -152,7 +152,7 @@ typedef enum {
/** Take extra time to find minimal diff */
GIT_MERGE_FILE_DIFF_MINIMAL = (1 << 7),
} git_merge_file_flags_t;
} git_merge_file_flag_t;
/**
* Options for merging a file
......@@ -181,8 +181,8 @@ typedef struct {
/** The file to favor in region conflicts. */
git_merge_file_favor_t favor;
/** see `git_merge_file_flags_t` above */
unsigned int flags;
/** see `git_merge_file_flag_t` above */
git_merge_file_flag_t flags;
} git_merge_file_options;
#define GIT_MERGE_FILE_OPTIONS_VERSION 1
......@@ -232,11 +232,13 @@ typedef struct {
*/
typedef struct {
unsigned int version;
git_merge_tree_flag_t tree_flags;
/** See `git_merge_flag_t` above */
git_merge_flag_t flags;
/**
* Similarity to consider a file renamed (default 50). If
* `GIT_MERGE_TREE_FIND_RENAMES` is enabled, added files will be compared
* `GIT_MERGE_FIND_RENAMES` is enabled, added files will be compared
* with deleted files to determine their similarity. Files that are
* more similar than the rename threshold (percentage-wise) will be
* treated as a rename.
......@@ -258,8 +260,8 @@ typedef struct {
/** Flags for handling conflicting content. */
git_merge_file_favor_t file_favor;
/** see `git_merge_file_flags_t` above */
unsigned int file_flags;
/** see `git_merge_file_flag_t` above */
git_merge_file_flag_t file_flags;
} git_merge_options;
#define GIT_MERGE_OPTIONS_VERSION 1
......
......@@ -1296,7 +1296,7 @@ int git_merge_diff_list__find_renames(
assert(diff_list && opts);
if ((opts->tree_flags & GIT_MERGE_TREE_FIND_RENAMES) == 0)
if ((opts->flags & GIT_MERGE_FIND_RENAMES) == 0)
return 0;
similarity_ours = git__calloc(diff_list->conflicts.length,
......@@ -1632,8 +1632,8 @@ static int merge_normalize_opts(
git_merge_options init = GIT_MERGE_OPTIONS_INIT;
memcpy(opts, &init, sizeof(init));
opts->tree_flags = GIT_MERGE_TREE_FIND_RENAMES;
opts->rename_threshold = GIT_MERGE_TREE_RENAME_THRESHOLD;
opts->flags = GIT_MERGE_FIND_RENAMES;
opts->rename_threshold = GIT_MERGE_DEFAULT_RENAME_THRESHOLD;
}
if (!opts->target_limit) {
......@@ -1643,7 +1643,7 @@ static int merge_normalize_opts(
limit = git_config__get_int_force(cfg, "diff.renamelimit", 0);
opts->target_limit = (limit <= 0) ?
GIT_MERGE_TREE_TARGET_LIMIT : (unsigned int)limit;
GIT_MERGE_DEFAULT_TARGET_LIMIT : (unsigned int)limit;
}
/* assign the internal metric with whitespace flag as payload */
......@@ -1864,7 +1864,7 @@ int git_merge__iterators(
goto done;
if (!resolved) {
if ((opts.tree_flags & GIT_MERGE_TREE_FAIL_ON_CONFLICT)) {
if ((opts.flags & GIT_MERGE_FAIL_ON_CONFLICT)) {
giterr_set(GITERR_MERGE, "merge conflicts exist");
error = GIT_EMERGECONFLICT;
goto done;
......@@ -1875,7 +1875,7 @@ int git_merge__iterators(
}
error = index_from_diff_list(out, diff_list,
(opts.tree_flags & GIT_MERGE_TREE_SKIP_REUC));
(opts.flags & GIT_MERGE_SKIP_REUC));
done:
if (!given_opts || !given_opts->metric)
......
......@@ -19,8 +19,8 @@
#define GIT_MERGE_MODE_FILE "MERGE_MODE"
#define GIT_MERGE_FILE_MODE 0666
#define GIT_MERGE_TREE_RENAME_THRESHOLD 50
#define GIT_MERGE_TREE_TARGET_LIMIT 1000
#define GIT_MERGE_DEFAULT_RENAME_THRESHOLD 50
#define GIT_MERGE_DEFAULT_TARGET_LIMIT 1000
/** Types of changes when files are merged from branch to branch. */
typedef enum {
......
......@@ -300,7 +300,7 @@ void test_cherrypick_workdir__rename(void)
{ 0100644, "28d9eb4208074ad1cc84e71ccc908b34573f05d2", 0, "file3.txt.renamed" },
};
opts.merge_opts.tree_flags |= GIT_MERGE_TREE_FIND_RENAMES;
opts.merge_opts.flags |= GIT_MERGE_FIND_RENAMES;
opts.merge_opts.rename_threshold = 50;
git_oid_fromstr(&head_oid, "cfc4f0999a8367568e049af4f72e452d40828a15");
......@@ -335,7 +335,7 @@ void test_cherrypick_workdir__both_renamed(void)
{ 0100644, "28d9eb4208074ad1cc84e71ccc908b34573f05d2", 2, "file3.txt.renamed_on_branch" },
};
opts.merge_opts.tree_flags |= GIT_MERGE_TREE_FIND_RENAMES;
opts.merge_opts.flags |= GIT_MERGE_FIND_RENAMES;
opts.merge_opts.rename_threshold = 50;
git_oid_fromstr(&head_oid, "44cd2ed2052c9c68f9a439d208e9614dc2a55c70");
......
......@@ -134,7 +134,7 @@ void test_merge_trees_commits__fail_on_conflict(void)
git_index *index;
git_merge_options opts = GIT_MERGE_OPTIONS_INIT;
opts.tree_flags |= GIT_MERGE_TREE_FAIL_ON_CONFLICT;
opts.flags |= GIT_MERGE_FAIL_ON_CONFLICT;
cl_git_fail_with(GIT_EMERGECONFLICT,
merge_trees_from_branches(&index, repo, "df_side1", "df_side2", &opts));
......
......@@ -47,7 +47,7 @@ static void test_find_differences(
git_iterator_options iter_opts = GIT_ITERATOR_OPTIONS_INIT;
git_merge_options opts = GIT_MERGE_OPTIONS_INIT;
opts.tree_flags |= GIT_MERGE_TREE_FIND_RENAMES;
opts.flags |= GIT_MERGE_FIND_RENAMES;
opts.target_limit = 1000;
opts.rename_threshold = 50;
......
......@@ -63,7 +63,7 @@ void test_merge_workdir_renames__renames(void)
{ 0100644, "b69fe837e4cecfd4c9a40cdca7c138468687df07", 0, "7-both-renamed.txt~rename_conflict_theirs" },
};
merge_opts.tree_flags |= GIT_MERGE_TREE_FIND_RENAMES;
merge_opts.flags |= GIT_MERGE_FIND_RENAMES;
merge_opts.rename_threshold = 50;
cl_git_pass(merge_branches(repo, GIT_REFS_HEADS_DIR BRANCH_RENAME_OURS, GIT_REFS_HEADS_DIR BRANCH_RENAME_THEIRS, &merge_opts, NULL));
......@@ -99,7 +99,7 @@ void test_merge_workdir_renames__ours(void)
{ 0100644, "b42712cfe99a1a500b2a51fe984e0b8a7702ba11", 0, "7-both-renamed.txt" },
};
merge_opts.tree_flags |= GIT_MERGE_TREE_FIND_RENAMES;
merge_opts.flags |= GIT_MERGE_FIND_RENAMES;
merge_opts.rename_threshold = 50;
checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_USE_OURS;
......@@ -147,7 +147,7 @@ void test_merge_workdir_renames__similar(void)
{ 0100644, "b69fe837e4cecfd4c9a40cdca7c138468687df07", 0, "7-both-renamed.txt~rename_conflict_theirs" },
};
merge_opts.tree_flags |= GIT_MERGE_TREE_FIND_RENAMES;
merge_opts.flags |= GIT_MERGE_FIND_RENAMES;
merge_opts.rename_threshold = 50;
cl_git_pass(merge_branches(repo, GIT_REFS_HEADS_DIR BRANCH_RENAME_OURS, GIT_REFS_HEADS_DIR BRANCH_RENAME_THEIRS, &merge_opts, NULL));
......
......@@ -410,7 +410,7 @@ void test_revert_workdir__rename_1_of_2(void)
{ 0100644, "0f5bfcf58c558d865da6be0281d7795993646cee", 2, "file6.txt" },
};
opts.merge_opts.tree_flags |= GIT_MERGE_TREE_FIND_RENAMES;
opts.merge_opts.flags |= GIT_MERGE_FIND_RENAMES;
opts.merge_opts.rename_threshold = 50;
git_oid_fromstr(&head_oid, "cef56612d71a6af8d8015691e4865f7fece905b5");
......@@ -444,7 +444,7 @@ void test_revert_workdir__rename(void)
{ "file4.txt", "file5.txt", "" },
};
opts.merge_opts.tree_flags |= GIT_MERGE_TREE_FIND_RENAMES;
opts.merge_opts.flags |= GIT_MERGE_FIND_RENAMES;
opts.merge_opts.rename_threshold = 50;
git_oid_fromstr(&head_oid, "55568c8de5322ff9a95d72747a239cdb64a19965");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment