Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
64be170d
Commit
64be170d
authored
May 29, 2015
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3163 from ethomson/emergeconflict
Rename GIT_EMERGECONFLICT to GIT_ECONFLICT
parents
41a71c1a
885b94aa
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
21 additions
and
18 deletions
+21
-18
CHANGELOG.md
+3
-0
include/git2/errors.h
+1
-1
src/checkout.c
+3
-3
src/merge.c
+1
-1
src/stash.c
+1
-1
tests/checkout/tree.c
+7
-7
tests/stash/apply.c
+5
-5
No files found.
CHANGELOG.md
View file @
64be170d
...
@@ -229,6 +229,9 @@ support for HTTPS connections insead of OpenSSL.
...
@@ -229,6 +229,9 @@ support for HTTPS connections insead of OpenSSL.
index. Specifically, time and file size are 32 bits intead of 64, as
index. Specifically, time and file size are 32 bits intead of 64, as
these values are truncated.
these values are truncated.
*
`GIT_EMERGECONFLICT`
is now
`GIT_ECONFLICT`
, which more accurately
describes the nature of the error.
v0.22
v0.22
------
------
...
...
include/git2/errors.h
View file @
64be170d
...
@@ -38,7 +38,7 @@ typedef enum {
...
@@ -38,7 +38,7 @@ typedef enum {
GIT_EUNMERGED
=
-
10
,
/**< Merge in progress prevented operation */
GIT_EUNMERGED
=
-
10
,
/**< Merge in progress prevented operation */
GIT_ENONFASTFORWARD
=
-
11
,
/**< Reference was not fast-forwardable */
GIT_ENONFASTFORWARD
=
-
11
,
/**< Reference was not fast-forwardable */
GIT_EINVALIDSPEC
=
-
12
,
/**< Name/ref spec was not in a valid format */
GIT_EINVALIDSPEC
=
-
12
,
/**< Name/ref spec was not in a valid format */
GIT_E
MERGECONFLICT
=
-
13
,
/**< Merge
conflicts prevented operation */
GIT_E
CONFLICT
=
-
13
,
/**< Checkout
conflicts prevented operation */
GIT_ELOCKED
=
-
14
,
/**< Lock file prevented operation */
GIT_ELOCKED
=
-
14
,
/**< Lock file prevented operation */
GIT_EMODIFIED
=
-
15
,
/**< Reference value does not match expected */
GIT_EMODIFIED
=
-
15
,
/**< Reference value does not match expected */
GIT_EAUTH
=
-
16
,
/**< Authentication error */
GIT_EAUTH
=
-
16
,
/**< Authentication error */
...
...
src/checkout.c
View file @
64be170d
...
@@ -1292,7 +1292,7 @@ static int checkout_get_actions(
...
@@ -1292,7 +1292,7 @@ static int checkout_get_actions(
(
int
)
counts
[
CHECKOUT_ACTION__CONFLICT
],
(
int
)
counts
[
CHECKOUT_ACTION__CONFLICT
],
counts
[
CHECKOUT_ACTION__CONFLICT
]
==
1
?
counts
[
CHECKOUT_ACTION__CONFLICT
]
==
1
?
"conflict prevents"
:
"conflicts prevent"
);
"conflict prevents"
:
"conflicts prevent"
);
error
=
GIT_E
MERGE
CONFLICT
;
error
=
GIT_ECONFLICT
;
goto
fail
;
goto
fail
;
}
}
...
@@ -2062,7 +2062,7 @@ static int checkout_write_merge(
...
@@ -2062,7 +2062,7 @@ static int checkout_write_merge(
if
(
result
.
path
==
NULL
||
result
.
mode
==
0
)
{
if
(
result
.
path
==
NULL
||
result
.
mode
==
0
)
{
giterr_set
(
GITERR_CHECKOUT
,
"Could not merge contents of file"
);
giterr_set
(
GITERR_CHECKOUT
,
"Could not merge contents of file"
);
error
=
GIT_E
MERGE
CONFLICT
;
error
=
GIT_ECONFLICT
;
goto
done
;
goto
done
;
}
}
...
@@ -2357,7 +2357,7 @@ static int checkout_data_init(
...
@@ -2357,7 +2357,7 @@ static int checkout_data_init(
/* cannot checkout if unresolved conflicts exist */
/* cannot checkout if unresolved conflicts exist */
if
((
data
->
opts
.
checkout_strategy
&
GIT_CHECKOUT_FORCE
)
==
0
&&
if
((
data
->
opts
.
checkout_strategy
&
GIT_CHECKOUT_FORCE
)
==
0
&&
git_index_has_conflicts
(
data
->
index
))
{
git_index_has_conflicts
(
data
->
index
))
{
error
=
GIT_E
MERGE
CONFLICT
;
error
=
GIT_ECONFLICT
;
giterr_set
(
GITERR_CHECKOUT
,
giterr_set
(
GITERR_CHECKOUT
,
"unresolved conflicts exist in the index"
);
"unresolved conflicts exist in the index"
);
goto
cleanup
;
goto
cleanup
;
...
...
src/merge.c
View file @
64be170d
...
@@ -2509,7 +2509,7 @@ int git_merge__check_result(git_repository *repo, git_index *index_new)
...
@@ -2509,7 +2509,7 @@ int git_merge__check_result(git_repository *repo, git_index *index_new)
if
((
conflicts
=
index_conflicts
+
wd_conflicts
)
>
0
)
{
if
((
conflicts
=
index_conflicts
+
wd_conflicts
)
>
0
)
{
giterr_set
(
GITERR_MERGE
,
"%d uncommitted change%s would be overwritten by merge"
,
giterr_set
(
GITERR_MERGE
,
"%d uncommitted change%s would be overwritten by merge"
,
conflicts
,
(
conflicts
!=
1
)
?
"s"
:
""
);
conflicts
,
(
conflicts
!=
1
)
?
"s"
:
""
);
error
=
GIT_E
MERGE
CONFLICT
;
error
=
GIT_ECONFLICT
;
}
}
done:
done:
...
...
src/stash.c
View file @
64be170d
...
@@ -761,7 +761,7 @@ int git_stash_apply(
...
@@ -761,7 +761,7 @@ int git_stash_apply(
goto
cleanup
;
goto
cleanup
;
if
(
git_index_has_conflicts
(
unstashed_index
))
{
if
(
git_index_has_conflicts
(
unstashed_index
))
{
error
=
GIT_E
MERGE
CONFLICT
;
error
=
GIT_ECONFLICT
;
goto
cleanup
;
goto
cleanup
;
}
}
}
}
...
...
tests/checkout/tree.c
View file @
64be170d
...
@@ -306,7 +306,7 @@ void test_checkout_tree__conflict_on_ignored_when_not_overwriting(void)
...
@@ -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
(
cl_git_fail
(
error
=
checkout_tree_with_blob_ignored_in_workdir
(
GIT_CHECKOUT_SAFE
|
GIT_CHECKOUT_DONT_OVERWRITE_IGNORED
,
false
));
GIT_CHECKOUT_SAFE
|
GIT_CHECKOUT_DONT_OVERWRITE_IGNORED
,
false
));
cl_assert_equal_i
(
GIT_E
MERGE
CONFLICT
,
error
);
cl_assert_equal_i
(
GIT_ECONFLICT
,
error
);
}
}
void
test_checkout_tree__can_overwrite_ignored_by_default
(
void
)
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)
...
@@ -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
(
cl_git_fail
(
error
=
checkout_tree_with_blob_ignored_in_workdir
(
GIT_CHECKOUT_SAFE
|
GIT_CHECKOUT_DONT_OVERWRITE_IGNORED
,
true
));
GIT_CHECKOUT_SAFE
|
GIT_CHECKOUT_DONT_OVERWRITE_IGNORED
,
true
));
cl_assert_equal_i
(
GIT_E
MERGE
CONFLICT
,
error
);
cl_assert_equal_i
(
GIT_ECONFLICT
,
error
);
}
}
void
test_checkout_tree__can_overwrite_ignored_folder_by_default
(
void
)
void
test_checkout_tree__can_overwrite_ignored_folder_by_default
(
void
)
...
@@ -512,7 +512,7 @@ void assert_conflict(
...
@@ -512,7 +512,7 @@ void assert_conflict(
g_opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE
;
g_opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE
;
cl_assert_equal_i
(
cl_assert_equal_i
(
GIT_E
MERGE
CONFLICT
,
git_checkout_tree
(
g_repo
,
g_object
,
&
g_opts
));
GIT_ECONFLICT
,
git_checkout_tree
(
g_repo
,
g_object
,
&
g_opts
));
/* Stage the conflicting change */
/* Stage the conflicting change */
cl_git_pass
(
git_index_add_bypath
(
index
,
entry_path
));
cl_git_pass
(
git_index_add_bypath
(
index
,
entry_path
));
...
@@ -520,10 +520,10 @@ void assert_conflict(
...
@@ -520,10 +520,10 @@ void assert_conflict(
git_index_free
(
index
);
git_index_free
(
index
);
cl_assert_equal_i
(
cl_assert_equal_i
(
GIT_E
MERGE
CONFLICT
,
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_E
MERGE
CONFLICT
(
void
)
void
test_checkout_tree__checking_out_a_conflicting_type_change_returns_ECONFLICT
(
void
)
{
{
/*
/*
* 099faba adds a symlink named 'link_to_new.txt'
* 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
...
@@ -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"
);
assert_conflict
(
"link_to_new.txt"
,
"old.txt"
,
"a65fedf"
,
"099faba"
);
}
}
void
test_checkout_tree__checking_out_a_conflicting_type_change_returns_E
MERGE
CONFLICT_2
(
void
)
void
test_checkout_tree__checking_out_a_conflicting_type_change_returns_ECONFLICT_2
(
void
)
{
{
/*
/*
* cf80f8d adds a directory named 'a/'
* cf80f8d adds a directory named 'a/'
...
@@ -543,7 +543,7 @@ void test_checkout_tree__checking_out_a_conflicting_type_change_returns_EMERGECO
...
@@ -543,7 +543,7 @@ void test_checkout_tree__checking_out_a_conflicting_type_change_returns_EMERGECO
assert_conflict
(
"a"
,
"hello
\n
"
,
"a4a7dce"
,
"cf80f8d"
);
assert_conflict
(
"a"
,
"hello
\n
"
,
"a4a7dce"
,
"cf80f8d"
);
}
}
void
test_checkout_tree__checking_out_a_conflicting_content_change_returns_E
MERGE
CONFLICT
(
void
)
void
test_checkout_tree__checking_out_a_conflicting_content_change_returns_ECONFLICT
(
void
)
{
{
/*
/*
* c47800c adds a symlink named 'branch_file.txt'
* c47800c adds a symlink named 'branch_file.txt'
...
...
tests/stash/apply.c
View file @
64be170d
...
@@ -118,7 +118,7 @@ void test_stash_apply__conflict_index_with_reinstate_index(void)
...
@@ -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_add_bypath
(
repo_index
,
"who"
));
cl_git_pass
(
git_index_write
(
repo_index
));
cl_git_pass
(
git_index_write
(
repo_index
));
cl_git_fail_with
(
git_stash_apply
(
repo
,
0
,
&
opts
),
GIT_E
MERGE
CONFLICT
);
cl_git_fail_with
(
git_stash_apply
(
repo
,
0
,
&
opts
),
GIT_ECONFLICT
);
cl_assert_equal_i
(
git_index_has_conflicts
(
repo_index
),
0
);
cl_assert_equal_i
(
git_index_has_conflicts
(
repo_index
),
0
);
assert_status
(
repo
,
"what"
,
GIT_STATUS_CURRENT
);
assert_status
(
repo
,
"what"
,
GIT_STATUS_CURRENT
);
...
@@ -133,7 +133,7 @@ void test_stash_apply__conflict_untracked_with_default(void)
...
@@ -133,7 +133,7 @@ void test_stash_apply__conflict_untracked_with_default(void)
cl_git_mkfile
(
"stash/when"
,
"nothing
\n
"
);
cl_git_mkfile
(
"stash/when"
,
"nothing
\n
"
);
cl_git_fail_with
(
git_stash_apply
(
repo
,
0
,
&
opts
),
GIT_E
MERGE
CONFLICT
);
cl_git_fail_with
(
git_stash_apply
(
repo
,
0
,
&
opts
),
GIT_ECONFLICT
);
cl_assert_equal_i
(
git_index_has_conflicts
(
repo_index
),
0
);
cl_assert_equal_i
(
git_index_has_conflicts
(
repo_index
),
0
);
assert_status
(
repo
,
"what"
,
GIT_STATUS_CURRENT
);
assert_status
(
repo
,
"what"
,
GIT_STATUS_CURRENT
);
...
@@ -150,7 +150,7 @@ void test_stash_apply__conflict_untracked_with_reinstate_index(void)
...
@@ -150,7 +150,7 @@ void test_stash_apply__conflict_untracked_with_reinstate_index(void)
cl_git_mkfile
(
"stash/when"
,
"nothing
\n
"
);
cl_git_mkfile
(
"stash/when"
,
"nothing
\n
"
);
cl_git_fail_with
(
git_stash_apply
(
repo
,
0
,
&
opts
),
GIT_E
MERGE
CONFLICT
);
cl_git_fail_with
(
git_stash_apply
(
repo
,
0
,
&
opts
),
GIT_ECONFLICT
);
cl_assert_equal_i
(
git_index_has_conflicts
(
repo_index
),
0
);
cl_assert_equal_i
(
git_index_has_conflicts
(
repo_index
),
0
);
assert_status
(
repo
,
"what"
,
GIT_STATUS_CURRENT
);
assert_status
(
repo
,
"what"
,
GIT_STATUS_CURRENT
);
...
@@ -163,7 +163,7 @@ void test_stash_apply__conflict_workdir_with_default(void)
...
@@ -163,7 +163,7 @@ void test_stash_apply__conflict_workdir_with_default(void)
{
{
cl_git_rewritefile
(
"stash/what"
,
"ciao
\n
"
);
cl_git_rewritefile
(
"stash/what"
,
"ciao
\n
"
);
cl_git_fail_with
(
git_stash_apply
(
repo
,
0
,
NULL
),
GIT_E
MERGE
CONFLICT
);
cl_git_fail_with
(
git_stash_apply
(
repo
,
0
,
NULL
),
GIT_ECONFLICT
);
cl_assert_equal_i
(
git_index_has_conflicts
(
repo_index
),
0
);
cl_assert_equal_i
(
git_index_has_conflicts
(
repo_index
),
0
);
assert_status
(
repo
,
"what"
,
GIT_STATUS_WT_MODIFIED
);
assert_status
(
repo
,
"what"
,
GIT_STATUS_WT_MODIFIED
);
...
@@ -180,7 +180,7 @@ void test_stash_apply__conflict_workdir_with_reinstate_index(void)
...
@@ -180,7 +180,7 @@ void test_stash_apply__conflict_workdir_with_reinstate_index(void)
cl_git_rewritefile
(
"stash/what"
,
"ciao
\n
"
);
cl_git_rewritefile
(
"stash/what"
,
"ciao
\n
"
);
cl_git_fail_with
(
git_stash_apply
(
repo
,
0
,
&
opts
),
GIT_E
MERGE
CONFLICT
);
cl_git_fail_with
(
git_stash_apply
(
repo
,
0
,
&
opts
),
GIT_ECONFLICT
);
cl_assert_equal_i
(
git_index_has_conflicts
(
repo_index
),
0
);
cl_assert_equal_i
(
git_index_has_conflicts
(
repo_index
),
0
);
assert_status
(
repo
,
"what"
,
GIT_STATUS_WT_MODIFIED
);
assert_status
(
repo
,
"what"
,
GIT_STATUS_WT_MODIFIED
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment