Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2021-09-14 09:32:08 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-09-14 10:01:22 +0300
commitb535a04f9a0642385345e5f3a168f8a5e6479846 (patch)
treede0c6f9e2e4b2023ada124cf66728137e7892048
parentb0b1299ef3a6b4e2e9738e3006f6576bfd43faf3 (diff)
updateref: Return typed error in case preparing ref update fails
When updating a reference with hooks, then we return a typed `Error` structure in case the underlying git-update-ref(1) process itself fails. Until now, this could really only happen when calling `Commit()` given that we never verified that preparing the ref updates really succeeded. We're about to fix it though such that we notice early when preparing the ref update fails. Prepare the hook updater for this and return a typed `Error` structure when `Prepare()` fails.
-rw-r--r--internal/git/updateref/update_with_hooks.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/git/updateref/update_with_hooks.go b/internal/git/updateref/update_with_hooks.go
index 22a943495..a1b04aa56 100644
--- a/internal/git/updateref/update_with_hooks.go
+++ b/internal/git/updateref/update_with_hooks.go
@@ -178,7 +178,7 @@ func (u *UpdaterWithHooks) UpdateReference(
// We need to lock the reference before executing the reference-transaction hook such that
// there cannot be any concurrent modification.
if err := updater.Prepare(); err != nil {
- return fmt.Errorf("preparing ref update: %w", err)
+ return Error{reference: reference.String()}
}
// We need to explicitly cancel the update here such that we release the lock when this
// function exits if there is any error between locking and committing.