diff options
Diffstat (limited to 'network/receivepack/service')
| -rw-r--r-- | network/receivepack/service/apply.go | 5 | ||||
| -rw-r--r-- | network/receivepack/service/command.go | 2 | ||||
| -rw-r--r-- | network/receivepack/service/service_test.go | 8 |
3 files changed, 7 insertions, 8 deletions
diff --git a/network/receivepack/service/apply.go b/network/receivepack/service/apply.go index 8fa500ca..aae61340 100644 --- a/network/receivepack/service/apply.go +++ b/network/receivepack/service/apply.go @@ -2,7 +2,6 @@ package service import ( "codeberg.org/lindenii/furgit/internal/utils" - objectid "codeberg.org/lindenii/furgit/object/id" refstore "codeberg.org/lindenii/furgit/ref/store" ) @@ -101,7 +100,7 @@ func queueWriteTransaction(tx refstore.Transaction, command Command) error { return tx.Delete(command.Name, command.OldID) } - if command.OldID == objectid.Zero(command.OldID.Algorithm()) { + if command.OldID == command.OldID.Algorithm().Zero() { return tx.Create(command.Name, command.NewID) } @@ -115,7 +114,7 @@ func queueWriteBatch(batch refstore.Batch, command Command) { return } - if command.OldID == objectid.Zero(command.OldID.Algorithm()) { + if command.OldID == command.OldID.Algorithm().Zero() { batch.Create(command.Name, command.NewID) return diff --git a/network/receivepack/service/command.go b/network/receivepack/service/command.go index 0fd8961e..4d234214 100644 --- a/network/receivepack/service/command.go +++ b/network/receivepack/service/command.go @@ -22,7 +22,7 @@ func fillCommandErrors(result *Result, commands []Command, errText string) { } func isDelete(command Command) bool { - return command.NewID == objectid.Zero(command.NewID.Algorithm()) + return command.NewID == command.NewID.Algorithm().Zero() } func objectIDPointer(id objectid.ObjectID) *objectid.ObjectID { diff --git a/network/receivepack/service/service_test.go b/network/receivepack/service/service_test.go index fcbc355a..ffb08ea4 100644 --- a/network/receivepack/service/service_test.go +++ b/network/receivepack/service/service_test.go @@ -29,8 +29,8 @@ func TestExecutePackExpectedWithoutObjectsRoot(t *testing.T) { result, err := svc.Execute(context.Background(), &service.Request{ Commands: []service.Command{{ Name: "refs/heads/main", - OldID: objectid.Zero(algo), - NewID: objectid.Zero(algo), + OldID: algo.Zero(), + NewID: algo.Zero(), }}, PackExpected: true, Pack: strings.NewReader("not a pack"), @@ -73,8 +73,8 @@ func TestExecuteRemovesDerivedQuarantineAfterIngestFailure(t *testing.T) { result, err := svc.Execute(context.Background(), &service.Request{ Commands: []service.Command{{ Name: "refs/heads/main", - OldID: objectid.Zero(algo), - NewID: objectid.Zero(algo), + OldID: algo.Zero(), + NewID: algo.Zero(), }}, PackExpected: true, Pack: strings.NewReader("not a pack"), |
