Let Reference.peel()'s argument be optional, and default to GIT_OBJ_ANY,
which mirrors the behaviour of get_object().
Since we reimplement the get_object() behaviour, change it to call
peel() which makes sure we can keep using the old tests for this aspect.
libgit2 provides an initialization function to set sane defaults. Use
that instead of setting the version by hand, as that's not the only
thing it does.
Using C.git_clone_init_options() sets the checkout strategy to SAFE,
which will checkout the files after the clone, instead of the implicit
NONE which we're setting by hand.
This fixes #425,
Add Repository.write_archive() to write a given tree to an archive. As
there are many customisation options, we only provide a method to write
to an archive which is created by the user.
Following from the previous commits, make 'head' read-only and provide a
method to update head while providing a message.
The checkout() codepath which switches branches has been updated to
provide a reflog entry which mimics git's.
When setting the callbacks fails, we want to clear self._self_handle so
we don't leak a pointer to ourselves.
The current code used a 'finally' clause which clears it
unconditionally, which means that by the time the fetch starts, we have
no guarantee that the handle will be valid.
Replace that with an except and re-raise to make sure we only clear it
here if there was an error.
The expectation is set with Repository.checkout()'s default strategy and
the documentation text that we will write the merged content of the
files to the workdir. We however fail to override the default checkout
strategy when calling git_merge() which results in a DRY_RUN strategy
and no files being changed.
Set the checkout strategy to SAFE_CREATE to match expectations and text.
This requires fairly little work on the pygit2 side to kick off all the
searching on the libgit2 side, so it's a fairly good candidate.
This changes the return value for the commit ids to Oid instead of
strings, which is what we generally try to return.
Updating the target of a reference is not like setting a property. It
involves appending to the reflog under the same lock, so we must do it
all the same time. Thus setting the target becomes a function which
takes the new target and what the use would like to add to the reflog.
We were missing a cast to bytes. Add a test for this option as well and
remove the old commented-out test for checkout_branch, which is
superseded by this one and whose last bit seemed confused about what the
option means.
This fixes #399