diff options
-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()) +} |