aboutsummaryrefslogtreecommitdiffstats
path: root/cshared/file_cshared.go
diff options
context:
space:
mode:
Diffstat (limited to 'cshared/file_cshared.go')
-rw-r--r--cshared/file_cshared.go29
1 files changed, 15 insertions, 14 deletions
diff --git a/cshared/file_cshared.go b/cshared/file_cshared.go
index 8ef6427..d9c95b0 100644
--- a/cshared/file_cshared.go
+++ b/cshared/file_cshared.go
@@ -5,8 +5,9 @@ import (
"io"
"io/ioutil"
- "gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/plumbing"
+ "gopkg.in/src-d/go-git.v4/plumbing/object"
+ "gopkg.in/src-d/go-git.v4/plumbing/storer"
)
//export c_File_get_Name
@@ -15,7 +16,7 @@ func c_File_get_Name(f uint64) *C.char {
if !ok {
return nil
}
- file := obj.(*git.File)
+ file := obj.(*object.File)
return C.CString(file.Name)
}
@@ -25,7 +26,7 @@ func c_File_get_Mode(f uint64) uint32 {
if !ok {
return 0
}
- file := obj.(*git.File)
+ file := obj.(*object.File)
return uint32(file.Mode)
}
@@ -35,7 +36,7 @@ func c_File_get_Hash(b uint64) *C.char {
if !ok {
return nil
}
- file := obj.(*git.File)
+ file := obj.(*object.File)
return CBytes(file.Hash[:])
}
@@ -45,7 +46,7 @@ func c_File_Size(b uint64) int64 {
if !ok {
return -1
}
- file := obj.(*git.File)
+ file := obj.(*object.File)
return file.Size
}
@@ -55,8 +56,8 @@ func c_File_Decode(o uint64) uint64 {
if !ok {
return IH
}
- cobj := obj.(*plumbing.Object)
- file := git.File{}
+ cobj := obj.(*plumbing.EncodedObject)
+ file := object.File{}
file.Decode(*cobj)
return uint64(RegisterObject(&file))
}
@@ -67,7 +68,7 @@ func c_File_Read(b uint64) (int, *C.char) {
if !ok {
return ErrorCodeNotFound, C.CString(MessageNotFound)
}
- file := obj.(*git.File)
+ file := obj.(*object.File)
reader, err := file.Reader()
if err != nil {
return ErrorCodeInternal, C.CString(err.Error())
@@ -86,7 +87,7 @@ func c_File_Type(c uint64) int8 {
if !ok {
return -1
}
- file := obj.(*git.File)
+ file := obj.(*object.File)
return int8(file.Type())
}
@@ -96,13 +97,13 @@ func c_NewFileIter(r uint64, t uint64) uint64 {
if !ok {
return IH
}
- repo := obj.(*git.Repository)
+ storer := obj.(storer.EncodedObjectStorer)
obj, ok = GetObject(Handle(t))
if !ok {
return IH
}
- tree := obj.(*git.Tree)
- iter := git.NewFileIter(repo, tree)
+ tree := obj.(*object.Tree)
+ iter := object.NewFileIter(storer, tree)
return uint64(RegisterObject(iter))
}
@@ -112,7 +113,7 @@ func c_FileIter_Next(i uint64) (uint64, int, *C.char) {
if !ok {
return IH, ErrorCodeNotFound, C.CString(MessageNotFound)
}
- iter := obj.(*git.FileIter)
+ iter := obj.(*object.FileIter)
file, err := iter.Next()
if err != nil {
if err == io.EOF {
@@ -129,6 +130,6 @@ func c_FileIter_Close(i uint64) {
if !ok {
return
}
- iter := obj.(*git.FileIter)
+ iter := obj.(*object.FileIter)
iter.Close()
}