Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2020-07-23 12:14:06 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2020-07-29 10:16:59 +0300
commita062f17c598c7bd91a44e480e2bc79883bc0917d (patch)
tree4597209d447a5ffa7281b2ce5bcb8d0d579c1a2e /cmd/gitaly-git2go
parentba589ce1e76215a5914d397fcbbd9c112541fd51 (diff)
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.
Diffstat (limited to 'cmd/gitaly-git2go')
-rw-r--r--cmd/gitaly-git2go/main.go23
1 files changed, 23 insertions, 0 deletions
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())
+}