Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2015-10-23 00:00:09 +0300
committerEdward Thomson <ethomson@microsoft.com>2015-11-25 23:37:05 +0300
commitfa78782f67d17c5b139a2bbe3ceefe54c8c71dd3 (patch)
tree53dbcd502af2400529a3f8db828612d90d12cf06
parentc4f60543b7ccfce852ebdc8c12b62c99a5d4c2a5 (diff)
merge: rename `git_merge_tree_flags_t` -> `git_merge_flags_t`
-rw-r--r--CHANGELOG.md8
-rw-r--r--include/git2/merge.h36
-rw-r--r--src/merge.c12
-rw-r--r--src/merge.h4
-rw-r--r--tests/cherrypick/workdir.c4
-rw-r--r--tests/merge/trees/commits.c2
-rw-r--r--tests/merge/trees/treediff.c2
-rw-r--r--tests/merge/workdir/renames.c6
-rw-r--r--tests/revert/workdir.c4
9 files changed, 44 insertions, 34 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7d5a4166a..196ad705a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
diff --git a/include/git2/merge.h b/include/git2/merge.h
index b7da63e0e..de224aeac 100644
--- a/include/git2/merge.h
+++ b/include/git2/merge.h
@@ -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
diff --git a/src/merge.c b/src/merge.c
index bad5f9552..d7b23e2c8 100644
--- a/src/merge.c
+++ b/src/merge.c
@@ -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)
diff --git a/src/merge.h b/src/merge.h
index 3caf617c6..bd839be49 100644
--- a/src/merge.h
+++ b/src/merge.h
@@ -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 {
diff --git a/tests/cherrypick/workdir.c b/tests/cherrypick/workdir.c
index 787f1f4d4..2b45f5a33 100644
--- a/tests/cherrypick/workdir.c
+++ b/tests/cherrypick/workdir.c
@@ -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");
diff --git a/tests/merge/trees/commits.c b/tests/merge/trees/commits.c
index 2e3c4578b..dd1e383ac 100644
--- a/tests/merge/trees/commits.c
+++ b/tests/merge/trees/commits.c
@@ -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));
diff --git a/tests/merge/trees/treediff.c b/tests/merge/trees/treediff.c
index f21d99b6d..3634568de 100644
--- a/tests/merge/trees/treediff.c
+++ b/tests/merge/trees/treediff.c
@@ -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;
diff --git a/tests/merge/workdir/renames.c b/tests/merge/workdir/renames.c
index 83006a703..fabcda2a8 100644
--- a/tests/merge/workdir/renames.c
+++ b/tests/merge/workdir/renames.c
@@ -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));
diff --git a/tests/revert/workdir.c b/tests/revert/workdir.c
index 9f83bd842..802819c75 100644
--- a/tests/revert/workdir.c
+++ b/tests/revert/workdir.c
@@ -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");