From a062f17c598c7bd91a44e480e2bc79883bc0917d Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Thu, 23 Jul 2020 11:14:06 +0200 Subject: cmd: Add gitaly-git2go command This adds a new gitaly-git2go command that is currently intended as a proof-of-concept for our Git2Go build framework. It thus doesn't do much except demonstrating it's possible to link against Git2Go and its bundled lbigit2 static archive and use its functionality. At a later point, this is going to be the entrypoint for any Git functionality that we want to implement via Git2Go. --- cmd/gitaly-git2go/main.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 cmd/gitaly-git2go/main.go (limited to 'cmd/gitaly-git2go') diff --git a/cmd/gitaly-git2go/main.go b/cmd/gitaly-git2go/main.go new file mode 100644 index 000000000..a11cfcad8 --- /dev/null +++ b/cmd/gitaly-git2go/main.go @@ -0,0 +1,23 @@ +package main + +import ( + "os" + + git "github.com/libgit2/git2go/v30" +) + +func main() { + repo, err := git.OpenRepository(".") + if err != nil { + os.Exit(1) + } + defer repo.Free() + + head, err := repo.Head() + if err != nil { + os.Exit(1) + } + defer head.Free() + + println(head.Target().String()) +} -- cgit v1.2.3