Expose AddGitIgnoreRules and ClearGitIgnoreRules funcs

This commit is contained in:
Jose Alvarez 2015-10-13 11:31:00 -04:00
parent 22da351b1e
commit 22495763b7
1 changed files with 21 additions and 0 deletions

View File

@ -433,3 +433,24 @@ func (r *Repository) StateCleanup() error {
}
return nil
}
func (r *Repository) AddGitIgnoreRules(rules string) error {
runtime.LockOSThread()
defer runtime.UnlockOSThread()
crules := C.CString(rules)
defer C.free(unsafe.Pointer(crules))
if ret := C.git_ignore_add_rule(r.ptr, crules); ret < 0 {
return MakeGitError(ret)
}
return nil
}
func (r *Repository) ClearGitIgnoreRules() error {
runtime.LockOSThread()
defer runtime.UnlockOSThread()
if ret := C.git_ignore_clear_internal_rules(r.ptr); ret < 0 {
return MakeGitError(ret)
}
return nil
}