summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--status.go26
-rw-r--r--status_test.go23
-rw-r--r--wrapper.c5
3 files changed, 0 insertions, 54 deletions
diff --git a/status.go b/status.go
index efe6eb0..644b13e 100644
--- a/status.go
+++ b/status.go
@@ -3,14 +3,11 @@ package git
/*
#include <git2.h>
#include <git2/errors.h>
-
-int _go_git_status_foreach(git_repository *repo, void *data);
*/
import "C"
import (
"runtime"
- "unsafe"
)
type Status int
@@ -170,26 +167,3 @@ func (v *Repository) StatusFile(path string) (Status, error) {
}
return Status(statusFlags), nil
}
-
-type StatusCallback func(path string, status Status) int
-
-//export fileStatusForeach
-func fileStatusForeach(_path *C.char, _flags C.uint, _payload unsafe.Pointer) C.int {
- path := C.GoString(_path)
- flags := Status(_flags)
-
- cb := (*StatusCallback)(_payload)
- return C.int((*cb)(path, flags))
-}
-
-func (v *Repository) StatusForeach(callback StatusCallback) error {
- runtime.LockOSThread()
- defer runtime.UnlockOSThread()
-
- ret := C._go_git_status_foreach(v.ptr, unsafe.Pointer(&callback))
-
- if ret < 0 {
- return MakeGitError(ret)
- }
- return nil
-}
diff --git a/status_test.go b/status_test.go
index a0ff1d3..228ee0e 100644
--- a/status_test.go
+++ b/status_test.go
@@ -23,29 +23,6 @@ func TestStatusFile(t *testing.T) {
}
}
-func TestStatusForeach(t *testing.T) {
- repo := createTestRepo(t)
- defer repo.Free()
- defer os.RemoveAll(repo.Workdir())
-
- err := ioutil.WriteFile(path.Join(path.Dir(repo.Workdir()), "hello.txt"), []byte("Hello, World"), 0644)
- checkFatal(t, err)
-
- statusFound := false
- err = repo.StatusForeach(func (path string, statusFlags Status) int {
- if path == "hello.txt" && statusFlags & StatusWtNew != 0 {
- statusFound = true
- }
-
- return 0
- });
- checkFatal(t, err)
-
- if !statusFound {
- t.Fatal("Status callback not called with the new file")
- }
-}
-
func TestEntryCount(t *testing.T) {
repo := createTestRepo(t)
defer repo.Free()
diff --git a/wrapper.c b/wrapper.c
index 09dba46..45c4358 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -105,9 +105,4 @@ int _go_git_blob_create_fromchunks(git_oid *id,
return git_blob_create_fromchunks(id, repo, hintpath, _go_blob_chunk_cb, payload);
}
-int _go_git_status_foreach(git_repository *repo, void *data)
-{
- return git_status_foreach(repo, (git_status_cb)fileStatusForeach, data);
-}
-
/* EOF */