From c18c8693feb805d9ffbd1d22444683ce5ac96477 Mon Sep 17 00:00:00 2001 From: ezwiebel Date: Thu, 20 Oct 2016 15:49:24 +1100 Subject: Implement git_index_remove_directory in index wrapper --- index.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'index.go') 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) -- cgit v1.2.3