Merge remote-tracking branch 'upstream/master' into repository-create_commit_from_ids

This commit is contained in:
lhchavez 2019-01-08 02:51:21 +00:00
commit 6d67bde74a
21 changed files with 188 additions and 67 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/static-build/

View File

@ -35,7 +35,7 @@ const (
CheckoutDontUpdateIndex CheckoutStrategy = C.GIT_CHECKOUT_DONT_UPDATE_INDEX // Normally checkout updates index entries as it goes; this stops that 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 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 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 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 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 CheckoutSkipLockedDirectories CheckoutStrategy = C.GIT_CHECKOUT_SKIP_LOCKED_DIRECTORIES // Ignore directories in use, they will be left empty

View File

@ -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 // 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) cpath := C.CString(path)
defer C.free(unsafe.Pointer(cpath)) defer C.free(unsafe.Pointer(cpath))

View File

@ -13,7 +13,7 @@ func setupConfig() (*Config, error) {
err error err error
) )
c, err = OpenOndisk(nil, tempConfig) c, err = OpenOndisk(tempConfig)
if err != nil { if err != nil {
return nil, err return nil, err
} }

14
git.go
View File

@ -189,22 +189,16 @@ func (oid *Oid) Cmp(oid2 *Oid) int {
} }
func (oid *Oid) Copy() *Oid { func (oid *Oid) Copy() *Oid {
ret := new(Oid) ret := *oid
copy(ret[:], oid[:]) return &ret
return ret
} }
func (oid *Oid) Equal(oid2 *Oid) bool { func (oid *Oid) Equal(oid2 *Oid) bool {
return bytes.Equal(oid[:], oid2[:]) return *oid == *oid2
} }
func (oid *Oid) IsZero() bool { func (oid *Oid) IsZero() bool {
for _, a := range oid { return *oid == Oid{}
if a != 0 {
return false
}
}
return true
} }
func (oid *Oid) NCmp(oid2 *Oid, n uint) int { func (oid *Oid) NCmp(oid2 *Oid, n uint) int {

View File

@ -3,10 +3,9 @@
package git package git
/* /*
#cgo CFLAGS: -I${SRCDIR}/vendor/libgit2/include #cgo windows CFLAGS: -I${SRCDIR}/static-build/install/include/
#cgo LDFLAGS: -L${SRCDIR}/vendor/libgit2/build/ -lgit2 #cgo windows LDFLAGS: -L${SRCDIR}/static-build/install/lib/ -lgit2 -lwinhttp
#cgo windows LDFLAGS: -lwinhttp #cgo !windows pkg-config: --static ${SRCDIR}/static-build/install/lib/pkgconfig/libgit2.pc
#cgo !windows pkg-config: --static ${SRCDIR}/vendor/libgit2/build/libgit2.pc
#include <git2.h> #include <git2.h>
#if LIBGIT2_VER_MAJOR != 0 || LIBGIT2_VER_MINOR != 27 #if LIBGIT2_VER_MAJOR != 0 || LIBGIT2_VER_MINOR != 27

1
go.mod Normal file
View File

@ -0,0 +1 @@
module github.com/libgit2/git2go

View File

@ -145,6 +145,20 @@ func (v *Index) Path() string {
return ret 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 // Add adds or replaces the given entry to the index, making a copy of
// the data // the data
func (v *Index) Add(entry *IndexEntry) error { func (v *Index) Add(entry *IndexEntry) error {

View File

@ -3,6 +3,7 @@ package git
import ( import (
"io/ioutil" "io/ioutil"
"os" "os"
"path"
"runtime" "runtime"
"testing" "testing"
) )
@ -59,14 +60,29 @@ func TestIndexWriteTreeTo(t *testing.T) {
repo := createTestRepo(t) repo := createTestRepo(t)
defer cleanupTestRepo(t, repo) defer cleanupTestRepo(t, repo)
repo2 := createTestRepo(t) idx, err := NewIndex()
defer cleanupTestRepo(t, repo2) checkFatal(t, err)
idx, err := repo.Index() odb, err := repo.Odb()
checkFatal(t, err) checkFatal(t, err)
err = idx.AddByPath("README")
content, err := ioutil.ReadFile(path.Join(repo.Workdir(), "README"))
checkFatal(t, err) checkFatal(t, err)
treeId, err := idx.WriteTreeTo(repo2)
id, err := odb.Write(content, ObjectBlob)
checkFatal(t, err)
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) checkFatal(t, err)
if treeId.String() != "b7119b11e8ef7a1a5a34d3ac87f5b075228ac81e" { if treeId.String() != "b7119b11e8ef7a1a5a34d3ac87f5b075228ac81e" {

View File

@ -344,9 +344,29 @@ type MergeFileFlags int
const ( const (
MergeFileDefault MergeFileFlags = C.GIT_MERGE_FILE_DEFAULT MergeFileDefault MergeFileFlags = C.GIT_MERGE_FILE_DEFAULT
// Create standard conflicted merge files
MergeFileStyleMerge MergeFileFlags = C.GIT_MERGE_FILE_STYLE_MERGE MergeFileStyleMerge MergeFileFlags = C.GIT_MERGE_FILE_STYLE_MERGE
// Create diff3-style files
MergeFileStyleDiff MergeFileFlags = C.GIT_MERGE_FILE_STYLE_DIFF3 MergeFileStyleDiff MergeFileFlags = C.GIT_MERGE_FILE_STYLE_DIFF3
// Condense non-alphanumeric regions for simplified diff file
MergeFileStyleSimplifyAlnum MergeFileFlags = C.GIT_MERGE_FILE_SIMPLIFY_ALNUM 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 { type MergeFileOptions struct {

View File

@ -13,12 +13,12 @@ import (
type ObjectType int type ObjectType int
const ( const (
ObjectAny ObjectType = C.GIT_OBJ_ANY ObjectAny ObjectType = C.GIT_OBJECT_ANY
ObjectBad ObjectType = C.GIT_OBJ_BAD ObjectBad ObjectType = C.GIT_OBJECT_BAD
ObjectCommit ObjectType = C.GIT_OBJ_COMMIT ObjectCommit ObjectType = C.GIT_OBJECT_COMMIT
ObjectTree ObjectType = C.GIT_OBJ_TREE ObjectTree ObjectType = C.GIT_OBJECT_TREE
ObjectBlob ObjectType = C.GIT_OBJ_BLOB ObjectBlob ObjectType = C.GIT_OBJECT_BLOB
ObjectTag ObjectType = C.GIT_OBJ_TAG ObjectTag ObjectType = C.GIT_OBJECT_TAG
) )
type Object struct { type Object struct {
@ -217,7 +217,7 @@ func (o *Object) Peel(t ObjectType) (*Object, error) {
runtime.LockOSThread() runtime.LockOSThread()
defer runtime.UnlockOSThread() 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) runtime.KeepAlive(o)
if err < 0 { if err < 0 {
return nil, MakeGitError(err) return nil, MakeGitError(err)

38
odb.go
View File

@ -8,6 +8,7 @@ extern void _go_git_odb_backend_free(git_odb_backend *backend);
*/ */
import "C" import "C"
import ( import (
"io"
"reflect" "reflect"
"runtime" "runtime"
"unsafe" "unsafe"
@ -60,12 +61,12 @@ func (v *Odb) ReadHeader(oid *Oid) (uint64, ObjectType, error) {
defer runtime.UnlockOSThread() defer runtime.UnlockOSThread()
var sz C.size_t 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()) ret := C.git_odb_read_header(&sz, &cotype, v.ptr, oid.toC())
runtime.KeepAlive(v) runtime.KeepAlive(v)
if ret < 0 { if ret < 0 {
return 0, C.GIT_OBJ_BAD, MakeGitError(ret) return 0, ObjectBad, MakeGitError(ret)
} }
return uint64(sz), ObjectType(cotype), nil 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) { func (v *Odb) Write(data []byte, otype ObjectType) (oid *Oid, err error) {
oid = new(Oid) oid = new(Oid)
var cptr unsafe.Pointer
if len(data) > 0 {
cptr = unsafe.Pointer(&data[0])
}
runtime.LockOSThread() runtime.LockOSThread()
defer runtime.UnlockOSThread() 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) runtime.KeepAlive(v)
if ret < 0 { if ret < 0 {
return nil, MakeGitError(ret) 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. // Hash determines the object-ID (sha1) of a data buffer.
func (v *Odb) Hash(data []byte, otype ObjectType) (oid *Oid, err error) { func (v *Odb) Hash(data []byte, otype ObjectType) (oid *Oid, err error) {
oid = new(Oid) oid = new(Oid)
header := (*reflect.SliceHeader)(unsafe.Pointer(&data))
ptr := unsafe.Pointer(header.Data)
runtime.LockOSThread() runtime.LockOSThread()
defer runtime.UnlockOSThread() 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) runtime.KeepAlive(data)
if ret < 0 { if ret < 0 {
return nil, MakeGitError(ret) return nil, MakeGitError(ret)
@ -182,7 +193,7 @@ func (v *Odb) Hash(data []byte, otype ObjectType) (oid *Oid, err error) {
// contents of the object. // contents of the object.
func (v *Odb) NewReadStream(id *Oid) (*OdbReadStream, error) { func (v *Odb) NewReadStream(id *Oid) (*OdbReadStream, error) {
stream := new(OdbReadStream) stream := new(OdbReadStream)
var ctype C.git_otype var ctype C.git_object_t
var csize C.size_t var csize C.size_t
runtime.LockOSThread() runtime.LockOSThread()
@ -210,7 +221,7 @@ func (v *Odb) NewWriteStream(size int64, otype ObjectType) (*OdbWriteStream, err
runtime.LockOSThread() runtime.LockOSThread()
defer runtime.UnlockOSThread() 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) runtime.KeepAlive(v)
if ret < 0 { if ret < 0 {
return nil, MakeGitError(ret) return nil, MakeGitError(ret)
@ -287,6 +298,9 @@ func (stream *OdbReadStream) Read(data []byte) (int, error) {
if ret < 0 { if ret < 0 {
return 0, MakeGitError(ret) return 0, MakeGitError(ret)
} }
if ret == 0 {
return 0, io.EOF
}
header.Len = int(ret) header.Len = int(ret)

View File

@ -1,12 +1,14 @@
package git package git
import ( import (
"bytes"
"errors" "errors"
"io" "io"
"io/ioutil"
"testing" "testing"
) )
func TestOdbReadHeader(t *testing.T) { func TestOdbRead(t *testing.T) {
t.Parallel() t.Parallel()
repo := createTestRepo(t) repo := createTestRepo(t)
defer cleanupTestRepo(t, repo) defer cleanupTestRepo(t, repo)
@ -33,6 +35,20 @@ func TestOdbReadHeader(t *testing.T) {
if typ != ObjectBlob { if typ != ObjectBlob {
t.Errorf("ReadHeader got object type %s", typ) 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) { func TestOdbStream(t *testing.T) {
@ -47,22 +63,29 @@ func TestOdbStream(t *testing.T) {
str := "hello, world!" str := "hello, world!"
stream, error := odb.NewWriteStream(int64(len(str)), ObjectBlob) writeStream, error := odb.NewWriteStream(int64(len(str)), ObjectBlob)
checkFatal(t, error) checkFatal(t, error)
n, error := io.WriteString(stream, str) n, error := io.WriteString(writeStream, str)
checkFatal(t, error) checkFatal(t, error)
if n != len(str) { if n != len(str) {
t.Fatalf("Bad write length %v != %v", n, len(str)) t.Fatalf("Bad write length %v != %v", n, len(str))
} }
error = stream.Close() error = writeStream.Close()
checkFatal(t, error) checkFatal(t, error)
expectedId, error := NewOid("30f51a3fba5274d53522d0f19748456974647b4f") expectedId, error := NewOid("30f51a3fba5274d53522d0f19748456974647b4f")
checkFatal(t, error) checkFatal(t, error)
if stream.Id.Cmp(expectedId) != 0 { if writeStream.Id.Cmp(expectedId) != 0 {
t.Fatal("Wrong data written") 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) { func TestOdbHash(t *testing.T) {
@ -82,15 +105,17 @@ committer John Doe <john@doe.com> 1390682018 +0000
Initial commit.` Initial commit.`
oid, error := odb.Hash([]byte(str), ObjectCommit) for _, data := range [][]byte{[]byte(str), doublePointerBytes()} {
oid, error := odb.Hash(data, ObjectCommit)
checkFatal(t, error) checkFatal(t, error)
coid, error := odb.Write([]byte(str), ObjectCommit) coid, error := odb.Write(data, ObjectCommit)
checkFatal(t, error) checkFatal(t, error)
if oid.Cmp(coid) != 0 { if oid.Cmp(coid) != 0 {
t.Fatal("Hash and write Oids are different") t.Fatal("Hash and write Oids are different")
} }
}
} }
func TestOdbForeach(t *testing.T) { func TestOdbForeach(t *testing.T) {

View File

@ -85,6 +85,19 @@ func (pb *Packbuilder) InsertTree(id *Oid) error {
return nil 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 { func (pb *Packbuilder) ObjectCount() uint32 {
ret := uint32(C.git_packbuilder_object_count(pb.ptr)) ret := uint32(C.git_packbuilder_object_count(pb.ptr))
runtime.KeepAlive(pb) runtime.KeepAlive(pb)

View File

@ -6,6 +6,7 @@ package git
import "C" import "C"
import ( import (
"errors" "errors"
"fmt"
"runtime" "runtime"
"unsafe" "unsafe"
) )
@ -16,6 +17,8 @@ type RebaseOperationType uint
const ( const (
// RebaseOperationPick The given commit is to be cherry-picked. The client should commit the changes and continue if there are no conflicts. // 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 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 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 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. // 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 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 // Special value indicating that there is no currently active operation
var RebaseNoOperation uint = ^uint(0) var RebaseNoOperation uint = ^uint(0)

View File

@ -284,7 +284,7 @@ func (v *Reference) Peel(t ObjectType) (*Object, error) {
runtime.LockOSThread() runtime.LockOSThread()
defer runtime.UnlockOSThread() 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) runtime.KeepAlive(v)
if err < 0 { if err < 0 {
return nil, MakeGitError(err) return nil, MakeGitError(err)

View File

@ -176,7 +176,7 @@ func (v *Repository) lookupType(id *Oid, t ObjectType) (*Object, error) {
runtime.LockOSThread() runtime.LockOSThread()
defer runtime.UnlockOSThread() 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) runtime.KeepAlive(id)
if ret < 0 { if ret < 0 {
return nil, MakeGitError(ret) return nil, MakeGitError(ret)

View File

@ -8,6 +8,8 @@ import (
func TestResetToCommit(t *testing.T) { func TestResetToCommit(t *testing.T) {
t.Parallel() t.Parallel()
repo := createTestRepo(t) repo := createTestRepo(t)
defer cleanupTestRepo(t, repo)
seedTestRepo(t, repo) seedTestRepo(t, repo)
// create commit to reset to // create commit to reset to
commitId, _ := updateReadme(t, repo, "testing reset") commitId, _ := updateReadme(t, repo, "testing reset")

View File

@ -2,18 +2,19 @@
set -ex 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 "${BUILD_PATH}/build" "${BUILD_PATH}/install/lib"
mkdir -p install/lib &&
mkdir -p build && cd "${BUILD_PATH}/build" &&
cd build &&
cmake -DTHREADSAFE=ON \ cmake -DTHREADSAFE=ON \
-DBUILD_CLAR=OFF \ -DBUILD_CLAR=OFF \
-DBUILD_SHARED_LIBS=OFF \ -DBUILD_SHARED_LIBS=OFF \
-DCMAKE_C_FLAGS=-fPIC \ -DCMAKE_C_FLAGS=-fPIC \
-DCMAKE_BUILD_TYPE="RelWithDebInfo" \ -DCMAKE_BUILD_TYPE="RelWithDebInfo" \
-DCMAKE_INSTALL_PREFIX=../install \ -DCMAKE_INSTALL_PREFIX="${BUILD_PATH}/install" \
.. && "${VENDORED_PATH}" &&
cmake --build . cmake --build . --target install

View File

@ -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 { func (v *Signature) Offset() int {
_, offset := v.When.Zone() _, offset := v.When.Zone()
return offset / 60 return offset / 60

2
vendor/libgit2 vendored

@ -1 +1 @@
Subproject commit 838a2f2918b6d9fad8768d2498575ff5d75c35f0 Subproject commit fba70a9d5f1fa433968a3dfd51e3153c8eebe834