summaryrefslogtreecommitdiff
path: root/index.go
diff options
context:
space:
mode:
authorCarlos Martín Nieto <[email protected]>2014-09-09 10:51:44 +0200
committerCarlos Martín Nieto <[email protected]>2014-09-09 10:51:44 +0200
commitc68241c3f0de4dd4d5756a1171e4e2c16e97c4e8 (patch)
treee3e3decb1391fcbb66042d110954ad8874c91142 /index.go
parent756c8a7e8bc8e4688565634bd1b1889b3e2dcac2 (diff)
parentc2f6381252c93f97b4a47a2b56faff26f1244d9d (diff)
Merge pull request #117 from piger/dev
add Index#RemoveByPath.
Diffstat (limited to 'index.go')
-rw-r--r--index.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/index.go b/index.go
index f8ce6b3..b1542d5 100644
--- a/index.go
+++ b/index.go
@@ -114,6 +114,21 @@ func (v *Index) AddByPath(path string) error {
return nil
}
+func (v *Index) RemoveByPath(path string) error {
+ cstr := C.CString(path)
+ defer C.free(unsafe.Pointer(cstr))
+
+ runtime.LockOSThread()
+ defer runtime.UnlockOSThread()
+
+ ret := C.git_index_remove_bypath(v.ptr, cstr)
+ if ret < 0 {
+ return MakeGitError(ret)
+ }
+
+ return nil
+}
+
func (v *Index) WriteTreeTo(repo *Repository) (*Oid, error) {
oid := new(Oid)