[x] I grant such license of my work as is required for the purposes of future print editions to Ben Straub and Scott Chacon.
Changes
Rather than code snippet, inflated to a concrete program that can be compiled and demonstrated.
Edited the paragraph following accordingly.
Context
For people using libgit2 in C, it may be more useful to have an actual program that one can compile rather than just the code snippets. I think it is neither that many more lines than before, nor any difficult line, so it shouldn't confuse anyone.
Also without the initialization by calling git_libgit2_init(), the error variable holds GIT_ERROR (generic error), so I decided to include it (and subsequently, git_libgit2_shutdown() for freeing the global state.)
Changes
Context
For people using libgit2 in C, it may be more useful to have an actual program that one can compile rather than just the code snippets. I think it is neither that many more lines than before, nor any difficult line, so it shouldn't confuse anyone.
Also without the initialization by calling git_libgit2_init(), the error variable holds GIT_ERROR (generic error), so I decided to include it (and subsequently, git_libgit2_shutdown() for freeing the global state.)