go fmt
This commit is contained in:
parent
e439b931a6
commit
45d88ca5f4
|
@ -25,12 +25,12 @@ type Object interface {
|
|||
}
|
||||
|
||||
type gitObject struct {
|
||||
ptr *C.git_object
|
||||
ptr *C.git_object
|
||||
repo *Repository
|
||||
}
|
||||
|
||||
func (t ObjectType) String() (string) {
|
||||
switch (t) {
|
||||
func (t ObjectType) String() string {
|
||||
switch t {
|
||||
case ObjectAny:
|
||||
return "Any"
|
||||
case ObjectBad:
|
||||
|
@ -71,7 +71,7 @@ func (o *gitObject) Free() {
|
|||
|
||||
func allocObject(cobj *C.git_object, repo *Repository) Object {
|
||||
obj := gitObject{
|
||||
ptr: cobj,
|
||||
ptr: cobj,
|
||||
repo: repo,
|
||||
}
|
||||
|
||||
|
|
8
odb.go
8
odb.go
|
@ -94,7 +94,7 @@ type OdbForEachCallback func(id *Oid) error
|
|||
|
||||
type foreachData struct {
|
||||
callback OdbForEachCallback
|
||||
err error
|
||||
err error
|
||||
}
|
||||
|
||||
//export odbForEachCb
|
||||
|
@ -111,9 +111,9 @@ func odbForEachCb(id *C.git_oid, payload unsafe.Pointer) int {
|
|||
}
|
||||
|
||||
func (v *Odb) ForEach(callback OdbForEachCallback) error {
|
||||
data := foreachData {
|
||||
data := foreachData{
|
||||
callback: callback,
|
||||
err: nil,
|
||||
err: nil,
|
||||
}
|
||||
|
||||
runtime.LockOSThread()
|
||||
|
@ -138,7 +138,7 @@ func (v *Odb) Hash(data []byte, otype ObjectType) (oid *Oid, err error) {
|
|||
runtime.LockOSThread()
|
||||
defer runtime.UnlockOSThread()
|
||||
|
||||
ret := C.git_odb_hash(oid.toC(), ptr, C.size_t(header.Len), C.git_otype(otype));
|
||||
ret := C.git_odb_hash(oid.toC(), ptr, C.size_t(header.Len), C.git_otype(otype))
|
||||
if ret < 0 {
|
||||
return nil, MakeGitError(ret)
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package git
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io"
|
||||
"os"
|
||||
"errors"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
@ -37,7 +37,7 @@ func TestOdbStream(t *testing.T) {
|
|||
|
||||
func TestOdbHash(t *testing.T) {
|
||||
|
||||
repo := createTestRepo(t)
|
||||
repo := createTestRepo(t)
|
||||
defer os.RemoveAll(repo.Workdir())
|
||||
_, _ = seedTestRepo(t, repo)
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ func packbuilderForEachCb(buf unsafe.Pointer, size C.size_t, payload unsafe.Poin
|
|||
func (pb *Packbuilder) ForEach(callback PackbuilderForeachCallback) error {
|
||||
data := packbuilderCbData{
|
||||
callback: callback,
|
||||
err: nil,
|
||||
err: nil,
|
||||
}
|
||||
|
||||
runtime.LockOSThread()
|
||||
|
|
31
status.go
31
status.go
|
@ -45,7 +45,7 @@ func statusEntryFromC(statusEntry *C.git_status_entry) StatusEntry {
|
|||
indexToWorkdir = diffDeltaFromC(statusEntry.index_to_workdir)
|
||||
}
|
||||
|
||||
return StatusEntry {
|
||||
return StatusEntry{
|
||||
Status: Status(statusEntry.status),
|
||||
HeadToIndex: headToIndex,
|
||||
IndexToWorkdir: indexToWorkdir,
|
||||
|
@ -96,20 +96,20 @@ func (statusList *StatusList) EntryCount() (int, error) {
|
|||
type StatusOpt int
|
||||
|
||||
const (
|
||||
StatusOptIncludeUntracked StatusOpt = C.GIT_STATUS_OPT_INCLUDE_UNTRACKED
|
||||
StatusOptIncludeIgnored StatusOpt = C.GIT_STATUS_OPT_INCLUDE_IGNORED
|
||||
StatusOptIncludeUnmodified StatusOpt = C.GIT_STATUS_OPT_INCLUDE_UNMODIFIED
|
||||
StatusOptExcludeSubmodules StatusOpt = C.GIT_STATUS_OPT_EXCLUDE_SUBMODULES
|
||||
StatusOptRecurseUntrackedDirs StatusOpt = C.GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS
|
||||
StatusOptDisablePathspecMatch StatusOpt = C.GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH
|
||||
StatusOptRecurseIgnoredDirs StatusOpt = C.GIT_STATUS_OPT_RECURSE_IGNORED_DIRS
|
||||
StatusOptRenamesHeadToIndex StatusOpt = C.GIT_STATUS_OPT_RENAMES_HEAD_TO_INDEX
|
||||
StatusOptRenamesIndexToWorkdir StatusOpt = C.GIT_STATUS_OPT_RENAMES_INDEX_TO_WORKDIR
|
||||
StatusOptSortCaseSensitively StatusOpt = C.GIT_STATUS_OPT_SORT_CASE_SENSITIVELY
|
||||
StatusOptSortCaseInsensitively StatusOpt = C.GIT_STATUS_OPT_SORT_CASE_INSENSITIVELY
|
||||
StatusOptRenamesFromRewrites StatusOpt = C.GIT_STATUS_OPT_RENAMES_FROM_REWRITES
|
||||
StatusOptNoRefresh StatusOpt = C.GIT_STATUS_OPT_NO_REFRESH
|
||||
StatusOptUpdateIndex StatusOpt = C.GIT_STATUS_OPT_UPDATE_INDEX
|
||||
StatusOptIncludeUntracked StatusOpt = C.GIT_STATUS_OPT_INCLUDE_UNTRACKED
|
||||
StatusOptIncludeIgnored StatusOpt = C.GIT_STATUS_OPT_INCLUDE_IGNORED
|
||||
StatusOptIncludeUnmodified StatusOpt = C.GIT_STATUS_OPT_INCLUDE_UNMODIFIED
|
||||
StatusOptExcludeSubmodules StatusOpt = C.GIT_STATUS_OPT_EXCLUDE_SUBMODULES
|
||||
StatusOptRecurseUntrackedDirs StatusOpt = C.GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS
|
||||
StatusOptDisablePathspecMatch StatusOpt = C.GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH
|
||||
StatusOptRecurseIgnoredDirs StatusOpt = C.GIT_STATUS_OPT_RECURSE_IGNORED_DIRS
|
||||
StatusOptRenamesHeadToIndex StatusOpt = C.GIT_STATUS_OPT_RENAMES_HEAD_TO_INDEX
|
||||
StatusOptRenamesIndexToWorkdir StatusOpt = C.GIT_STATUS_OPT_RENAMES_INDEX_TO_WORKDIR
|
||||
StatusOptSortCaseSensitively StatusOpt = C.GIT_STATUS_OPT_SORT_CASE_SENSITIVELY
|
||||
StatusOptSortCaseInsensitively StatusOpt = C.GIT_STATUS_OPT_SORT_CASE_INSENSITIVELY
|
||||
StatusOptRenamesFromRewrites StatusOpt = C.GIT_STATUS_OPT_RENAMES_FROM_REWRITES
|
||||
StatusOptNoRefresh StatusOpt = C.GIT_STATUS_OPT_NO_REFRESH
|
||||
StatusOptUpdateIndex StatusOpt = C.GIT_STATUS_OPT_UPDATE_INDEX
|
||||
)
|
||||
|
||||
type StatusShow int
|
||||
|
@ -173,7 +173,6 @@ func (v *Repository) StatusList(opts *StatusOptions) (*StatusList, error) {
|
|||
return newStatusListFromC(ptr), nil
|
||||
}
|
||||
|
||||
|
||||
func (v *Repository) StatusFile(path string) (Status, error) {
|
||||
var statusFlags C.uint
|
||||
cPath := C.CString(path)
|
||||
|
|
|
@ -2,8 +2,8 @@ package git
|
|||
|
||||
import (
|
||||
"os"
|
||||
"time"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestCreateTag(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue