diff options
| author | lhchavez <[email protected]> | 2019-01-08 02:51:21 +0000 |
|---|---|---|
| committer | lhchavez <[email protected]> | 2019-01-08 02:51:21 +0000 |
| commit | 6d67bde74a667dcdd060ef519832e8fd81064a8e (patch) | |
| tree | 705e564b9dedf0ceced47e6f01012cb9fcb6322f /index.go | |
| parent | 35518c78df9ae727651212512bfaa1a8dae02585 (diff) | |
| parent | 2609f4c6f25a7da56e2e4960c250ea3dfb53e82b (diff) | |
Merge remote-tracking branch 'upstream/master' into repository-create_commit_from_ids
Diffstat (limited to 'index.go')
| -rw-r--r-- | index.go | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -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 { |
