aboutsummaryrefslogtreecommitdiff
path: root/refstore/files/update_verify_current.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-25 14:31:16 +0000
committerGravatar Runxi Yu2026-03-25 14:31:16 +0000
commit48ff647cf4a8bb8f23fcd6b8616f56a8ef72b980 (patch)
treeae199c38042adaa544d5f7d31351661d5831381e /refstore/files/update_verify_current.go
parent*: objectstore -> object/store (diff)
signatureNo signature
*: refstore -> ref/store
Diffstat (limited to 'refstore/files/update_verify_current.go')
-rw-r--r--refstore/files/update_verify_current.go60
1 files changed, 0 insertions, 60 deletions
diff --git a/refstore/files/update_verify_current.go b/refstore/files/update_verify_current.go
deleted file mode 100644
index f8035994..00000000
--- a/refstore/files/update_verify_current.go
+++ /dev/null
@@ -1,60 +0,0 @@
-package files
-
-import (
- "strings"
-
- "codeberg.org/lindenii/furgit/refstore"
-)
-
-func (executor *refUpdateExecutor) verifyPreparedUpdateCurrent(item preparedUpdate) error {
- switch item.op.kind {
- case updateCreate:
- if item.target.ref.kind != directMissing {
- return wrapUpdateError(item.op.name, &refstore.CreateExistsError{})
- }
-
- return nil
- case updateReplace, updateDelete, updateVerify:
- if item.target.ref.kind == directMissing {
- return wrapUpdateError(item.op.name, refstore.ErrReferenceNotFound)
- }
-
- if item.target.ref.kind != directDetached {
- return wrapUpdateError(item.op.name, &refstore.ExpectedDetachedError{})
- }
-
- if item.target.ref.id != item.op.oldID {
- return wrapUpdateError(item.op.name, &refstore.IncorrectOldValueError{
- Actual: item.target.ref.id.String(),
- Expected: item.op.oldID.String(),
- })
- }
-
- return nil
- case updateCreateSymbolic:
- if item.target.ref.kind != directMissing {
- return wrapUpdateError(item.op.name, &refstore.CreateExistsError{})
- }
-
- return nil
- case updateReplaceSymbolic, updateDeleteSymbolic, updateVerifySymbolic:
- if item.target.ref.kind == directMissing {
- return wrapUpdateError(item.op.name, refstore.ErrReferenceNotFound)
- }
-
- if item.target.ref.kind != directSymbolic {
- return wrapUpdateError(item.op.name, &refstore.ExpectedSymbolicError{})
- }
-
- if strings.TrimSpace(item.target.ref.target) != strings.TrimSpace(item.op.oldTarget) {
- return wrapUpdateError(item.op.name, &refstore.IncorrectOldValueError{
- Actual: strings.TrimSpace(item.target.ref.target),
- Expected: strings.TrimSpace(item.op.oldTarget),
- })
- }
-
- return nil
- }
-
- return nil
-}