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
399f2b62
Commit
399f2b62
authored
Apr 07, 2014
by
Jacques Germishuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce git_merge__extract_conflict_paths
parent
553184a7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
0 deletions
+43
-0
src/merge.c
+41
-0
src/merge.h
+2
-0
No files found.
src/merge.c
View file @
399f2b62
...
...
@@ -2469,6 +2469,47 @@ done:
return
error
;
}
int
git_merge__append_conflicts_to_merge_msg
(
git_repository
*
repo
,
git_index
*
index
)
{
git_filebuf
file
=
GIT_FILEBUF_INIT
;
git_buf
file_path
=
GIT_BUF_INIT
;
const
char
*
last
=
NULL
;
size_t
i
;
int
error
;
if
((
error
=
git_buf_joinpath
(
&
file_path
,
repo
->
path_repository
,
GIT_MERGE_MSG_FILE
))
<
0
||
(
error
=
git_filebuf_open
(
&
file
,
file_path
.
ptr
,
GIT_FILEBUF_APPEND
,
GIT_MERGE_FILE_MODE
))
<
0
)
goto
cleanup
;
if
(
git_index_has_conflicts
(
index
))
git_filebuf_printf
(
&
file
,
"
\n
Conflicts:
\n
"
);
for
(
i
=
0
;
i
<
git_index_entrycount
(
index
);
i
++
)
{
const
git_index_entry
*
e
=
git_index_get_byindex
(
index
,
i
);
if
(
git_index_entry_stage
(
e
)
==
0
)
continue
;
if
(
last
==
NULL
||
strcmp
(
e
->
path
,
last
)
!=
0
)
git_filebuf_printf
(
&
file
,
"
\t
%s
\n
"
,
e
->
path
);
last
=
e
->
path
;
}
error
=
git_filebuf_commit
(
&
file
);
cleanup:
if
(
error
<
0
)
git_filebuf_cleanup
(
&
file
);
git_buf_free
(
&
file_path
);
return
error
;
}
static
int
merge_state_cleanup
(
git_repository
*
repo
)
{
const
char
*
state_files
[]
=
{
...
...
src/merge.h
View file @
399f2b62
...
...
@@ -151,4 +151,6 @@ int git_merge__setup(
int
git_merge__indexes
(
git_repository
*
repo
,
git_index
*
index_new
);
int
git_merge__append_conflicts_to_merge_msg
(
git_repository
*
repo
,
git_index
*
index
);
#endif
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