Git to Go; bindings for libgit2. Like McDonald's but tastier.
Go to file
Carlos Martín Nieto 2e17c3d55f Merge pull request #280 from ebfe/hint-path
Don't drop CreateBlobFromChunks hintPath argument
2016-01-15 22:22:36 +01:00
script Install v23 on Travis 2015-08-31 16:07:37 +02:00
.travis.yml Test against Go 1.5 2015-08-31 16:07:37 +02:00
LICENSE Initial commit 2013-03-05 20:53:04 +01:00
Makefile remove static git support files 2015-02-13 21:43:16 -05:00
README.md Fix typo in README: manaager -> manager 2015-10-06 15:12:49 -05:00
blame.go add (*Blame).HunkByLine (git_blame_get_hunk_byline) and test 2014-11-18 05:06:03 -08:00
blame_test.go tests: always clean up temporary repository dirs 2015-04-24 13:01:51 +02:00
blob.go Don't drop CreateBlobFromChunks hintPath argument 2016-01-04 15:02:21 +01:00
blob_test.go tests: always clean up temporary repository dirs 2015-04-24 13:01:51 +02:00
branch.go Merge branch 'next' 2015-08-31 13:55:46 +02:00
branch_test.go tests: always clean up temporary repository dirs 2015-04-24 13:01:51 +02:00
checkout.go Expose baseline field in CheckoutOptions 2015-09-18 09:50:59 -04:00
cherrypick.go Cherrypick 2015-03-04 15:52:54 -08:00
cherrypick_test.go Merge remote-tracking branch 'origin/master' into next 2015-06-08 04:07:49 +02:00
clone.go Don't call the finalizer on a borrowed repository 2015-08-31 16:07:37 +02:00
clone_test.go Merge branch 'next' 2015-08-31 13:55:46 +02:00
commit.go Add Commit.Amend 2015-03-23 12:02:16 -07:00
config.go Config#LookupString uses git_buf to load value 2015-10-08 09:37:36 -07:00
config_test.go config_test: properly detect failed config writes 2015-11-02 16:00:04 -05:00
credentials.go Remove useless includes 2014-12-11 02:59:07 +01:00
describe.go Add git-describe support 2015-07-31 22:39:33 +02:00
describe_test.go Add git-describe support 2015-07-31 22:39:33 +02:00
diff.go Add DiffBlobs 2015-06-29 21:29:47 +02:00
diff_test.go Add DiffBlobs 2015-06-29 21:29:47 +02:00
git.go Merge branch 'next' 2015-08-31 13:55:46 +02:00
git_test.go tests: always clean up temporary repository dirs 2015-04-24 13:01:51 +02:00
graph.go Remove "Graph" prefix on method names 2015-02-12 18:49:54 +01:00
handles.go Prevent slot int variable from being GCed. 2015-07-26 15:02:40 -07:00
index.go Fix memory leaks in NewIndex() and OpenIndex() 2015-10-27 15:20:50 +09:00
index_test.go Fix test error messages 2015-05-30 22:27:08 +02:00
merge.go Mention that MergeAnalysis is a bitmask 2015-10-26 21:22:22 +01:00
merge_test.go Merge remote-tracking branch 'origin/master' into next 2015-08-04 14:59:10 +02:00
note.go Create a NotesCollection for managing notes 2015-06-28 01:19:22 +02:00
note_test.go Create a NotesCollection for managing notes 2015-06-28 01:19:22 +02:00
object.go Add ability to peel any git object 2015-08-01 14:28:20 +02:00
object_test.go Add ability to peel any git object 2015-08-01 14:28:20 +02:00
odb.go odb: remove debug fmt.Printlns 2015-11-02 16:00:19 -05:00
odb_test.go Update to libgit2 b6011e29 2015-06-08 04:11:21 +02:00
packbuilder.go packbuilder: use HandleList for C function callbacks. 2015-05-22 09:02:24 +02:00
patch.go Add missing thread-locking 2014-12-11 02:46:42 +01:00
patch_test.go tests: always clean up temporary repository dirs 2015-04-24 13:01:51 +02:00
push_test.go Create a ReferenceCollection for managing references 2015-06-28 01:12:32 +02:00
refdb.go Remove useless includes 2014-12-11 02:59:07 +01:00
reference.go Add ReferenceIsValidName() 2015-07-24 12:14:53 +03:00
reference_test.go Add ReferenceIsValidName() 2015-07-24 12:14:53 +03:00
remote.go Fix Fetch/Push memory allocation problems 2015-11-12 21:15:24 -05:00
remote_test.go Create a ReferenceCollection for managing references 2015-06-28 01:12:32 +02:00
repository.go Move CreateTag to the tags collection 2015-07-31 20:23:05 +02:00
reset.go Add support for libgit2's git_reset. 2015-03-21 18:37:00 -04:00
reset_test.go Add support for libgit2's git_reset. 2015-03-21 18:37:00 -04:00
revparse.go Remove useless includes 2014-12-11 02:59:07 +01:00
revparse_test.go Create a ReferenceCollection for managing references 2015-06-28 01:12:32 +02: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 Fix crash when using Pathspec in StatusOptions 2015-09-18 10:48:26 +02:00
status_test.go tests: always clean up temporary repository dirs 2015-04-24 13:01:51 +02:00
submodule.go Submodule: use the Repository constructor 2015-06-30 19:12:39 +02:00
submodule_test.go Create a SubmoduleCollection for managing submodules 2015-06-28 00:58:31 +02:00
tag.go Move CreateTag to the tags collection 2015-07-31 20:23:05 +02:00
tag_test.go Move CreateTag to the tags collection 2015-07-31 20:23:05 +02:00
tree.go Find tree entry by id 2015-07-24 19:52:51 +03:00
tree_test.go Find tree entry by id 2015-07-24 19:52:51 +03:00
walk.go Don't trat a revwalk's ITEROVER as an error 2015-08-31 13:13:27 +02:00
wrapper.c Merge branch 'next' 2015-08-31 13:55:46 +02: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 manager 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 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 directory. 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. Run go install so that it's statically linked to the git2go package.

Parallelism 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)