Add index.Clear() to clear the index object
This commit is contained in:
parent
eec1547c20
commit
dd973b99ad
14
index.go
14
index.go
|
@ -145,6 +145,20 @@ func (v *Index) Path() string {
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clear clears the index object in memory; changes must be explicitly
|
||||||
|
// written to disk for them to take effect persistently
|
||||||
|
func (v *Index) Clear() error {
|
||||||
|
runtime.LockOSThread()
|
||||||
|
defer runtime.UnlockOSThread()
|
||||||
|
|
||||||
|
err := C.git_index_clear(v.ptr)
|
||||||
|
runtime.KeepAlive(v)
|
||||||
|
if err < 0 {
|
||||||
|
return MakeGitError(err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// Add adds or replaces the given entry to the index, making a copy of
|
// Add adds or replaces the given entry to the index, making a copy of
|
||||||
// the data
|
// the data
|
||||||
func (v *Index) Add(entry *IndexEntry) error {
|
func (v *Index) Add(entry *IndexEntry) error {
|
||||||
|
|
Loading…
Reference in New Issue