mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-12 11:40:01 +00:00
merge: don't open COMMIT_MSG unless we need to append conflicts
This commit is contained in:
parent
18eb6ec823
commit
02bf955f4a
@ -2380,11 +2380,13 @@ int git_merge__append_conflicts_to_merge_msg(
|
|||||||
size_t i;
|
size_t i;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
if (!git_index_has_conflicts(index))
|
||||||
|
return 0;
|
||||||
|
|
||||||
if ((error = git_buf_joinpath(&file_path, repo->path_repository, GIT_MERGE_MSG_FILE)) < 0 ||
|
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)
|
(error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_APPEND, GIT_MERGE_FILE_MODE)) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (git_index_has_conflicts(index))
|
|
||||||
git_filebuf_printf(&file, "\nConflicts:\n");
|
git_filebuf_printf(&file, "\nConflicts:\n");
|
||||||
|
|
||||||
for (i = 0; i < git_index_entrycount(index); i++) {
|
for (i = 0; i < git_index_entrycount(index); i++) {
|
||||||
@ -2410,7 +2412,6 @@ cleanup:
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int merge_state_cleanup(git_repository *repo)
|
static int merge_state_cleanup(git_repository *repo)
|
||||||
{
|
{
|
||||||
const char *state_files[] = {
|
const char *state_files[] = {
|
||||||
|
Loading…
Reference in New Issue
Block a user