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
6fefb7af
Commit
6fefb7af
authored
Apr 13, 2014
by
Jacques Germishuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Capture conflict information in MERGE_MSG for revert and merge
parent
103b7d21
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
2 deletions
+24
-2
src/merge.c
+1
-0
src/revert.c
+1
-0
tests/merge/workdir/simple.c
+9
-1
tests/revert/workdir.c
+13
-1
No files found.
src/merge.c
View file @
6fefb7af
...
...
@@ -2662,6 +2662,7 @@ int git_merge(
if
((
error
=
git_merge_trees
(
&
index_new
,
repo
,
ancestor_tree
,
our_tree
,
their_trees
[
0
],
merge_opts
))
<
0
||
(
error
=
git_merge__indexes
(
repo
,
index_new
))
<
0
||
(
error
=
git_repository_index
(
&
index_repo
,
repo
))
<
0
||
(
error
=
git_merge__append_conflicts_to_merge_msg
(
repo
,
index_repo
))
<
0
||
(
error
=
git_checkout_index
(
repo
,
index_repo
,
&
checkout_opts
))
<
0
)
goto
on_error
;
...
...
src/revert.c
View file @
6fefb7af
...
...
@@ -201,6 +201,7 @@ int git_revert(
(
error
=
git_revert_commit
(
&
index_new
,
repo
,
commit
,
our_commit
,
opts
.
mainline
,
&
opts
.
merge_opts
))
<
0
||
(
error
=
git_merge__indexes
(
repo
,
index_new
))
<
0
||
(
error
=
git_repository_index
(
&
index_repo
,
repo
))
<
0
||
(
error
=
git_merge__append_conflicts_to_merge_msg
(
repo
,
index_repo
))
<
0
||
(
error
=
git_checkout_index
(
repo
,
index_repo
,
&
opts
.
checkout_opts
))
<
0
)
goto
on_error
;
...
...
tests/merge/workdir/simple.c
View file @
6fefb7af
...
...
@@ -214,7 +214,7 @@ void test_merge_workdir_simple__automerge_crlf(void)
void
test_merge_workdir_simple__mergefile
(
void
)
{
git_buf
conflicting_buf
=
GIT_BUF_INIT
;
git_buf
conflicting_buf
=
GIT_BUF_INIT
,
mergemsg_buf
=
GIT_BUF_INIT
;
struct
merge_index_entry
merge_index_entries
[]
=
{
ADDED_IN_MASTER_INDEX_ENTRY
,
...
...
@@ -240,7 +240,15 @@ void test_merge_workdir_simple__mergefile(void)
cl_git_pass
(
git_futils_readbuffer
(
&
conflicting_buf
,
TEST_REPO_PATH
"/conflicting.txt"
));
cl_assert
(
strcmp
(
conflicting_buf
.
ptr
,
CONFLICTING_MERGE_FILE
)
==
0
);
cl_git_pass
(
git_futils_readbuffer
(
&
mergemsg_buf
,
TEST_REPO_PATH
"/.git/MERGE_MSG"
));
cl_assert
(
strcmp
(
git_buf_cstr
(
&
mergemsg_buf
),
"Merge commit '7cb63eed597130ba4abb87b3e544b85021905520'
\n
"
\
"
\n
"
\
"Conflicts:
\n
"
\
"
\t
conflicting.txt
\n
"
)
==
0
);
git_buf_free
(
&
conflicting_buf
);
git_buf_free
(
&
mergemsg_buf
);
cl_assert
(
merge_test_index
(
repo_index
,
merge_index_entries
,
8
));
cl_assert
(
merge_test_reuc
(
repo_index
,
merge_reuc_entries
,
3
));
...
...
tests/revert/workdir.c
View file @
6fefb7af
...
...
@@ -66,7 +66,7 @@ void test_revert_workdir__conflicts(void)
git_reference
*
head_ref
;
git_commit
*
head
,
*
commit
;
git_oid
revert_oid
;
git_buf
conflicting_buf
=
GIT_BUF_INIT
;
git_buf
conflicting_buf
=
GIT_BUF_INIT
,
mergemsg_buf
=
GIT_BUF_INIT
;
struct
merge_index_entry
merge_index_entries
[]
=
{
{
0100644
,
"7731926a337c4eaba1e2187d90ebfa0a93659382"
,
1
,
"file1.txt"
},
...
...
@@ -112,9 +112,21 @@ void test_revert_workdir__conflicts(void)
"File one
\n
"
\
">>>>>>> parent of 72333f4... automergeable changes
\n
"
)
==
0
);
cl_assert
(
git_path_exists
(
TEST_REPO_PATH
"/.git/MERGE_MSG"
));
cl_git_pass
(
git_futils_readbuffer
(
&
mergemsg_buf
,
TEST_REPO_PATH
"/.git/MERGE_MSG"
));
cl_assert
(
strcmp
(
mergemsg_buf
.
ptr
,
"Revert
\"
automergeable changes
\"\n
"
\
"
\n
"
\
"This reverts commit 72333f47d4e83616630ff3b0ffe4c0faebcc3c45.
\n
"
"
\n
"
\
"Conflicts:
\n
"
\
"
\t
file1.txt
\n
"
)
==
0
);
git_commit_free
(
commit
);
git_commit_free
(
head
);
git_reference_free
(
head_ref
);
git_buf_free
(
&
mergemsg_buf
);
git_buf_free
(
&
conflicting_buf
);
}
...
...
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