I have choose the following algorythm of pull:
- fetch()
- get current head commit
- get all not merged commits (realisation taken from here: How can I check if pull is needed using libgit2 in c++?)
- get first not merged commit (it is newest) from step
3. - merge commits. From LastFetchedCommit (step 4) into headCommit (step 2).
1-4 works perfectly
I have a problems with 5:
git_merge_commits(&rezPointer, repo.pointer , commitFrom.pointer, commitInto.pointer, &mrgOptions)
I'm trying to pull remote repo that have 2 additional commits relatively to local repo.
error:
Error Domain=lib.git_index_write_tree failed: Failed to write tree. the index file is not backed up by an existing repository Code=-1 "Failed to write tree. the index file is not backed up by an existing repository" UserInfo={NSLocalizedDescription=Failed to write tree. the index file is not backed up by an existing repository, NSLocalizedFailureReason=git_index_write_tree failed.}
do I did something wrong?