aboutsummaryrefslogtreecommitdiff
path: root/objectstore/loose/write_test.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-06 21:19:56 +0800
committerGravatar Runxi Yu2026-03-07 00:34:30 +0800
commit01d15bccf3b1dcc51516b1f64d50950b31d7f8fb (patch)
treee491fcc762c67c1ef4ce54faafc5dafdb734ae8a /objectstore/loose/write_test.go
parentobjectstored/refstore: Weird ireturn behavior (diff)
signatureNo signature
Urgh I made some wrong amends and I'm too tired to separate the commits out this time
ancestor: Split out of reachability mergebase: Add merge base routines internal/commitquery: Add commit query context engine thingy internal/peel: Shared tag peeling errors: Shared object query errors internal/testgit: Add rooted repo helpers; remove raw path access objectstore/memory: Add in-memory object store objectid: Add Compare helper
Diffstat (limited to 'objectstore/loose/write_test.go')
-rw-r--r--objectstore/loose/write_test.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/objectstore/loose/write_test.go b/objectstore/loose/write_test.go
index 5604c5b0..a7b12622 100644
--- a/objectstore/loose/write_test.go
+++ b/objectstore/loose/write_test.go
@@ -14,7 +14,7 @@ func TestLooseStoreWriteReaderContentAgainstGit(t *testing.T) {
t.Parallel()
testgit.ForEachAlgorithm(t, func(t *testing.T, algo objectid.Algorithm) { //nolint:thelper
testRepo := testgit.NewRepo(t, testgit.RepoOptions{ObjectFormat: algo, Bare: true})
- store := openLooseStore(t, testRepo.Dir(), algo)
+ store := openLooseStore(t, testRepo, algo)
content := []byte("written-by-content-reader\n")
expectedHex := testRepo.RunInput(t, content, "hash-object", "-t", "blob", "--stdin")
@@ -54,7 +54,7 @@ func TestLooseStoreWriteReaderFullAgainstGit(t *testing.T) {
t.Parallel()
testgit.ForEachAlgorithm(t, func(t *testing.T, algo objectid.Algorithm) { //nolint:thelper
testRepo := testgit.NewRepo(t, testgit.RepoOptions{ObjectFormat: algo, Bare: true})
- store := openLooseStore(t, testRepo.Dir(), algo)
+ store := openLooseStore(t, testRepo, algo)
body := []byte("full-reader-body\n")
@@ -91,7 +91,7 @@ func TestLooseStoreReaderValidationErrors(t *testing.T) {
t.Run("content overflow", func(t *testing.T) {
t.Parallel()
testRepo := testgit.NewRepo(t, testgit.RepoOptions{ObjectFormat: algo, Bare: true})
- store := openLooseStore(t, testRepo.Dir(), algo)
+ store := openLooseStore(t, testRepo, algo)
_, err := store.WriteReaderContent(objecttype.TypeBlob, 1, bytes.NewReader([]byte("hello")))
if err == nil {
@@ -102,7 +102,7 @@ func TestLooseStoreReaderValidationErrors(t *testing.T) {
t.Run("content short", func(t *testing.T) {
t.Parallel()
testRepo := testgit.NewRepo(t, testgit.RepoOptions{ObjectFormat: algo, Bare: true})
- store := openLooseStore(t, testRepo.Dir(), algo)
+ store := openLooseStore(t, testRepo, algo)
_, err := store.WriteReaderContent(objecttype.TypeBlob, 5, bytes.NewReader([]byte("x")))
if err == nil {
@@ -113,7 +113,7 @@ func TestLooseStoreReaderValidationErrors(t *testing.T) {
t.Run("full malformed header", func(t *testing.T) {
t.Parallel()
testRepo := testgit.NewRepo(t, testgit.RepoOptions{ObjectFormat: algo, Bare: true})
- store := openLooseStore(t, testRepo.Dir(), algo)
+ store := openLooseStore(t, testRepo, algo)
_, err := store.WriteReaderFull(bytes.NewReader([]byte("not-a-header")))
if err == nil {
@@ -124,7 +124,7 @@ func TestLooseStoreReaderValidationErrors(t *testing.T) {
t.Run("full size mismatch", func(t *testing.T) {
t.Parallel()
testRepo := testgit.NewRepo(t, testgit.RepoOptions{ObjectFormat: algo, Bare: true})
- store := openLooseStore(t, testRepo.Dir(), algo)
+ store := openLooseStore(t, testRepo, algo)
raw := []byte("blob 1\x00hello")