Run go fmt
As it seems to be something that many people can't get over, reformat all the files; as we're breaking things, whoever depended on 'next' will have to take many changes into account anyway, so let's include this to reduce the noise of incoming patches.
This commit is contained in:
parent
876ddd17eb
commit
d5890f58e8
|
@ -44,7 +44,7 @@ type CheckoutOpts struct {
|
|||
FileMode os.FileMode // Default is 0644 or 0755 as dictated by blob
|
||||
FileOpenFlags int // Default is O_CREAT | O_TRUNC | O_WRONLY
|
||||
TargetDirectory string // Alternative checkout path to workdir
|
||||
Paths []string
|
||||
Paths []string
|
||||
}
|
||||
|
||||
func checkoutOptionsFromC(c *C.git_checkout_options) CheckoutOpts {
|
||||
|
@ -156,4 +156,4 @@ func (v *Repository) CheckoutTree(tree *Tree, opts *CheckoutOpts) error {
|
|||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
6
index.go
6
index.go
|
@ -51,8 +51,8 @@ func newIndexEntryFromC(entry *C.git_index_entry) *IndexEntry {
|
|||
return nil
|
||||
}
|
||||
return &IndexEntry{
|
||||
IndexTime { int32(entry.ctime.seconds), uint32(entry.ctime.nanoseconds) },
|
||||
IndexTime { int32(entry.mtime.seconds), uint32(entry.mtime.nanoseconds) },
|
||||
IndexTime{int32(entry.ctime.seconds), uint32(entry.ctime.nanoseconds)},
|
||||
IndexTime{int32(entry.mtime.seconds), uint32(entry.mtime.nanoseconds)},
|
||||
Filemode(entry.mode),
|
||||
uint32(entry.uid),
|
||||
uint32(entry.gid),
|
||||
|
@ -280,7 +280,7 @@ func (v *Index) ReadTree(tree *Tree) error {
|
|||
runtime.LockOSThread()
|
||||
defer runtime.UnlockOSThread()
|
||||
|
||||
ret := C.git_index_read_tree(v.ptr, tree.cast_ptr);
|
||||
ret := C.git_index_read_tree(v.ptr, tree.cast_ptr)
|
||||
if ret < 0 {
|
||||
return MakeGitError(ret)
|
||||
}
|
||||
|
|
12
merge.go
12
merge.go
|
@ -85,8 +85,8 @@ const (
|
|||
)
|
||||
|
||||
type MergeOptions struct {
|
||||
Version uint
|
||||
TreeFlags MergeTreeFlag
|
||||
Version uint
|
||||
TreeFlags MergeTreeFlag
|
||||
|
||||
RenameThreshold uint
|
||||
TargetLimit uint
|
||||
|
@ -98,7 +98,7 @@ type MergeOptions struct {
|
|||
func mergeOptionsFromC(opts *C.git_merge_options) MergeOptions {
|
||||
return MergeOptions{
|
||||
Version: uint(opts.version),
|
||||
TreeFlags: MergeTreeFlag(opts.tree_flags),
|
||||
TreeFlags: MergeTreeFlag(opts.tree_flags),
|
||||
RenameThreshold: uint(opts.rename_threshold),
|
||||
TargetLimit: uint(opts.target_limit),
|
||||
FileFavor: MergeFileFavor(opts.file_favor),
|
||||
|
@ -259,10 +259,10 @@ func (r *Repository) MergeBases(one, two *Oid) ([]*Oid, error) {
|
|||
}
|
||||
|
||||
oids := make([]*Oid, coids.count)
|
||||
hdr := reflect.SliceHeader {
|
||||
hdr := reflect.SliceHeader{
|
||||
Data: uintptr(unsafe.Pointer(coids.ids)),
|
||||
Len: int(coids.count),
|
||||
Cap: int(coids.count),
|
||||
Len: int(coids.count),
|
||||
Cap: int(coids.count),
|
||||
}
|
||||
|
||||
goSlice := *(*[]C.git_oid)(unsafe.Pointer(&hdr))
|
||||
|
|
4
odb.go
4
odb.go
|
@ -8,10 +8,10 @@ extern void _go_git_odb_backend_free(git_odb_backend *backend);
|
|||
*/
|
||||
import "C"
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"unsafe"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type Odb struct {
|
||||
|
@ -130,7 +130,7 @@ func (v *Odb) ForEach(callback OdbForEachCallback) error {
|
|||
defer pointerHandles.Untrack(handle)
|
||||
|
||||
ret := C._go_git_odb_foreach(v.ptr, handle)
|
||||
fmt.Println("ret %v", ret);
|
||||
fmt.Println("ret %v", ret)
|
||||
if ret == C.GIT_EUSER {
|
||||
return data.err
|
||||
} else if ret < 0 {
|
||||
|
|
26
remote.go
26
remote.go
|
@ -72,12 +72,12 @@ type RemoteCallbacks struct {
|
|||
type FetchPrune uint
|
||||
|
||||
const (
|
||||
// Use the setting from the configuration
|
||||
// Use the setting from the configuration
|
||||
FetchPruneUnspecified FetchPrune = C.GIT_FETCH_PRUNE_UNSPECIFIED
|
||||
// Force pruning on
|
||||
FetchPruneOn FetchPrune = C.GIT_FETCH_PRUNE
|
||||
FetchPruneOn FetchPrune = C.GIT_FETCH_PRUNE
|
||||
// Force pruning off
|
||||
FetchNoPrune FetchPrune = C.GIT_FETCH_NO_PRUNE
|
||||
FetchNoPrune FetchPrune = C.GIT_FETCH_NO_PRUNE
|
||||
)
|
||||
|
||||
type DownloadTags uint
|
||||
|
@ -88,20 +88,20 @@ const (
|
|||
DownloadTagsUnspecified DownloadTags = C.GIT_REMOTE_DOWNLOAD_TAGS_UNSPECIFIED
|
||||
// Ask the server for tags pointing to objects we're already
|
||||
// downloading.
|
||||
DownloadTagsAuto DownloadTags = C.GIT_REMOTE_DOWNLOAD_TAGS_AUTO
|
||||
DownloadTagsAuto DownloadTags = C.GIT_REMOTE_DOWNLOAD_TAGS_AUTO
|
||||
|
||||
// Don't ask for any tags beyond the refspecs.
|
||||
DownloadTagsNone DownloadTags = C.GIT_REMOTE_DOWNLOAD_TAGS_NONE
|
||||
DownloadTagsNone DownloadTags = C.GIT_REMOTE_DOWNLOAD_TAGS_NONE
|
||||
|
||||
// Ask for the all the tags.
|
||||
DownloadTagsAll DownloadTags = C.GIT_REMOTE_DOWNLOAD_TAGS_ALL
|
||||
DownloadTagsAll DownloadTags = C.GIT_REMOTE_DOWNLOAD_TAGS_ALL
|
||||
)
|
||||
|
||||
type FetchOptions struct {
|
||||
// Callbacks to use for this fetch operation
|
||||
RemoteCallbacks RemoteCallbacks
|
||||
// Whether to perform a prune after the fetch
|
||||
Prune FetchPrune
|
||||
Prune FetchPrune
|
||||
// Whether to write the results to FETCH_HEAD. Defaults to
|
||||
// on. Leave this default in order to behave like git.
|
||||
UpdateFetchhead bool
|
||||
|
@ -111,7 +111,7 @@ type FetchOptions struct {
|
|||
// downloading all of them.
|
||||
//
|
||||
// The default is to auto-follow tags.
|
||||
DownloadTags DownloadTags
|
||||
DownloadTags DownloadTags
|
||||
}
|
||||
|
||||
type Remote struct {
|
||||
|
@ -588,7 +588,7 @@ func (o *Remote) RefspecCount() uint {
|
|||
func populateFetchOptions(options *C.git_fetch_options, opts *FetchOptions) {
|
||||
C.git_fetch_init_options(options, C.GIT_FETCH_OPTIONS_VERSION)
|
||||
if opts == nil {
|
||||
return;
|
||||
return
|
||||
}
|
||||
populateRemoteCallbacks(&options.callbacks, &opts.RemoteCallbacks)
|
||||
options.prune = C.git_fetch_prune_t(opts.Prune)
|
||||
|
@ -611,7 +611,7 @@ func populatePushOptions(options *C.git_push_options, opts *PushOptions) {
|
|||
// to use for this fetch, use an empty list to use the refspecs from
|
||||
// the configuration; msg specifies what to use for the reflog
|
||||
// entries. Leave "" to use defaults.
|
||||
func (o *Remote) Fetch(refspecs []string, opts *FetchOptions, msg string) error {
|
||||
func (o *Remote) Fetch(refspecs []string, opts *FetchOptions, msg string) error {
|
||||
var cmsg *C.char = nil
|
||||
if msg != "" {
|
||||
cmsg = C.CString(msg)
|
||||
|
@ -624,7 +624,7 @@ func (o *Remote) Fetch(refspecs []string, opts *FetchOptions, msg string) error
|
|||
defer freeStrarray(&crefspecs)
|
||||
|
||||
var coptions C.git_fetch_options
|
||||
populateFetchOptions(&coptions, opts);
|
||||
populateFetchOptions(&coptions, opts)
|
||||
defer untrackCalbacksPayload(&coptions.callbacks)
|
||||
|
||||
runtime.LockOSThread()
|
||||
|
@ -646,7 +646,7 @@ func (o *Remote) ConnectPush(callbacks *RemoteCallbacks) error {
|
|||
}
|
||||
|
||||
func (o *Remote) Connect(direction ConnectDirection, callbacks *RemoteCallbacks) error {
|
||||
var ccallbacks C.git_remote_callbacks;
|
||||
var ccallbacks C.git_remote_callbacks
|
||||
populateRemoteCallbacks(&ccallbacks, callbacks)
|
||||
|
||||
runtime.LockOSThread()
|
||||
|
@ -729,7 +729,7 @@ func (o *Remote) PruneRefs() bool {
|
|||
}
|
||||
|
||||
func (o *Remote) Prune(callbacks *RemoteCallbacks) error {
|
||||
var ccallbacks C.git_remote_callbacks;
|
||||
var ccallbacks C.git_remote_callbacks
|
||||
populateRemoteCallbacks(&ccallbacks, callbacks)
|
||||
|
||||
runtime.LockOSThread()
|
||||
|
|
|
@ -39,7 +39,7 @@ func TestCertificateCheck(t *testing.T) {
|
|||
remote, err := repo.Remotes.Create("origin", "https://github.com/libgit2/TestGitRepository")
|
||||
checkFatal(t, err)
|
||||
|
||||
options := FetchOptions {
|
||||
options := FetchOptions{
|
||||
RemoteCallbacks: RemoteCallbacks{
|
||||
CertificateCheckCallback: func(cert *Certificate, valid bool, hostname string) ErrorCode {
|
||||
return assertHostname(cert, valid, hostname, t)
|
||||
|
|
|
@ -12,11 +12,11 @@ import (
|
|||
|
||||
// Repository
|
||||
type Repository struct {
|
||||
ptr *C.git_repository
|
||||
ptr *C.git_repository
|
||||
// Remotes represents the collection of remotes and can be
|
||||
// used to add, remove and configure remotes for this
|
||||
// repository.
|
||||
Remotes RemoteCollection
|
||||
Remotes RemoteCollection
|
||||
// Submodules represents the collection of submodules and can
|
||||
// be used to add, remove and configure submodules in this
|
||||
// repostiory.
|
||||
|
@ -26,7 +26,7 @@ type Repository struct {
|
|||
References ReferenceCollection
|
||||
// Notes represents the collection of notes and can be used to
|
||||
// read, write and delete notes from this repository.
|
||||
Notes NoteCollection
|
||||
Notes NoteCollection
|
||||
// Tags represents the collection of tags and can be used to create,
|
||||
// list and iterate tags in this repository.
|
||||
Tags TagsCollection
|
||||
|
@ -35,10 +35,10 @@ type Repository struct {
|
|||
func newRepositoryFromC(ptr *C.git_repository) *Repository {
|
||||
repo := &Repository{ptr: ptr}
|
||||
|
||||
repo.Remotes.repo = repo
|
||||
repo.Remotes.repo = repo
|
||||
repo.Submodules.repo = repo
|
||||
repo.References.repo = repo
|
||||
repo.Notes.repo = repo
|
||||
repo.Notes.repo = repo
|
||||
repo.Tags.repo = repo
|
||||
|
||||
runtime.SetFinalizer(repo, (*Repository).Free)
|
||||
|
|
Loading…
Reference in New Issue