diff options
| author | ezwiebel <[email protected]> | 2016-10-20 15:49:24 +1100 |
|---|---|---|
| committer | ezwiebel <[email protected]> | 2016-10-20 15:49:24 +1100 |
| commit | c18c8693feb805d9ffbd1d22444683ce5ac96477 (patch) | |
| tree | d17c7af3fbcb142678c94075835fc4678d79763f /index.go | |
| parent | f720800b507b72c0d64cdae70e2058bc620adc24 (diff) | |
Implement git_index_remove_directory in index wrapper
Diffstat (limited to 'index.go')
| -rw-r--r-- | index.go | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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) |
