summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlhchavez <[email protected]>2019-01-08 02:51:21 +0000
committerlhchavez <[email protected]>2019-01-08 02:51:21 +0000
commit6d67bde74a667dcdd060ef519832e8fd81064a8e (patch)
tree705e564b9dedf0ceced47e6f01012cb9fcb6322f
parent35518c78df9ae727651212512bfaa1a8dae02585 (diff)
parent2609f4c6f25a7da56e2e4960c250ea3dfb53e82b (diff)
Merge remote-tracking branch 'upstream/master' into repository-create_commit_from_ids
-rw-r--r--.gitignore1
-rw-r--r--checkout.go2
-rw-r--r--config.go2
-rw-r--r--config_test.go2
-rw-r--r--git.go14
-rw-r--r--git_static.go7
-rw-r--r--go.mod1
-rw-r--r--index.go14
-rw-r--r--index_test.go26
-rw-r--r--merge.go24
-rw-r--r--object.go14
-rw-r--r--odb.go38
-rw-r--r--odb_test.go49
-rw-r--r--packbuilder.go13
-rw-r--r--rebase.go21
-rw-r--r--reference.go2
-rw-r--r--repository.go2
-rw-r--r--reset_test.go2
-rwxr-xr-xscript/build-libgit2-static.sh17
-rw-r--r--signature.go2
m---------vendor/libgit20
21 files changed, 187 insertions, 66 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..edc18d5
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/static-build/
diff --git a/checkout.go b/checkout.go
index db3118f..2b12058 100644
--- a/checkout.go
+++ b/checkout.go
@@ -35,7 +35,7 @@ const (
CheckoutDontUpdateIndex CheckoutStrategy = C.GIT_CHECKOUT_DONT_UPDATE_INDEX // Normally checkout updates index entries as it goes; this stops that
CheckoutNoRefresh CheckoutStrategy = C.GIT_CHECKOUT_NO_REFRESH // Don't refresh index/config/etc before doing checkout
CheckoutSkipUnmerged CheckoutStrategy = C.GIT_CHECKOUT_SKIP_UNMERGED // Allow checkout to skip unmerged files
- CheckoutUserOurs CheckoutStrategy = C.GIT_CHECKOUT_USE_OURS // For unmerged files, checkout stage 2 from index
+ CheckoutUseOurs CheckoutStrategy = C.GIT_CHECKOUT_USE_OURS // For unmerged files, checkout stage 2 from index
CheckoutUseTheirs CheckoutStrategy = C.GIT_CHECKOUT_USE_THEIRS // For unmerged files, checkout stage 3 from index
CheckoutDisablePathspecMatch CheckoutStrategy = C.GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH // Treat pathspec as simple list of exact match file paths
CheckoutSkipLockedDirectories CheckoutStrategy = C.GIT_CHECKOUT_SKIP_LOCKED_DIRECTORIES // Ignore directories in use, they will be left empty
diff --git a/config.go b/config.go
index 8dfe0af..7260089 100644
--- a/config.go
+++ b/config.go
@@ -344,7 +344,7 @@ func (c *Config) OpenLevel(parent *Config, level ConfigLevel) (*Config, error) {
}
// OpenOndisk creates a new config instance containing a single on-disk file
-func OpenOndisk(parent *Config, path string) (*Config, error) {
+func OpenOndisk(path string) (*Config, error) {
cpath := C.CString(path)
defer C.free(unsafe.Pointer(cpath))
diff --git a/config_test.go b/config_test.go
index 196d4ad..398236e 100644
--- a/config_test.go
+++ b/config_test.go
@@ -13,7 +13,7 @@ func setupConfig() (*Config, error) {
err error
)
- c, err = OpenOndisk(nil, tempConfig)
+ c, err = OpenOndisk(tempConfig)
if err != nil {
return nil, err
}
diff --git a/git.go b/git.go
index a1c07f6..968d404 100644
--- a/git.go
+++ b/git.go
@@ -189,22 +189,16 @@ func (oid *Oid) Cmp(oid2 *Oid) int {
}
func (oid *Oid) Copy() *Oid {
- ret := new(Oid)
- copy(ret[:], oid[:])
- return ret
+ ret := *oid
+ return &ret
}
func (oid *Oid) Equal(oid2 *Oid) bool {
- return bytes.Equal(oid[:], oid2[:])
+ return *oid == *oid2
}
func (oid *Oid) IsZero() bool {
- for _, a := range oid {
- if a != 0 {
- return false
- }
- }
- return true
+ return *oid == Oid{}
}
func (oid *Oid) NCmp(oid2 *Oid, n uint) int {
diff --git a/git_static.go b/git_static.go
index 6303734..547ae8a 100644
--- a/git_static.go
+++ b/git_static.go
@@ -3,10 +3,9 @@
package git
/*
-#cgo CFLAGS: -I${SRCDIR}/vendor/libgit2/include
-#cgo LDFLAGS: -L${SRCDIR}/vendor/libgit2/build/ -lgit2
-#cgo windows LDFLAGS: -lwinhttp
-#cgo !windows pkg-config: --static ${SRCDIR}/vendor/libgit2/build/libgit2.pc
+#cgo windows CFLAGS: -I${SRCDIR}/static-build/install/include/
+#cgo windows LDFLAGS: -L${SRCDIR}/static-build/install/lib/ -lgit2 -lwinhttp
+#cgo !windows pkg-config: --static ${SRCDIR}/static-build/install/lib/pkgconfig/libgit2.pc
#include <git2.h>
#if LIBGIT2_VER_MAJOR != 0 || LIBGIT2_VER_MINOR != 27
diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000..688b8e3
--- /dev/null
+++ b/go.mod
@@ -0,0 +1 @@
+module github.com/libgit2/git2go
diff --git a/index.go b/index.go
index 5106516..dd13460 100644
--- a/index.go
+++ b/index.go
@@ -145,6 +145,20 @@ func (v *Index) Path() string {
return ret
}
+// Clear clears the index object in memory; changes must be explicitly
+// written to disk for them to take effect persistently
+func (v *Index) Clear() error {
+ runtime.LockOSThread()
+ defer runtime.UnlockOSThread()
+
+ err := C.git_index_clear(v.ptr)
+ runtime.KeepAlive(v)
+ if err < 0 {
+ return MakeGitError(err)
+ }
+ return nil
+}
+
// Add adds or replaces the given entry to the index, making a copy of
// the data
func (v *Index) Add(entry *IndexEntry) error {
diff --git a/index_test.go b/index_test.go
index f47dace..43644fa 100644
--- a/index_test.go
+++ b/index_test.go
@@ -3,6 +3,7 @@ package git
import (
"io/ioutil"
"os"
+ "path"
"runtime"
"testing"
)
@@ -59,14 +60,29 @@ func TestIndexWriteTreeTo(t *testing.T) {
repo := createTestRepo(t)
defer cleanupTestRepo(t, repo)
- repo2 := createTestRepo(t)
- defer cleanupTestRepo(t, repo2)
+ idx, err := NewIndex()
+ checkFatal(t, err)
- idx, err := repo.Index()
+ odb, err := repo.Odb()
checkFatal(t, err)
- err = idx.AddByPath("README")
+
+ content, err := ioutil.ReadFile(path.Join(repo.Workdir(), "README"))
+ checkFatal(t, err)
+
+ id, err := odb.Write(content, ObjectBlob)
checkFatal(t, err)
- treeId, err := idx.WriteTreeTo(repo2)
+
+ err = idx.Add(&IndexEntry{
+ Mode: FilemodeBlob,
+ Uid: 0,
+ Gid: 0,
+ Size: uint32(len(content)),
+ Id: id,
+ Path: "README",
+ })
+ checkFatal(t, err)
+
+ treeId, err := idx.WriteTreeTo(repo)
checkFatal(t, err)
if treeId.String() != "b7119b11e8ef7a1a5a34d3ac87f5b075228ac81e" {
diff --git a/merge.go b/merge.go
index adc521a..bc672ce 100644
--- a/merge.go
+++ b/merge.go
@@ -344,9 +344,29 @@ type MergeFileFlags int
const (
MergeFileDefault MergeFileFlags = C.GIT_MERGE_FILE_DEFAULT
- MergeFileStyleMerge MergeFileFlags = C.GIT_MERGE_FILE_STYLE_MERGE
- MergeFileStyleDiff MergeFileFlags = C.GIT_MERGE_FILE_STYLE_DIFF3
+ // Create standard conflicted merge files
+ MergeFileStyleMerge MergeFileFlags = C.GIT_MERGE_FILE_STYLE_MERGE
+
+ // Create diff3-style files
+ MergeFileStyleDiff MergeFileFlags = C.GIT_MERGE_FILE_STYLE_DIFF3
+
+ // Condense non-alphanumeric regions for simplified diff file
MergeFileStyleSimplifyAlnum MergeFileFlags = C.GIT_MERGE_FILE_SIMPLIFY_ALNUM
+
+ // Ignore all whitespace
+ MergeFileIgnoreWhitespace MergeFileFlags = C.GIT_MERGE_FILE_IGNORE_WHITESPACE
+
+ // Ignore changes in amount of whitespace
+ MergeFileIgnoreWhitespaceChange MergeFileFlags = C.GIT_MERGE_FILE_IGNORE_WHITESPACE_CHANGE
+
+ // Ignore whitespace at end of line
+ MergeFileIgnoreWhitespaceEOL MergeFileFlags = C.GIT_MERGE_FILE_IGNORE_WHITESPACE_EOL
+
+ // Use the "patience diff" algorithm
+ MergeFileDiffPatience MergeFileFlags = C.GIT_MERGE_FILE_DIFF_PATIENCE
+
+ // Take extra time to find minimal diff
+ MergeFileDiffMinimal MergeFileFlags = C.GIT_MERGE_FILE_DIFF_MINIMAL
)
type MergeFileOptions struct {
diff --git a/object.go b/object.go
index 66a4618..40ab2bf 100644
--- a/object.go
+++ b/object.go
@@ -13,12 +13,12 @@ import (
type ObjectType int
const (
- ObjectAny ObjectType = C.GIT_OBJ_ANY
- ObjectBad ObjectType = C.GIT_OBJ_BAD
- ObjectCommit ObjectType = C.GIT_OBJ_COMMIT
- ObjectTree ObjectType = C.GIT_OBJ_TREE
- ObjectBlob ObjectType = C.GIT_OBJ_BLOB
- ObjectTag ObjectType = C.GIT_OBJ_TAG
+ ObjectAny ObjectType = C.GIT_OBJECT_ANY
+ ObjectBad ObjectType = C.GIT_OBJECT_BAD
+ ObjectCommit ObjectType = C.GIT_OBJECT_COMMIT
+ ObjectTree ObjectType = C.GIT_OBJECT_TREE
+ ObjectBlob ObjectType = C.GIT_OBJECT_BLOB
+ ObjectTag ObjectType = C.GIT_OBJECT_TAG
)
type Object struct {
@@ -217,7 +217,7 @@ func (o *Object) Peel(t ObjectType) (*Object, error) {
runtime.LockOSThread()
defer runtime.UnlockOSThread()
- err := C.git_object_peel(&cobj, o.ptr, C.git_otype(t))
+ err := C.git_object_peel(&cobj, o.ptr, C.git_object_t(t))
runtime.KeepAlive(o)
if err < 0 {
return nil, MakeGitError(err)
diff --git a/odb.go b/odb.go
index f236fc4..5768cf4 100644
--- a/odb.go
+++ b/odb.go
@@ -8,6 +8,7 @@ extern void _go_git_odb_backend_free(git_odb_backend *backend);
*/
import "C"
import (
+ "io"
"reflect"
"runtime"
"unsafe"
@@ -60,12 +61,12 @@ func (v *Odb) ReadHeader(oid *Oid) (uint64, ObjectType, error) {
defer runtime.UnlockOSThread()
var sz C.size_t
- var cotype C.git_otype
+ var cotype C.git_object_t
ret := C.git_odb_read_header(&sz, &cotype, v.ptr, oid.toC())
runtime.KeepAlive(v)
if ret < 0 {
- return 0, C.GIT_OBJ_BAD, MakeGitError(ret)
+ return 0, ObjectBad, MakeGitError(ret)
}
return uint64(sz), ObjectType(cotype), nil
@@ -80,15 +81,19 @@ func (v *Odb) Exists(oid *Oid) bool {
func (v *Odb) Write(data []byte, otype ObjectType) (oid *Oid, err error) {
oid = new(Oid)
- var cptr unsafe.Pointer
- if len(data) > 0 {
- cptr = unsafe.Pointer(&data[0])
- }
runtime.LockOSThread()
defer runtime.UnlockOSThread()
- ret := C.git_odb_write(oid.toC(), v.ptr, cptr, C.size_t(len(data)), C.git_otype(otype))
+ var size C.size_t
+ if len(data) > 0 {
+ size = C.size_t(len(data))
+ } else {
+ data = []byte{0}
+ size = C.size_t(0)
+ }
+
+ ret := C.git_odb_write(oid.toC(), v.ptr, unsafe.Pointer(&data[0]), size, C.git_object_t(otype))
runtime.KeepAlive(v)
if ret < 0 {
return nil, MakeGitError(ret)
@@ -164,13 +169,19 @@ func (v *Odb) ForEach(callback OdbForEachCallback) error {
// Hash determines the object-ID (sha1) of a data buffer.
func (v *Odb) Hash(data []byte, otype ObjectType) (oid *Oid, err error) {
oid = new(Oid)
- header := (*reflect.SliceHeader)(unsafe.Pointer(&data))
- ptr := unsafe.Pointer(header.Data)
runtime.LockOSThread()
defer runtime.UnlockOSThread()
- ret := C.git_odb_hash(oid.toC(), ptr, C.size_t(header.Len), C.git_otype(otype))
+ var size C.size_t
+ if len(data) > 0 {
+ size = C.size_t(len(data))
+ } else {
+ data = []byte{0}
+ size = C.size_t(0)
+ }
+
+ ret := C.git_odb_hash(oid.toC(), unsafe.Pointer(&data[0]), size, C.git_object_t(otype))
runtime.KeepAlive(data)
if ret < 0 {
return nil, MakeGitError(ret)
@@ -182,7 +193,7 @@ func (v *Odb) Hash(data []byte, otype ObjectType) (oid *Oid, err error) {
// contents of the object.
func (v *Odb) NewReadStream(id *Oid) (*OdbReadStream, error) {
stream := new(OdbReadStream)
- var ctype C.git_otype
+ var ctype C.git_object_t
var csize C.size_t
runtime.LockOSThread()
@@ -210,7 +221,7 @@ func (v *Odb) NewWriteStream(size int64, otype ObjectType) (*OdbWriteStream, err
runtime.LockOSThread()
defer runtime.UnlockOSThread()
- ret := C.git_odb_open_wstream(&stream.ptr, v.ptr, C.git_off_t(size), C.git_otype(otype))
+ ret := C.git_odb_open_wstream(&stream.ptr, v.ptr, C.git_off_t(size), C.git_object_t(otype))
runtime.KeepAlive(v)
if ret < 0 {
return nil, MakeGitError(ret)
@@ -287,6 +298,9 @@ func (stream *OdbReadStream) Read(data []byte) (int, error) {
if ret < 0 {
return 0, MakeGitError(ret)
}
+ if ret == 0 {
+ return 0, io.EOF
+ }
header.Len = int(ret)
diff --git a/odb_test.go b/odb_test.go
index 3d22fc9..46acdba 100644
--- a/odb_test.go
+++ b/odb_test.go
@@ -1,12 +1,14 @@
package git
import (
+ "bytes"
"errors"
"io"
+ "io/ioutil"
"testing"
)
-func TestOdbReadHeader(t *testing.T) {
+func TestOdbRead(t *testing.T) {
t.Parallel()
repo := createTestRepo(t)
defer cleanupTestRepo(t, repo)
@@ -26,13 +28,27 @@ func TestOdbReadHeader(t *testing.T) {
if err != nil {
t.Fatalf("ReadHeader: %v", err)
}
-
+
if sz != uint64(len(data)) {
t.Errorf("ReadHeader got size %d, want %d", sz, len(data))
}
if typ != ObjectBlob {
t.Errorf("ReadHeader got object type %s", typ)
}
+
+ obj, err := odb.Read(id)
+ if err != nil {
+ t.Fatalf("Read: %v", err)
+ }
+ if !bytes.Equal(obj.Data(), data) {
+ t.Errorf("Read got wrong data")
+ }
+ if sz := obj.Len(); sz != uint64(len(data)) {
+ t.Errorf("Read got size %d, want %d", sz, len(data))
+ }
+ if typ := obj.Type(); typ != ObjectBlob {
+ t.Errorf("Read got object type %s", typ)
+ }
}
func TestOdbStream(t *testing.T) {
@@ -47,22 +63,29 @@ func TestOdbStream(t *testing.T) {
str := "hello, world!"
- stream, error := odb.NewWriteStream(int64(len(str)), ObjectBlob)
+ writeStream, error := odb.NewWriteStream(int64(len(str)), ObjectBlob)
checkFatal(t, error)
- n, error := io.WriteString(stream, str)
+ n, error := io.WriteString(writeStream, str)
checkFatal(t, error)
if n != len(str) {
t.Fatalf("Bad write length %v != %v", n, len(str))
}
- error = stream.Close()
+ error = writeStream.Close()
checkFatal(t, error)
expectedId, error := NewOid("30f51a3fba5274d53522d0f19748456974647b4f")
checkFatal(t, error)
- if stream.Id.Cmp(expectedId) != 0 {
+ if writeStream.Id.Cmp(expectedId) != 0 {
t.Fatal("Wrong data written")
}
+
+ readStream, error := odb.NewReadStream(&writeStream.Id)
+ checkFatal(t, error)
+ data, error := ioutil.ReadAll(readStream)
+ if str != string(data) {
+ t.Fatalf("Wrong data read %v != %v", str, string(data))
+ }
}
func TestOdbHash(t *testing.T) {
@@ -82,14 +105,16 @@ committer John Doe <[email protected]> 1390682018 +0000
Initial commit.`
- oid, error := odb.Hash([]byte(str), ObjectCommit)
- checkFatal(t, error)
+ for _, data := range [][]byte{[]byte(str), doublePointerBytes()} {
+ oid, error := odb.Hash(data, ObjectCommit)
+ checkFatal(t, error)
- coid, error := odb.Write([]byte(str), ObjectCommit)
- checkFatal(t, error)
+ coid, error := odb.Write(data, ObjectCommit)
+ checkFatal(t, error)
- if oid.Cmp(coid) != 0 {
- t.Fatal("Hash and write Oids are different")
+ if oid.Cmp(coid) != 0 {
+ t.Fatal("Hash and write Oids are different")
+ }
}
}
diff --git a/packbuilder.go b/packbuilder.go
index 0e04bbf..576e5ca 100644
--- a/packbuilder.go
+++ b/packbuilder.go
@@ -85,6 +85,19 @@ func (pb *Packbuilder) InsertTree(id *Oid) error {
return nil
}
+func (pb *Packbuilder) InsertWalk(walk *RevWalk) error {
+ runtime.LockOSThread()
+ defer runtime.UnlockOSThread()
+
+ ret := C.git_packbuilder_insert_walk(pb.ptr, walk.ptr)
+ runtime.KeepAlive(pb)
+ runtime.KeepAlive(walk)
+ if ret != 0 {
+ return MakeGitError(ret)
+ }
+ return nil
+}
+
func (pb *Packbuilder) ObjectCount() uint32 {
ret := uint32(C.git_packbuilder_object_count(pb.ptr))
runtime.KeepAlive(pb)
diff --git a/rebase.go b/rebase.go
index 5206fca..d29e183 100644
--- a/rebase.go
+++ b/rebase.go
@@ -6,6 +6,7 @@ package git
import "C"
import (
"errors"
+ "fmt"
"runtime"
"unsafe"
)
@@ -16,6 +17,8 @@ type RebaseOperationType uint
const (
// RebaseOperationPick The given commit is to be cherry-picked. The client should commit the changes and continue if there are no conflicts.
RebaseOperationPick RebaseOperationType = C.GIT_REBASE_OPERATION_PICK
+ // RebaseOperationReword The given commit is to be cherry-picked, but the client should prompt the user to provide an updated commit message.
+ RebaseOperationReword RebaseOperationType = C.GIT_REBASE_OPERATION_REWORD
// RebaseOperationEdit The given commit is to be cherry-picked, but the client should stop to allow the user to edit the changes before committing them.
RebaseOperationEdit RebaseOperationType = C.GIT_REBASE_OPERATION_EDIT
// RebaseOperationSquash The given commit is to be squashed into the previous commit. The commit message will be merged with the previous message.
@@ -26,6 +29,24 @@ const (
RebaseOperationExec RebaseOperationType = C.GIT_REBASE_OPERATION_EXEC
)
+func (t RebaseOperationType) String() string {
+ switch t {
+ case RebaseOperationPick:
+ return "pick"
+ case RebaseOperationReword:
+ return "reword"
+ case RebaseOperationEdit:
+ return "edit"
+ case RebaseOperationSquash:
+ return "squash"
+ case RebaseOperationFixup:
+ return "fixup"
+ case RebaseOperationExec:
+ return "exec"
+ }
+ return fmt.Sprintf("RebaseOperationType(%d)", t)
+}
+
// Special value indicating that there is no currently active operation
var RebaseNoOperation uint = ^uint(0)
diff --git a/reference.go b/reference.go
index 12ecb74..b5f5e47 100644
--- a/reference.go
+++ b/reference.go
@@ -284,7 +284,7 @@ func (v *Reference) Peel(t ObjectType) (*Object, error) {
runtime.LockOSThread()
defer runtime.UnlockOSThread()
- err := C.git_reference_peel(&cobj, v.ptr, C.git_otype(t))
+ err := C.git_reference_peel(&cobj, v.ptr, C.git_object_t(t))
runtime.KeepAlive(v)
if err < 0 {
return nil, MakeGitError(err)
diff --git a/repository.go b/repository.go
index 2a4e9c8..3e0d20f 100644
--- a/repository.go
+++ b/repository.go
@@ -176,7 +176,7 @@ func (v *Repository) lookupType(id *Oid, t ObjectType) (*Object, error) {
runtime.LockOSThread()
defer runtime.UnlockOSThread()
- ret := C.git_object_lookup(&ptr, v.ptr, id.toC(), C.git_otype(t))
+ ret := C.git_object_lookup(&ptr, v.ptr, id.toC(), C.git_object_t(t))
runtime.KeepAlive(id)
if ret < 0 {
return nil, MakeGitError(ret)
diff --git a/reset_test.go b/reset_test.go
index 45777e4..89ebc49 100644
--- a/reset_test.go
+++ b/reset_test.go
@@ -8,6 +8,8 @@ import (
func TestResetToCommit(t *testing.T) {
t.Parallel()
repo := createTestRepo(t)
+ defer cleanupTestRepo(t, repo)
+
seedTestRepo(t, repo)
// create commit to reset to
commitId, _ := updateReadme(t, repo, "testing reset")
diff --git a/script/build-libgit2-static.sh b/script/build-libgit2-static.sh
index 5723721..680dd93 100755
--- a/script/build-libgit2-static.sh
+++ b/script/build-libgit2-static.sh
@@ -2,18 +2,19 @@
set -ex
-VENDORED_PATH=vendor/libgit2
+ROOT="$(cd "$0/../.." && echo "${PWD}")"
+BUILD_PATH="${ROOT}/static-build"
+VENDORED_PATH="${ROOT}/vendor/libgit2"
-cd $VENDORED_PATH &&
-mkdir -p install/lib &&
-mkdir -p build &&
-cd build &&
+mkdir -p "${BUILD_PATH}/build" "${BUILD_PATH}/install/lib"
+
+cd "${BUILD_PATH}/build" &&
cmake -DTHREADSAFE=ON \
-DBUILD_CLAR=OFF \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_C_FLAGS=-fPIC \
-DCMAKE_BUILD_TYPE="RelWithDebInfo" \
- -DCMAKE_INSTALL_PREFIX=../install \
- .. &&
+ -DCMAKE_INSTALL_PREFIX="${BUILD_PATH}/install" \
+ "${VENDORED_PATH}" &&
-cmake --build .
+cmake --build . --target install
diff --git a/signature.go b/signature.go
index 16964d2..220fe57 100644
--- a/signature.go
+++ b/signature.go
@@ -26,7 +26,7 @@ func newSignatureFromC(sig *C.git_signature) *Signature {
}
}
-// the offset in mintes, which is what git wants
+// Offset returns the time zone offset of v.When in minutes, which is what git wants.
func (v *Signature) Offset() int {
_, offset := v.When.Zone()
return offset / 60
diff --git a/vendor/libgit2 b/vendor/libgit2
-Subproject 838a2f2918b6d9fad8768d2498575ff5d75c35f
+Subproject fba70a9d5f1fa433968a3dfd51e3153c8eebe83