Git to Go; bindings for libgit2. Like McDonald's but tastier.
Go to file
Carlos Martín Nieto c4fce1a218 Update to libgit2 d675982a153
There's been some changes to the checkout strategy, especially the
SAFE_CREATE mode, which is now the RECREATE_MISSING flag, though that
shouldn't be necessary to use in the general case.

The largest changes come from the removal of the signture from
ref-modifying functions/methods and the removal of the reflog string in
all but those directly related to moving references.
2015-03-15 01:49:32 +01:00
script Revert "Make the cgo tool do more linking work" 2014-12-31 19:43:20 +00:00
vendor Update to libgit2 d675982a153 2015-03-15 01:49:32 +01:00
.gitmodules Remove left-over submodule configuration 2014-06-07 19:29:45 +02:00
.travis.yml travis: build with Go 1.3 2014-07-03 08:48:41 +02:00
LICENSE Initial commit 2013-03-05 20:53:04 +01:00
Makefile Revert "Make the cgo tool do more linking work" 2014-12-31 19:43:20 +00:00
README.md Correct README on what master tracks 2015-03-15 01:19:32 +01:00
blame.go add (*Blame).HunkByLine (git_blame_get_hunk_byline) and test 2014-11-18 05:06:03 -08:00
blame_test.go add (*Blame).HunkByLine (git_blame_get_hunk_byline) and test 2014-11-18 05:06:03 -08:00
blob.go Remove useless includes 2014-12-11 02:59:07 +01:00
blob_test.go Add a test for blobs 2014-10-15 16:59:19 +02:00
branch.go Update to libgit2 d675982a153 2015-03-15 01:49:32 +01:00
branch_test.go Add BranchIterator#ForEach. 2015-02-19 11:44:56 +01:00
checkout.go Update to libgit2 d675982a153 2015-03-15 01:49:32 +01:00
cherrypick.go Cherrypick 2015-03-04 15:52:54 -08:00
cherrypick_test.go Update to libgit2 d675982a153 2015-03-15 01:49:32 +01:00
clone.go Add TargetDirectory field to Checkout options. 2015-01-29 15:17:46 +01:00
clone_test.go Clean up after the tests 2014-03-19 08:15:19 +01:00
commit.go Add commit summary getter 2015-03-04 15:53:00 -08:00
config.go Add Go functions for git_config_find_* functions 2015-01-14 13:38:35 -08:00
credentials.go Remove useless includes 2014-12-11 02:59:07 +01:00
diff.go Add git_diff_get_stats() 2015-01-04 12:13:46 +00:00
diff_test.go Add git_diff_get_stats() 2015-01-04 12:13:46 +00:00
git.go Update to libgit2 master 2015-01-04 17:05:11 +00:00
git_test.go Cherrypick 2015-03-04 15:52:54 -08:00
graph.go Remove "Graph" prefix on method names 2015-02-12 18:49:54 +01:00
index.go Remove useless includes 2014-12-11 02:59:07 +01:00
index_test.go implemented Index.AddAll, Index.RemoveAll, Index.UpdateAll 2014-10-24 21:55:08 +02:00
merge.go Add TargetDirectory field to Checkout options. 2015-01-29 15:17:46 +01:00
merge_test.go Update to master 2014-12-03 17:26:55 +01:00
note.go define Note methods on pointers 2015-01-08 11:03:15 -08:00
note_test.go Add git note support 2015-01-07 11:56:33 -08:00
object.go go fmt 2015-03-04 15:52:59 -08:00
object_test.go Give Object and Reference an Onwer accessor 2014-05-25 09:12:10 +02:00
odb.go go fmt 2015-03-04 15:52:59 -08:00
odb_test.go go fmt 2015-03-04 15:52:59 -08:00
packbuilder.go go fmt 2015-03-04 15:52:59 -08:00
patch.go Add missing thread-locking 2014-12-11 02:46:42 +01:00
patch_test.go Fix test to force diff prefixes. 2015-01-30 13:44:29 +09:00
push_test.go Update to libgit2 d675982a153 2015-03-15 01:49:32 +01:00
refdb.go Remove useless includes 2014-12-11 02:59:07 +01:00
reference.go Update to libgit2 d675982a153 2015-03-15 01:49:32 +01:00
reference_test.go Update to libgit2 d675982a153 2015-03-15 01:49:32 +01:00
remote.go Update to libgit2 d675982a153 2015-03-15 01:49:32 +01:00
remote_test.go Update to libgit2 d675982a153 2015-03-15 01:49:32 +01:00
repository.go Update to libgit2 d675982a153 2015-03-15 01:49:32 +01:00
revparse.go Remove useless includes 2014-12-11 02:59:07 +01:00
revparse_test.go Update to libgit2 d675982a153 2015-03-15 01:49:32 +01:00
settings.go Move the settings into the main git2go 2014-06-07 18:57:46 +02:00
settings_test.go Move the settings into the main git2go 2014-06-07 18:57:46 +02:00
signature.go Default signature 2015-03-04 15:52:57 -08:00
status.go go fmt 2015-03-04 15:52:59 -08:00
status_test.go Repository state 2015-03-04 15:52:52 -08:00
submodule.go Update to libgit2 d675982a153 2015-03-15 01:49:32 +01:00
submodule_test.go Add test triggering ForeachSubmodule panic. 2015-01-28 15:07:27 +01:00
tag.go add support for annotated tags 2014-06-09 23:19:17 +02:00
tag_test.go go fmt 2015-03-04 15:52:59 -08:00
tree.go Update libgit2 2014-12-18 22:59:08 +00:00
walk.go Remove useless includes 2014-12-11 02:59:07 +01:00
wrapper.c Update to libgit2 master 2015-01-04 17:05:11 +00:00

README.md

git2go

GoDoc Build Status

Go bindings for libgit2. The master branch follows the latest libgit2 release. The versioned branches indicate which libgit2 version they work against.

Installing

This project wraps the functionality provided by libgit2. If you're using a stable version, install it to your system via your system's package manger and then install git2go as usual.

Otherwise (next which tracks an unstable version), we need to build libgit2 as well. In order to build it, you need cmake, pkg-config and a C compiler. You will also need the development packages for OpenSSL and LibSSH2 installed if you want libgit2 to support HTTPS and SSH respectively.

Stable version

git2go has master which tracks the latest release of libgit2, and versioned branches which indicate which version of libgit2 they work against. Install the development package it on your system via your favourite package manager or from source and you can use a service like gopkg.in to use the appropriate version. For the libgit2 v0.22 case, you can use

import "gopkg.in/libgit2/git2go.v22"

to use a version of git2go which will work against libgit2 v0.22 and dynamically link to the library. You can use

import "github.com/libgit2/git2go"

to use the version which works against the latest release.

From next

The next branch follows libgit2's master branch, which means there is no stable API or ABI to link against. git2go can statically link against a vendored version of libgit2.

Run go get -d github.com/libgit2/git2go to download the code and go to your $GOPATH/src/github.com/libgit2/git2go dir. From there, we need to build the C code and put it into the resulting go binary.

git checkout next
git submodule update --init # get libgit2
make install

will compile libgit2 and run go install such that it's statically linked to the git2go package.

Paralellism and network operations

libgit2 uses OpenSSL and LibSSH2 for performing encrypted network connections. For now, git2go asks libgit2 to set locking for OpenSSL. This makes HTTPS connections thread-safe, but it is fragile and will likely stop doing it soon. This may also make SSH connections thread-safe if your copy of libssh2 is linked against OpenSSL. Check libgit2's THREADSAFE.md for more information. [ Running the tests

For the stable version, go test will work as usual. For the next branch, similarly to installing, running the tests requires linking against the local libgit2 library, so the Makefile provides a wrapper

make test

alternatively, if you want to pass arguments to go test, you can use the script that sets it all up

./script/with-static.sh go test -v

which will run the specified arguments with the correct environment variables.

License

M to the I to the T. See the LICENSE file if you've never seen a MIT license before.

Authors

  • Carlos Martín (@carlosmn)
  • Vicent Martí (@vmg)