I have choose the following algorythm of pull:
3.
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?
That could be as described in issue 2668
If I call
git_index_write_tree()
, it fails with Failed to write tree.The index file is not backed up by an existing repository
.That's what
git_index_write_tree_to()
is for.But it's not about bare vs non-bare, it's about whether you asked the repository for an index or if you created one without any associations.
A bit like in issue 5015, where a reference to the index is explicitly set, and used (without error message):
git_repository *src, *dst;
git_index *index;
git_oid id;
git_libgit2_init();
err = git_repository_open(&src, "src");
err = git_repository_open(&dst, "dst");
err = git_repository_index(&index, src);
err = git_index_write_tree_to(&id, index, dst);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With