diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2014-07-11 14:18:49 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2014-07-11 14:18:49 +0200 |
commit | 0dbbfbb6491a99e6e7b751888e3157e5f9097bce (patch) | |
tree | a546bede883631d03ffc5de60d4dd7e3c99b18e1 | |
parent | eb5f03461fbcaa3fef8e63d1b0f7c682708fadd2 (diff) | |
parent | 02bf955f4a03c328a76185b13e8df3622034aecd (diff) | |
download | libgit2-0dbbfbb6491a99e6e7b751888e3157e5f9097bce.tar.gz |
Merge pull request #2457 from ethomson/merge_fix
merge: don't open COMMIT_MSG unless we need to append conflicts
-rw-r--r-- | src/merge.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/merge.c b/src/merge.c index 68c9f66e2..f8d008a6d 100644 --- a/src/merge.c +++ b/src/merge.c @@ -2380,12 +2380,14 @@ int git_merge__append_conflicts_to_merge_msg( size_t i; 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 || (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, "\nConflicts:\n"); + git_filebuf_printf(&file, "\nConflicts:\n"); for (i = 0; i < git_index_entrycount(index); i++) { const git_index_entry *e = git_index_get_byindex(index, i); @@ -2410,7 +2412,6 @@ cleanup: return error; } - static int merge_state_cleanup(git_repository *repo) { const char *state_files[] = { |