Move to use git_remote_push() instead of doing the steps ourselves. We
also change to accept a list of refspecs instead of just the one refspec
for the push method.
As part of this, we no longer error out if the server rejected any
updates, as this is a different concern from whether the push itself
failed or not. We do still error out if we attempt to push non-ff
updates.
Apart from the usual API changes, we now need to introduce the concept
of whether we still own the C object underneath our Repository and
Remote objects.
When using the custom callbacks for repository and remote creation
during clone, we pass the pointer and thus ownership of the object back
to the library. We will then get the repository back at the end.
We return the object which was handed to us rather than opening the
repository again with the local path as there is now a much higher
chance that the cloned repository does not use the standard backends.
Initializers for the char * fields of the git_repository_init_options
structure must be cdata pointers.
Signed-off-by: Lukas Fleischer <info@cryptocrack.de>
Add a description of the possible flags and turn the "tuple" into a
"list", as it had already happened in code and part of the documentation
in aa5877e0.
The git-branch recipe says: »Note that the next release will probably
allow repo.listall_branches().« Concluding from the README,
Repository.listall_branches() was included in some release prior to
0.20.0, so at least that statement is obsolete.
However, since pygit2.org brings up fairly accurate results for a search
on »list all branches«, I figured that the whole recipe isn't needed
anymore. Therefore delete it.
This lets us look up remotes by name, which is not possible by just
returning the list of remotes.
Move remote creation to Repostiory.remotes.create() and keep the old
Repository.create_remote() for compatibility, delegating to this new
way.
Existing code should keep working, but this moves us towards what we'd
need for a better interface in 0.22 which makes remote renaming and
deleting work with a name rather than an instance and would make sense
to exist as part of an Remote.remotes object.
It is not possible to know how we can free the results of this
allocation, so we shouldn't be using this function.
We have a convention of returning Oid objects in pygit2, so let's keep
to that in these places.
I've gone with taking a string and converting it because the depth of
the namespacing in the libgit2 name is rather large and we don't care
about the global namespace that C has; and this also lets us pass the
same as the '-X' option to git-merge.
Avoid:
>>> repo.default_signature()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: '_pygit2.Signature' object is not callable