RemoveDirectory removes all entries from the index under a given directory.
(dir string, stage int)
| 369 | |
| 370 | // RemoveDirectory removes all entries from the index under a given directory. |
| 371 | func (v *Index) RemoveDirectory(dir string, stage int) error { |
| 372 | cstr := C.CString(dir) |
| 373 | defer C.free(unsafe.Pointer(cstr)) |
| 374 | |
| 375 | runtime.LockOSThread() |
| 376 | defer runtime.UnlockOSThread() |
| 377 | |
| 378 | ret := C.git_index_remove_directory(v.ptr, cstr, C.int(stage)) |
| 379 | runtime.KeepAlive(v) |
| 380 | if ret < 0 { |
| 381 | return MakeGitError(ret) |
| 382 | } |
| 383 | |
| 384 | return nil |
| 385 | } |
| 386 | |
| 387 | func (v *Index) WriteTreeTo(repo *Repository) (*Oid, error) { |
| 388 | oid := new(Oid) |