Skip to content

Commit c734fc2

Browse files
committed
Use a submodule for libgit2
This makes building the static version easier as we know where the repo is and that it's has a known-good version.
1 parent 0646294 commit c734fc2

File tree

5 files changed

+13
-11
lines changed

5 files changed

+13
-11
lines changed

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "libgit2"]
2+
path = libgit2
3+
url = ./vendor/libgit2
4+
[submodule "vendor/libgit2"]
5+
path = vendor/libgit2
6+
url = https://github.com/libgit2/libgit2

Makefile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ default: test
33
build-libgit2:
44
./script/build-libgit2-static.sh
55

6-
update-libgit2:
7-
cd vendor/libgit2 && \
8-
git fetch origin development && \
9-
git checkout -qf FETCH_HEAD
10-
116
test: build-libgit2
127
./script/with-static.sh go test ./...
138

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ Go bindings for [libgit2](http://libgit2.github.com/). These bindings are for to
66
Installing
77
----------
88

9-
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`.
9+
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.
10+
11+
git submodule update --init
12+
make install
13+
14+
will compile libgit2, build it statically into git2go and install the resulting object file where your Go project can use it.
1015

1116
License
1217
-------

script/build-libgit2-static.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ set -ex
44

55
VENDORED_PATH=vendor/libgit2
66

7-
# Make sure we have the latest libgit2
8-
if [ ! -d $VENDORED_PATH ]; then
9-
git clone --depth 1 --single-branch git://github.com/libgit2/libgit2 $VENDORED_PATH
10-
fi
11-
127
cd $VENDORED_PATH
138

149
cmake -DTHREADSAFE=ON \

vendor/libgit2

Submodule libgit2 added at 716e20b

0 commit comments

Comments
 (0)