aboutsummaryrefslogtreecommitdiffstats
path: root/repository/gogit.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2022-05-31 12:24:58 +0200
committerMichael Muré <batolettre@gmail.com>2022-05-31 12:24:58 +0200
commit50de0306dff5aa83981471f1245363aa40a268fa (patch)
tree01d1c4ed66b878757301cda39e61899f74ecb636 /repository/gogit.go
parent86dd450aaf592aa065a17d49d70d9d0352fa5ca3 (diff)
downloadgit-bug-50de0306dff5aa83981471f1245363aa40a268fa.tar.gz
gogit: close index before deleting it on disk
Diffstat (limited to 'repository/gogit.go')
-rw-r--r--repository/gogit.go17
1 files changed, 8 insertions, 9 deletions
diff --git a/repository/gogit.go b/repository/gogit.go
index 46a2cb0a..71cddfb2 100644
--- a/repository/gogit.go
+++ b/repository/gogit.go
@@ -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()