summaryrefslogtreecommitdiff
path: root/index.go
diff options
context:
space:
mode:
authorezwiebel <[email protected]>2016-10-20 15:49:24 +1100
committerezwiebel <[email protected]>2016-10-20 15:49:24 +1100
commitc18c8693feb805d9ffbd1d22444683ce5ac96477 (patch)
treed17c7af3fbcb142678c94075835fc4678d79763f /index.go
parentf720800b507b72c0d64cdae70e2058bc620adc24 (diff)
Implement git_index_remove_directory in index wrapper
Diffstat (limited to 'index.go')
-rw-r--r--index.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/index.go b/index.go
index ae94864..2afdcdf 100644
--- a/index.go
+++ b/index.go
@@ -278,6 +278,22 @@ func (v *Index) RemoveByPath(path string) error {
return nil
}
+// RemoveDirectory removes all entries from the index under a given directory.
+func (v *Index) RemoveDirectory(dir string, stage int) error {
+ cstr := C.CString(dir)
+ defer C.free(unsafe.Pointer(cstr))
+
+ runtime.LockOSThread()
+ defer runtime.UnlockOSThread()
+
+ ret := C.git_index_remove_directory(v.ptr, cstr, C.int(stage))
+ if ret < 0 {
+ return MakeGitError(ret)
+ }
+
+ return nil
+}
+
func (v *Index) WriteTreeTo(repo *Repository) (*Oid, error) {
oid := new(Oid)