Merge pull request #3163 from ethomson/emergeconflict Rename GIT_EMERGECONFLICT to GIT_ECONFLICT
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 99e3759..3ca9bc6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -229,6 +229,9 @@ support for HTTPS connections insead of OpenSSL.
index. Specifically, time and file size are 32 bits intead of 64, as
these values are truncated.
+* `GIT_EMERGECONFLICT` is now `GIT_ECONFLICT`, which more accurately
+ describes the nature of the error.
+
v0.22
------
diff --git a/include/git2/errors.h b/include/git2/errors.h
index 31fc603..dda0f8a 100644
--- a/include/git2/errors.h
+++ b/include/git2/errors.h
@@ -38,7 +38,7 @@ typedef enum {
GIT_EUNMERGED = -10, /**< Merge in progress prevented operation */
GIT_ENONFASTFORWARD = -11, /**< Reference was not fast-forwardable */
GIT_EINVALIDSPEC = -12, /**< Name/ref spec was not in a valid format */
- GIT_EMERGECONFLICT = -13, /**< Merge conflicts prevented operation */
+ GIT_ECONFLICT = -13, /**< Checkout conflicts prevented operation */
GIT_ELOCKED = -14, /**< Lock file prevented operation */
GIT_EMODIFIED = -15, /**< Reference value does not match expected */
GIT_EAUTH = -16, /**< Authentication error */
diff --git a/src/checkout.c b/src/checkout.c
index 6a1d281..cc73e48 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -1292,7 +1292,7 @@ static int checkout_get_actions(
(int)counts[CHECKOUT_ACTION__CONFLICT],
counts[CHECKOUT_ACTION__CONFLICT] == 1 ?
"conflict prevents" : "conflicts prevent");
- error = GIT_EMERGECONFLICT;
+ error = GIT_ECONFLICT;
goto fail;
}
@@ -2062,7 +2062,7 @@ static int checkout_write_merge(
if (result.path == NULL || result.mode == 0) {
giterr_set(GITERR_CHECKOUT, "Could not merge contents of file");
- error = GIT_EMERGECONFLICT;
+ error = GIT_ECONFLICT;
goto done;
}
@@ -2357,7 +2357,7 @@ static int checkout_data_init(
/* cannot checkout if unresolved conflicts exist */
if ((data->opts.checkout_strategy & GIT_CHECKOUT_FORCE) == 0 &&
git_index_has_conflicts(data->index)) {
- error = GIT_EMERGECONFLICT;
+ error = GIT_ECONFLICT;
giterr_set(GITERR_CHECKOUT,
"unresolved conflicts exist in the index");
goto cleanup;
diff --git a/src/merge.c b/src/merge.c
index eaf7eee..28fca00 100644
--- a/src/merge.c
+++ b/src/merge.c
@@ -2509,7 +2509,7 @@ int git_merge__check_result(git_repository *repo, git_index *index_new)
if ((conflicts = index_conflicts + wd_conflicts) > 0) {
giterr_set(GITERR_MERGE, "%d uncommitted change%s would be overwritten by merge",
conflicts, (conflicts != 1) ? "s" : "");
- error = GIT_EMERGECONFLICT;
+ error = GIT_ECONFLICT;
}
done:
diff --git a/src/stash.c b/src/stash.c
index 0c5cd1d..a7a288c 100644
--- a/src/stash.c
+++ b/src/stash.c
@@ -761,7 +761,7 @@ int git_stash_apply(
goto cleanup;
if (git_index_has_conflicts(unstashed_index)) {
- error = GIT_EMERGECONFLICT;
+ error = GIT_ECONFLICT;
goto cleanup;
}
}
diff --git a/tests/checkout/tree.c b/tests/checkout/tree.c
index 4623231..be40198 100644
--- a/tests/checkout/tree.c
+++ b/tests/checkout/tree.c
@@ -306,7 +306,7 @@ void test_checkout_tree__conflict_on_ignored_when_not_overwriting(void)
cl_git_fail(error = checkout_tree_with_blob_ignored_in_workdir(
GIT_CHECKOUT_SAFE | GIT_CHECKOUT_DONT_OVERWRITE_IGNORED, false));
- cl_assert_equal_i(GIT_EMERGECONFLICT, error);
+ cl_assert_equal_i(GIT_ECONFLICT, error);
}
void test_checkout_tree__can_overwrite_ignored_by_default(void)
@@ -327,7 +327,7 @@ void test_checkout_tree__conflict_on_ignored_folder_when_not_overwriting(void)
cl_git_fail(error = checkout_tree_with_blob_ignored_in_workdir(
GIT_CHECKOUT_SAFE | GIT_CHECKOUT_DONT_OVERWRITE_IGNORED, true));
- cl_assert_equal_i(GIT_EMERGECONFLICT, error);
+ cl_assert_equal_i(GIT_ECONFLICT, error);
}
void test_checkout_tree__can_overwrite_ignored_folder_by_default(void)
@@ -512,7 +512,7 @@ void assert_conflict(
g_opts.checkout_strategy = GIT_CHECKOUT_SAFE;
cl_assert_equal_i(
- GIT_EMERGECONFLICT, git_checkout_tree(g_repo, g_object, &g_opts));
+ GIT_ECONFLICT, git_checkout_tree(g_repo, g_object, &g_opts));
/* Stage the conflicting change */
cl_git_pass(git_index_add_bypath(index, entry_path));
@@ -520,10 +520,10 @@ void assert_conflict(
git_index_free(index);
cl_assert_equal_i(
- GIT_EMERGECONFLICT, git_checkout_tree(g_repo, g_object, &g_opts));
+ GIT_ECONFLICT, git_checkout_tree(g_repo, g_object, &g_opts));
}
-void test_checkout_tree__checking_out_a_conflicting_type_change_returns_EMERGECONFLICT(void)
+void test_checkout_tree__checking_out_a_conflicting_type_change_returns_ECONFLICT(void)
{
/*
* 099faba adds a symlink named 'link_to_new.txt'
@@ -533,7 +533,7 @@ void test_checkout_tree__checking_out_a_conflicting_type_change_returns_EMERGECO
assert_conflict("link_to_new.txt", "old.txt", "a65fedf", "099faba");
}
-void test_checkout_tree__checking_out_a_conflicting_type_change_returns_EMERGECONFLICT_2(void)
+void test_checkout_tree__checking_out_a_conflicting_type_change_returns_ECONFLICT_2(void)
{
/*
* cf80f8d adds a directory named 'a/'
@@ -543,7 +543,7 @@ void test_checkout_tree__checking_out_a_conflicting_type_change_returns_EMERGECO
assert_conflict("a", "hello\n", "a4a7dce", "cf80f8d");
}
-void test_checkout_tree__checking_out_a_conflicting_content_change_returns_EMERGECONFLICT(void)
+void test_checkout_tree__checking_out_a_conflicting_content_change_returns_ECONFLICT(void)
{
/*
* c47800c adds a symlink named 'branch_file.txt'
diff --git a/tests/stash/apply.c b/tests/stash/apply.c
index 42186b6..e9b56f8 100644
--- a/tests/stash/apply.c
+++ b/tests/stash/apply.c
@@ -118,7 +118,7 @@ void test_stash_apply__conflict_index_with_reinstate_index(void)
cl_git_pass(git_index_add_bypath(repo_index, "who"));
cl_git_pass(git_index_write(repo_index));
- cl_git_fail_with(git_stash_apply(repo, 0, &opts), GIT_EMERGECONFLICT);
+ cl_git_fail_with(git_stash_apply(repo, 0, &opts), GIT_ECONFLICT);
cl_assert_equal_i(git_index_has_conflicts(repo_index), 0);
assert_status(repo, "what", GIT_STATUS_CURRENT);
@@ -133,7 +133,7 @@ void test_stash_apply__conflict_untracked_with_default(void)
cl_git_mkfile("stash/when", "nothing\n");
- cl_git_fail_with(git_stash_apply(repo, 0, &opts), GIT_EMERGECONFLICT);
+ cl_git_fail_with(git_stash_apply(repo, 0, &opts), GIT_ECONFLICT);
cl_assert_equal_i(git_index_has_conflicts(repo_index), 0);
assert_status(repo, "what", GIT_STATUS_CURRENT);
@@ -150,7 +150,7 @@ void test_stash_apply__conflict_untracked_with_reinstate_index(void)
cl_git_mkfile("stash/when", "nothing\n");
- cl_git_fail_with(git_stash_apply(repo, 0, &opts), GIT_EMERGECONFLICT);
+ cl_git_fail_with(git_stash_apply(repo, 0, &opts), GIT_ECONFLICT);
cl_assert_equal_i(git_index_has_conflicts(repo_index), 0);
assert_status(repo, "what", GIT_STATUS_CURRENT);
@@ -163,7 +163,7 @@ void test_stash_apply__conflict_workdir_with_default(void)
{
cl_git_rewritefile("stash/what", "ciao\n");
- cl_git_fail_with(git_stash_apply(repo, 0, NULL), GIT_EMERGECONFLICT);
+ cl_git_fail_with(git_stash_apply(repo, 0, NULL), GIT_ECONFLICT);
cl_assert_equal_i(git_index_has_conflicts(repo_index), 0);
assert_status(repo, "what", GIT_STATUS_WT_MODIFIED);
@@ -180,7 +180,7 @@ void test_stash_apply__conflict_workdir_with_reinstate_index(void)
cl_git_rewritefile("stash/what", "ciao\n");
- cl_git_fail_with(git_stash_apply(repo, 0, &opts), GIT_EMERGECONFLICT);
+ cl_git_fail_with(git_stash_apply(repo, 0, &opts), GIT_ECONFLICT);
cl_assert_equal_i(git_index_has_conflicts(repo_index), 0);
assert_status(repo, "what", GIT_STATUS_WT_MODIFIED);