aboutsummaryrefslogtreecommitdiff
path: root/objectstore/loose/paths.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-04 08:26:56 +0800
committerGravatar Runxi Yu2026-03-04 08:59:53 +0800
commitab7501be34032fb9e5c48726a68ae90a917af9eb (patch)
tree20d005647569befea8133e953c3270e8fd2a2a5b /objectstore/loose/paths.go
parent*: gofumpt (diff)
signatureNo signature
*: Lint
Diffstat (limited to 'objectstore/loose/paths.go')
-rw-r--r--objectstore/loose/paths.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/objectstore/loose/paths.go b/objectstore/loose/paths.go
index 04730bd3..e8020d72 100644
--- a/objectstore/loose/paths.go
+++ b/objectstore/loose/paths.go
@@ -16,7 +16,9 @@ func (store *Store) objectPath(id objectid.ObjectID) (string, error) {
if id.Algorithm() != store.algo {
return "", fmt.Errorf("objectstore/loose: object id algorithm mismatch: got %s want %s", id.Algorithm(), store.algo)
}
+
hex := id.String()
+
return filepath.Join(hex[:2], hex[2:]), nil
}
@@ -27,12 +29,15 @@ func (store *Store) openObject(id objectid.ObjectID) (*os.File, error) {
if err != nil {
return nil, err
}
+
file, err := store.root.Open(relPath)
if err != nil {
if errors.Is(err, fs.ErrNotExist) {
return nil, objectstore.ErrObjectNotFound
}
+
return nil, err
}
+
return file, nil
}