问题
I am using libgit2 via an FFI in another language but I am having difficulty figuring out what various functions actually do (and I'd prefer not to resort to reading the source code unless absolutely necessary). Does anyone know where I can find some working code samples for some of the functions in libgit2?
回答1:
There are many ways to help you get a start with libgit2:
- A series of posts from Ben Straub, one of the core contributors
- Taking a peek at the libgit2 examples which are written in a very easily understandable C code
- Reading through the headers which describe each function, expected parameters and produced output
- Another angle would be to look at the libgit2 tests which emphasize the behavioral contract of each function, or, if you're more familiar with other languages, peek at the test code of some of libgit2 bindings and then dive into the way they're exercising libgit2
- C# -> LibGit2Sharp
- Ruby -> Rugged
- Python -> Pygit2
回答2:
From https://libgit2.github.com/, there's the 101 Samples guide.
来源:https://stackoverflow.com/questions/16780587/does-the-libgit2-project-or-anyone-else-provide-sample-code-to-demonstrate-the-v