aboutsummaryrefslogtreecommitdiffstats
path: root/cshared/repository_cshared.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-02-21 16:08:38 +0100
committerGitHub <noreply@github.com>2017-02-21 16:08:38 +0100
commit73855d0a5f617bcda1f33e730f3bc7cf8afbef6c (patch)
tree1616abfd6c9449e08d55563875f8c15546020a52 /cshared/repository_cshared.go
parent867b10692e5f8a34a82cc0a783bdb63e2b5ff398 (diff)
parent47666e18adfa70201efc951432ab3c204c1d2ed8 (diff)
downloadgo-git-73855d0a5f617bcda1f33e730f3bc7cf8afbef6c.tar.gz
Merge pull request #277 from ajnavarro/remove-cshared
cshared: remove directory (Fix #236)
Diffstat (limited to 'cshared/repository_cshared.go')
-rw-r--r--cshared/repository_cshared.go232
1 files changed, 0 insertions, 232 deletions
diff --git a/cshared/repository_cshared.go b/cshared/repository_cshared.go
deleted file mode 100644
index 76755bf..0000000
--- a/cshared/repository_cshared.go
+++ /dev/null
@@ -1,232 +0,0 @@
-// +build ignore
-package main
-
-import "C"
-
-/*
-
-//export c_Repository
-func c_Repository() uint64 {
- repo := &git.Repository{}
- repo_handle := RegisterObject(repo)
- return uint64(repo_handle)
-}
-
-//export c_NewRepository
-func c_NewRepository(url string, auth uint64) (uint64, int, *C.char) {
- var repo *git.Repository
- var err error
- url = CopyString(url)
- if auth != IH {
- real_auth, ok := GetObject(Handle(auth))
- if !ok {
- return IH, ErrorCodeNotFound, C.CString(MessageNotFound)
- }
- repo, err = git.NewRepository(url, real_auth.(common.AuthMethod))
- } else {
- repo, err = git.NewRepository(url, nil)
- }
- if err != nil {
- return IH, ErrorCodeInternal, C.CString(err.Error())
- }
- repo_handle := RegisterObject(repo)
- return uint64(repo_handle), ErrorCodeSuccess, nil
-}
-
-//export c_NewPlainRepository
-func c_NewPlainRepository() uint64 {
- return uint64(RegisterObject(git.NewPlainRepository()))
-}
-
-//export c_Repository_get_Remotes
-func c_Repository_get_Remotes(r uint64) uint64 {
- obj, ok := GetObject(Handle(r))
- if !ok {
- return IH
- }
- repo := obj.(*git.Repository)
- return uint64(RegisterObject(&repo.Remotes))
-}
-
-//export c_Repository_set_Remotes
-func c_Repository_set_Remotes(r uint64, val uint64) {
- obj, ok := GetObject(Handle(r))
- if !ok {
- return
- }
- repo := obj.(*git.Repository)
- obj, ok = GetObject(Handle(val))
- if !ok {
- return
- }
- repo.Remotes = *obj.(*map[string]*git.Remote)
-}
-
-//export c_Repository_get_Storage
-func c_Repository_get_Storage(r uint64) uint64 {
- obj, ok := GetObject(Handle(r))
- if !ok {
- return IH
- }
- repo := obj.(*git.Repository)
- return uint64(RegisterObject(&repo.Storage))
-}
-
-//export c_Repository_set_Storage
-func c_Repository_set_Storage(r uint64, val uint64) {
- obj, ok := GetObject(Handle(r))
- if !ok {
- return
- }
- repo := obj.(*git.Repository)
- obj, ok = GetObject(Handle(val))
- if !ok {
- return
- }
- repo.Storage = *obj.(*plumbing.ObjectStorage)
-}
-
-//export c_Repository_Pull
-func c_Repository_Pull(r uint64, remoteName, branch string) (int, *C.char) {
- obj, ok := GetObject(Handle(r))
- if !ok {
- return ErrorCodeNotFound, C.CString(MessageNotFound)
- }
- repo := obj.(*git.Repository)
- err := repo.Pull(remoteName, CopyString(branch))
- if err == nil {
- return ErrorCodeSuccess, nil
- }
- return ErrorCodeInternal, C.CString(err.Error())
-}
-
-//export c_Repository_PullDefault
-func c_Repository_PullDefault(r uint64) (int, *C.char) {
- obj, ok := GetObject(Handle(r))
- if !ok {
- return ErrorCodeNotFound, C.CString(MessageNotFound)
- }
- repo := obj.(*git.Repository)
- err := repo.PullDefault()
- if err == nil {
- return ErrorCodeSuccess, nil
- }
- return ErrorCodeInternal, C.CString(err.Error())
-}
-
-//export c_Repository_Commit
-func c_Repository_Commit(r uint64, h []byte) (uint64, int, *C.char) {
- obj, ok := GetObject(Handle(r))
- if !ok {
- return IH, ErrorCodeNotFound, C.CString(MessageNotFound)
- }
- repo := obj.(*git.Repository)
- var hash plumbing.Hash
- copy(hash[:], h)
- commit, err := repo.Commit(hash)
- if err != nil {
- return IH, ErrorCodeInternal, C.CString(err.Error())
- }
- commit_handle := RegisterObject(commit)
- return uint64(commit_handle), ErrorCodeSuccess, nil
-}
-
-//export c_Repository_Commits
-func c_Repository_Commits(r uint64) (uint64, int, *C.char) {
- obj, ok := GetObject(Handle(r))
- if !ok {
- return IH, ErrorCodeNotFound, C.CString(MessageNotFound)
- }
- repo := obj.(*git.Repository)
- iter, err := repo.Commits()
- if err != nil {
- return IH, ErrorCodeInternal, C.CString(err.Error())
- }
- iter_handle := RegisterObject(iter)
- return uint64(iter_handle), ErrorCodeSuccess, nil
-}
-
-//export c_Repository_Tree
-func c_Repository_Tree(r uint64, h []byte) (uint64, int, *C.char) {
- obj, ok := GetObject(Handle(r))
- if !ok {
- return IH, ErrorCodeNotFound, C.CString(MessageNotFound)
- }
- repo := obj.(*git.Repository)
- var hash plumbing.Hash
- copy(hash[:], h)
- tree, err := repo.Tree(hash)
- if err != nil {
- return IH, ErrorCodeInternal, C.CString(err.Error())
- }
- tree_handle := RegisterObject(tree)
- return uint64(tree_handle), ErrorCodeSuccess, nil
-}
-
-//export c_Repository_Blob
-func c_Repository_Blob(r uint64, h []byte) (uint64, int, *C.char) {
- obj, ok := GetObject(Handle(r))
- if !ok {
- return IH, ErrorCodeNotFound, C.CString(MessageNotFound)
- }
- repo := obj.(*git.Repository)
- var hash plumbing.Hash
- copy(hash[:], h)
- blob, err := repo.Blob(hash)
- if err != nil {
- return IH, ErrorCodeInternal, C.CString(err.Error())
- }
- blob_handle := RegisterObject(blob)
- return uint64(blob_handle), ErrorCodeSuccess, nil
-}
-
-//export c_Repository_Tag
-func c_Repository_Tag(r uint64, h []byte) (uint64, int, *C.char) {
- obj, ok := GetObject(Handle(r))
- if !ok {
- return IH, ErrorCodeNotFound, C.CString(MessageNotFound)
- }
- repo := obj.(*git.Repository)
- var hash plumbing.Hash
- copy(hash[:], h)
- tag, err := repo.Tag(hash)
- if err != nil {
- return IH, ErrorCodeInternal, C.CString(err.Error())
- }
- tag_handle := RegisterObject(tag)
- return uint64(tag_handle), ErrorCodeSuccess, nil
-}
-
-//export c_Repository_Tags
-func c_Repository_Tags(r uint64) (uint64, int, *C.char) {
- obj, ok := GetObject(Handle(r))
- if !ok {
- return IH, ErrorCodeNotFound, C.CString(MessageNotFound)
- }
- repo := obj.(*git.Repository)
- iter, err := repo.Tags()
- if err != nil {
- return IH, ErrorCodeInternal, C.CString(err.Error())
- }
- iter_handle := RegisterObject(iter)
- return uint64(iter_handle), ErrorCodeSuccess, nil
-}
-
-//export c_Repository_Object
-func c_Repository_Object(r uint64, h []byte) (uint64, int, *C.char) {
- obj, ok := GetObject(Handle(r))
- if !ok {
- return IH, ErrorCodeNotFound, C.CString(MessageNotFound)
- }
- repo := obj.(*git.Repository)
- var hash plumbing.Hash
- copy(hash[:], h)
- robj, err := repo.Object(hash)
- if err != nil {
- return IH, ErrorCodeInternal, C.CString(err.Error())
- }
- robj_handle := RegisterObject(robj)
- return uint64(robj_handle), ErrorCodeSuccess, nil
-}
-
-*/