diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..c28b485 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "libgit2"] + path = libgit2 + url = ./vendor/libgit2 +[submodule "vendor/libgit2"] + path = vendor/libgit2 + url = https://github.com/libgit2/libgit2 diff --git a/Makefile b/Makefile index 7d7475c..4ecc8a4 100644 --- a/Makefile +++ b/Makefile @@ -3,11 +3,6 @@ default: test build-libgit2: ./script/build-libgit2-static.sh -update-libgit2: - cd vendor/libgit2 && \ - git fetch origin development && \ - git checkout -qf FETCH_HEAD - test: build-libgit2 ./script/with-static.sh go test ./... diff --git a/README.md b/README.md index 15e906c..9a48709 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,12 @@ Go bindings for [libgit2](http://libgit2.github.com/). These bindings are for to Installing ---------- -Just `go get github.com/libgit2/git2go`. You'll need to have top-of-the-branch libgit2 from development installed in your system and available via `pkg-config`. These bindings are in sync with the top of `development`. +This project needs libgit2, which is written in C so we need to take an extra step. Run `go get github.com/libgit2/git2go` and go to your `$GOROOT/src/github.com/libgt2/git2go` dir. From there, we need to build the C code and put it into the resulting go binary. + + git submodule update --init + make install + +will compile libgit2, build it statically into git2go and install the resulting object file where your Go project can use it. License ------- diff --git a/script/build-libgit2-static.sh b/script/build-libgit2-static.sh index 04c649d..e486d1d 100755 --- a/script/build-libgit2-static.sh +++ b/script/build-libgit2-static.sh @@ -4,11 +4,6 @@ set -ex VENDORED_PATH=vendor/libgit2 -# Make sure we have the latest libgit2 -if [ ! -d $VENDORED_PATH ]; then - git clone --depth 1 --single-branch git://github.com/libgit2/libgit2 $VENDORED_PATH -fi - cd $VENDORED_PATH cmake -DTHREADSAFE=ON \ diff --git a/vendor/libgit2 b/vendor/libgit2 new file mode 160000 index 0000000..716e20b --- /dev/null +++ b/vendor/libgit2 @@ -0,0 +1 @@ +Subproject commit 716e20b47eb82ebd94588fe6c950e661b6fe4f15