mirror of
https://github.com/MichaelMure/git-bug.git
synced 2024-12-14 08:45:30 +03:00
gogit: close index before deleting it on disk
This commit is contained in:
parent
86dd450aaf
commit
50de0306df
@ -351,21 +351,20 @@ func (repo *GoGitRepo) ClearBleveIndex(name string) error {
|
||||
repo.indexesMutex.Lock()
|
||||
defer repo.indexesMutex.Unlock()
|
||||
|
||||
path := filepath.Join(repo.localStorage.Root(), indexPath, name)
|
||||
|
||||
err := os.RemoveAll(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if index, ok := repo.indexes[name]; ok {
|
||||
err = index.Close()
|
||||
err := index.Close()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
delete(repo.indexes, name)
|
||||
}
|
||||
|
||||
path := filepath.Join(repo.localStorage.Root(), indexPath, name)
|
||||
err := os.RemoveAll(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -580,7 +579,7 @@ func (repo *GoGitRepo) StoreCommit(treeHash Hash, parents ...Hash) (Hash, error)
|
||||
return repo.StoreSignedCommit(treeHash, nil, parents...)
|
||||
}
|
||||
|
||||
// StoreCommit will store a Git commit with the given Git tree. If signKey is not nil, the commit
|
||||
// StoreSignedCommit will store a Git commit with the given Git tree. If signKey is not nil, the commit
|
||||
// will be signed accordingly.
|
||||
func (repo *GoGitRepo) StoreSignedCommit(treeHash Hash, signKey *openpgp.Entity, parents ...Hash) (Hash, error) {
|
||||
cfg, err := repo.r.Config()
|
||||
|
Loading…
Reference in New Issue
Block a user