Skip to content

Commit bb9e379

Browse files
GC8Etiene
authored andcommitted
merge: reload index before git_merge
If the index in memory is different from the index on the disk, previously merge would abort with GIT_ECONFLICT. Reload the index before merging to fix this. Fixes libgit2#4203
1 parent 46e1dab commit bb9e379

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/merge.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3239,6 +3239,9 @@ int git_merge(
32393239

32403240
assert(repo && their_heads);
32413241

3242+
git_repository_index(&index, repo);
3243+
git_index_read(index, 0);
3244+
32423245
if (their_heads_len != 1) {
32433246
giterr_set(GITERR_MERGE, "can only merge a single branch");
32443247
return -1;

0 commit comments

Comments
 (0)