git library for Go

前端 未结 6 2008
时光说笑
时光说笑 2021-02-03 23:15

As a pet project, I want to develop a note taking app using git as storage backend. (I suspect this doesn\'t exist yet, given this guy\'s blog post: http://jarofgreen.co.uk/2012

6条回答
  •  Happy的楠姐
    2021-02-03 23:29

    What Victor proposed is indeed the "official" way to "script" Git as envisioned by its developers. Git's commands are divided in the two broad groups specifically for this purpose: the "plumbing" commands are low-level and inteneded mostly to be used by other programs; the "porcelain" command are intended to interact with the user, and call plumbing commands to do their work. Look inside the /usr/lib/git-core directory (might be different on your system) to get the idea of how many plumbing commands Git has.

    On the other hand, Go supports linking with shared libraries via its cgo facility. You hence could try wrapping libgit2 with it. AFAIK, libgit2 is not yet fully on par with the Git itself, but it is able to read/write Git repositories, do branching etc — supposedly it will be enough for your task.

    Okay, after I wrote all that, I scrolled down the "Bindings" entry on the libgit2's site and found go-git...

提交回复
热议问题