diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2020-07-23 12:14:06 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2020-07-29 10:16:59 +0300 |
commit | a062f17c598c7bd91a44e480e2bc79883bc0917d (patch) | |
tree | 4597209d447a5ffa7281b2ce5bcb8d0d579c1a2e | |
parent | ba589ce1e76215a5914d397fcbbd9c112541fd51 (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.
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | cmd/gitaly-git2go/main.go | 23 |
2 files changed, 24 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore index 25909590c..35e7aeb1f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ /_build /config.mak /gitaly +/gitaly-git2go /gitaly-hooks cmd/gitaly-ssh/gitaly-ssh /gitaly-ssh 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()) +} |