summaryrefslogtreecommitdiff
path: root/index.go
diff options
context:
space:
mode:
authorlhchavez <[email protected]>2019-01-08 02:01:44 +0000
committerlhchavez <[email protected]>2019-01-08 02:01:44 +0000
commitb609c04b681655f474b13798f6c74658295fa3a4 (patch)
tree5373c4bc84d15ea28226103c11fd293dcdec7396 /index.go
parentd7fd15b1e0fda55c7237609bbdc8caddff49d032 (diff)
parent2609f4c6f25a7da56e2e4960c250ea3dfb53e82b (diff)
Merge remote-tracking branch 'upstream/master' into mempack
Diffstat (limited to 'index.go')
-rw-r--r--index.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/index.go b/index.go
index 5106516..dd13460 100644
--- a/index.go
+++ b/index.go
@@ -145,6 +145,20 @@ func (v *Index) Path() string {
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
// the data
func (v *Index) Add(entry *IndexEntry) error {