mirror of
https://git.proxmox.com/git/libgit2
synced 2025-12-30 18:05:30 +00:00
This adds an example implementation that emulates git cat-file. It is a convenient and relatively simple example of getting data out of a repository. Implementing this also revealed that there are a number of APIs that are still not using const pointers to objects that really ought to be. The main cause of this is that `git_vector_bsearch` may need to call `git_vector_sort` before doing the search, so a const pointer to the vector is not allowed. However, for tree objects, with a little care, we can ensure that the vector of tree entries is always sorted and allow lookups to take a const pointer. Also, the missing const in commit objects just looks like an oversight. |
||
|---|---|---|
| .. | ||
| network | ||
| test | ||
| .gitignore | ||
| cat-file.c | ||
| diff.c | ||
| general.c | ||
| Makefile | ||
| README.md | ||
| rev-list.c | ||
| showindex.c | ||
libgit2 examples
These examples are meant as thin, easy-to-read snippets for Docurium (https://github.com/github/docurium) rather than full-blown implementations of Git commands. They are not vetted as carefully for bugs, error handling, or cross-platform compatibility as the rest of the code in libgit2, so copy with some caution.
For HTML versions, check "Examples" at http://libgit2.github.com/libgit2