Does the libgit2 project or anyone else provide sample code to demonstrate the various libgit2 functions?

守給你的承諾、 提交于 2019-12-23 12:24:36

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!