diff options
author | Greg Collinge <gc1343@my.bristol.ac.uk> | 2017-11-11 17:20:16 +0000 |
---|---|---|
committer | Etiene Dalcol <dalcol@etiene.net> | 2017-11-11 19:31:42 +0000 |
commit | bb9e3797ba08c8cb0e88b2e1dc63959fa8f084a9 (patch) | |
tree | 98eb0802a73b7ae8e10014245d5c2383e962e1ec | |
parent | 46e1dabb8037a284eba491c34b27a257768e416c (diff) | |
download | libgit2-bb9e3797ba08c8cb0e88b2e1dc63959fa8f084a9.tar.gz |
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 #4203
-rw-r--r-- | src/merge.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/merge.c b/src/merge.c index 72cfa464d..e9616a958 100644 --- a/src/merge.c +++ b/src/merge.c @@ -3239,6 +3239,9 @@ int git_merge( assert(repo && their_heads); + git_repository_index(&index, repo); + git_index_read(index, 0); + if (their_heads_len != 1) { giterr_set(GITERR_MERGE, "can only merge a single branch"); return -1; |