about summary refs log tree commit diff stats
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/index/index_meta.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/index/index_meta.go b/internal/index/index_meta.go
index f28abc4..47aa858 100644
--- a/internal/index/index_meta.go
+++ b/internal/index/index_meta.go
@@ -46,6 +46,14 @@ func createMeta(path string) (*Meta, error) {
 }
 
 func openMeta(path string) (*Meta, error) {
+	exists, err := file.Exists(path)
+	if err != nil {
+		return nil, errors.WithMessage(err, "could not check for existence of index metadata")
+	}
+	if !exists {
+		return createMeta(path)
+	}
+
 	j, err := os.ReadFile(path)
 	if err != nil {
 		return nil, errors.WithMessage(err, "could not open index metadata file")