From c2f6381252c93f97b4a47a2b56faff26f1244d9d Mon Sep 17 00:00:00 2001 From: Daniel Kertesz Date: Sat, 23 Aug 2014 16:55:36 +0200 Subject: [PATCH] add Index#RemoveByPath. --- index.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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)