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:
authorSami Hiltunen <shiltunen@gitlab.com>2023-04-24 21:05:31 +0300
committerSami Hiltunen <shiltunen@gitlab.com>2023-05-10 17:39:39 +0300
commite90e9711c39529b500419f2b4dcaebdc2f2aa85f (patch)
tree366b53d9f3238614f7b81dbe5ffe9b5754b2d4c6 /internal/gitaly/transaction_manager.go
parentf3210f39cd891a57759e8d81be9aa9d5742e18f7 (diff)
Move default branch verification to processTransaction
Transaction's default branch update is currently being verified in verifyReference. If the verification passes, the branch update is set in the returned log entry. We're soon going to change verifyReferences to not return a log entry but just the reference updates. This makes it easier to compose the log entry from various parts of the transaction. To facilitate this, move default branch verification to happen directly in processTransaction.
Diffstat (limited to 'internal/gitaly/transaction_manager.go')
-rw-r--r--internal/gitaly/transaction_manager.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/internal/gitaly/transaction_manager.go b/internal/gitaly/transaction_manager.go
index b434dc5e7..c20b099b1 100644
--- a/internal/gitaly/transaction_manager.go
+++ b/internal/gitaly/transaction_manager.go
@@ -627,6 +627,16 @@ func (mgr *TransactionManager) processTransaction() (returnedErr error) {
return fmt.Errorf("verify references: %w", err)
}
+ if transaction.defaultBranchUpdate != nil {
+ if err := mgr.verifyDefaultBranchUpdate(mgr.ctx, transaction); err != nil {
+ return fmt.Errorf("verify default branch update: %w", err)
+ }
+
+ logEntry.DefaultBranchUpdate = &gitalypb.LogEntry_DefaultBranchUpdate{
+ ReferenceName: []byte(transaction.defaultBranchUpdate.Reference),
+ }
+ }
+
if transaction.customHooksUpdate != nil {
logEntry.CustomHooksUpdate = &gitalypb.LogEntry_CustomHooksUpdate{
CustomHooksTar: transaction.customHooksUpdate.CustomHooksTAR,
@@ -915,16 +925,6 @@ func (mgr *TransactionManager) verifyReferences(ctx context.Context, transaction
return nil, fmt.Errorf("verify references with git: %w", err)
}
- if transaction.defaultBranchUpdate != nil {
- if err := mgr.verifyDefaultBranchUpdate(ctx, transaction); err != nil {
- return nil, fmt.Errorf("verify default branch update: %w", err)
- }
-
- logEntry.DefaultBranchUpdate = &gitalypb.LogEntry_DefaultBranchUpdate{
- ReferenceName: []byte(transaction.defaultBranchUpdate.Reference),
- }
- }
-
return logEntry, nil
}