aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--network/receivepack/service/execute.go2
-rw-r--r--object/store/dual/dual_test.go14
-rw-r--r--object/store/quarantine.go4
3 files changed, 14 insertions, 6 deletions
diff --git a/network/receivepack/service/execute.go b/network/receivepack/service/execute.go
index 08177873..92d34a63 100644
--- a/network/receivepack/service/execute.go
+++ b/network/receivepack/service/execute.go
@@ -15,6 +15,7 @@ func (service *Service) Execute(ctx context.Context, req *Request) (*Result, err
result := &Result{
Commands: make([]CommandResult, 0, len(req.Commands)),
}
+
var err error
quarantine, ok := service.ingestQuarantine(result, req.Commands, req)
@@ -88,7 +89,6 @@ func (service *Service) Execute(ctx context.Context, req *Request) (*Result, err
return result, nil
}
- quarantine = nil
utils.BestEffortFprintf(service.opts.Progress, "promoting quarantine: done.\n")
}
diff --git a/object/store/dual/dual_test.go b/object/store/dual/dual_test.go
index 9e102734..1d25a775 100644
--- a/object/store/dual/dual_test.go
+++ b/object/store/dual/dual_test.go
@@ -76,6 +76,7 @@ func fixtureOID(t *testing.T, algo objectid.Algorithm, key string) objectid.Obje
t.Helper()
meta := fixtureMetadata(t, algo)
+
hex, ok := meta[key]
if !ok {
t.Fatalf("missing fixture metadata key %q", key)
@@ -93,12 +94,14 @@ func newDualStore(t *testing.T, repo *testgit.TestRepo, algo objectid.Algorithm)
t.Helper()
objectsRoot := repo.OpenObjectsRoot(t)
+
looseStore, err := loose.New(objectsRoot, algo)
if err != nil {
t.Fatalf("loose.New: %v", err)
}
packRoot := repo.OpenPackRoot(t)
+
packedStore, err := packed.New(packRoot, algo, packed.Options{WriteRev: true})
if err != nil {
t.Fatalf("packed.New: %v", err)
@@ -110,7 +113,7 @@ func newDualStore(t *testing.T, repo *testgit.TestRepo, algo objectid.Algorithm)
func TestDualReadsWritesAndQuarantine(t *testing.T) {
t.Parallel()
- testgit.ForEachAlgorithm(t, func(t *testing.T, algo objectid.Algorithm) {
+ testgit.ForEachAlgorithm(t, func(t *testing.T, algo objectid.Algorithm) { //nolint:thelper
head := fixtureOID(t, algo, "head")
packBytes := fixtureBytes(t, algo, "nonthin.pack")
@@ -138,6 +141,7 @@ func TestDualReadsWritesAndQuarantine(t *testing.T) {
}
looseContent := []byte("dual quarantine loose object\n")
+
looseID, err := objectQ.WriteBytesContent(objecttype.TypeBlob, looseContent)
if err != nil {
t.Fatalf("quarantine.WriteBytesContent: %v", err)
@@ -212,14 +216,18 @@ func TestDualReadsWritesAndQuarantine(t *testing.T) {
func TestDualQuarantineDiscardDropsBothHalves(t *testing.T) {
t.Parallel()
- testgit.ForEachAlgorithm(t, func(t *testing.T, algo objectid.Algorithm) {
+ testgit.ForEachAlgorithm(t, func(t *testing.T, algo objectid.Algorithm) { //nolint:thelper
head := fixtureOID(t, algo, "head")
packBytes := fixtureBytes(t, algo, "nonthin.pack")
repo := testgit.NewRepo(t, testgit.RepoOptions{ObjectFormat: algo, Bare: true})
store := newDualStore(t, repo, algo)
- quarantiner := any(store).(objectstore.Quarantiner)
+ quarantiner, ok := any(store).(objectstore.Quarantiner)
+ if !ok {
+ t.Fatal("expected objectstore.Quarantiner")
+ }
+
quarantine, err := quarantiner.BeginQuarantine(objectstore.QuarantineOptions{})
if err != nil {
t.Fatalf("BeginQuarantine: %v", err)
diff --git a/object/store/quarantine.go b/object/store/quarantine.go
index 6db12084..5fa97ee7 100644
--- a/object/store/quarantine.go
+++ b/object/store/quarantine.go
@@ -1,6 +1,6 @@
package objectstore
-// WriterQuarantine represents one quarantined write that accepts both object-
+// Quarantine represents one quarantined write that accepts both object-
// wise and pack-wise writes.
type Quarantine interface {
BaseQuarantine
@@ -13,7 +13,7 @@ type QuarantineOptions struct {
Pack PackQuarantineOptions
}
-// WriterQuarantiner creates coordinated quarantines that support both object-
+// Quarantiner creates coordinated quarantines that support both object-
// wise and pack-wise writes.
type Quarantiner interface {
BeginQuarantine(opts QuarantineOptions) (Quarantine, error)