When iterating over a tree, its entries show up as objects with an
address, which makes it hard to distinguish.
Add a method to handle repr and make it easier to play around with them
in the console.
These are only needed in C code. With Python files the signatures are
automatically generated. The only drawback is the return value is not
included in the signature, so document it in the body of the docstring.
It's not necessarily obvious how to perform a mirror, so add a recipe
which tells what git does as well as provide example code of how to
perform the same steps in pygit2.
The path test/data/testrepo was mistakenly added as a submodule and the
error was not caught before merging. Remove this path as it should not
exist on the repo.
In b3025e3fe I had written that when following my recipe, the repository
remains in cherry-picking mode afterwards. In issue #516 I was told that
Repository.state_cleanup() is needed to correct that. Therefore add it
to the recipe.
Also add a note near the documentation for cherry-pick, so that nobody
will overlook this again. Apparently there are other times when you need
to do Repository.state_cleanup() as well, but it's not documented, I
don't know when and I don't want to take the time and find out. So leave
it at that for now.
I'm not the guy who looks at examples in the first place and I guess
there are other people like me. When I wanted find out how to get
information out of a Diff, I looked at the documented methods and didn't
find anything. Only later @cmn showed me the [p for p in diff] example
in the documentation. Add a short piece of information that gives a hint
to those who prefer the dry API docs.
IndexEntry._to_c requires its caller to hold a reference to the path it
returns until it no longer needs the C structure.
Repository.merge_file_from_index was not doing so, causing the merge
text to contain garbage from freed memory in some cases.
In the online documentation to Pygit2 it was not visible that (some of)
the parameters to Remote.fetch() and Remote.push() were optional. Fix
this. (I'm not sure if the way I did it is the idiomatic way of marking
a parameter optional in Python docstrings.)
Add the way that worked for me. Not sure if it is idiomatic. When doing
the convenience-mode cherry-pick, the repo remains in cherry-picking
mode afterwards. I've already added an issue for this.
The submodule type has been implemented as a C type. When opening
a submodule's repository this leads to the bug that instead of an
actual pygit2.Repository being instantiated we only create an
object of the C Repository type.
As this is not trivially fixed within the C code, reimplement the
submodule type as a Python interface with CFFI. As submodules
provide no functionality that is usually accessed repeatedly the
code paths should not prove performance critical. In addition,
maintainability is improved by this reimplementation.
When merging index entries where the corresponding files contain Unicode
codepoints an error is thrown. Decode the C string using UTF-8 to fix the issue
and adjust the test case for merging files to contain umlauts to catch such
errors.
The function we were using `git_tree_entry_cmp()` is only meant for
git-compatible sorting in a tree and thus does not take the id into
account. This is however important in order to keep value equality. In
order to avoid issues with assymetry, we compare the id any time when
two entries are equal according to their position in a tree.