aboutsummaryrefslogtreecommitdiff
path: root/git_hooks_handle_linux.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-04-05 20:26:57 +0800
committerRunxi Yu <me@runxiyu.org>2025-04-05 20:26:57 +0800
commit20b4fe0c59357a433042732d46e38da9c3d14c3b (patch)
tree537d7d450701a839802b1d57a82bd07324dcba90 /git_hooks_handle_linux.go
parentmisc: Move utils.go's string function to misc (diff)
downloadforge-20b4fe0c59357a433042732d46e38da9c3d14c3b.tar.gz
forge-20b4fe0c59357a433042732d46e38da9c3d14c3b.tar.zst
forge-20b4fe0c59357a433042732d46e38da9c3d14c3b.zip
database shall no longer be a global variable
Diffstat (limited to 'git_hooks_handle_linux.go')
-rw-r--r--git_hooks_handle_linux.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/git_hooks_handle_linux.go b/git_hooks_handle_linux.go
index 37afba1..ca262e3 100644
--- a/git_hooks_handle_linux.go
+++ b/git_hooks_handle_linux.go
@@ -233,12 +233,12 @@ func (s *server) hooksHandler(conn net.Conn) {
var newMRLocalID int
if packPass.userID != 0 {
- err = database.QueryRow(ctx,
+ err = s.database.QueryRow(ctx,
"INSERT INTO merge_requests (repo_id, creator, source_ref, status) VALUES ($1, $2, $3, 'open') RETURNING repo_local_id",
packPass.repoID, packPass.userID, strings.TrimPrefix(refName, "refs/heads/"),
).Scan(&newMRLocalID)
} else {
- err = database.QueryRow(ctx,
+ err = s.database.QueryRow(ctx,
"INSERT INTO merge_requests (repo_id, source_ref, status) VALUES ($1, $2, 'open') RETURNING repo_local_id",
packPass.repoID, strings.TrimPrefix(refName, "refs/heads/"),
).Scan(&newMRLocalID)
@@ -259,7 +259,7 @@ func (s *server) hooksHandler(conn net.Conn) {
var existingMRUser int
var isAncestor bool
- err = database.QueryRow(ctx,
+ err = s.database.QueryRow(ctx,
"SELECT COALESCE(creator, 0) FROM merge_requests WHERE source_ref = $1 AND repo_id = $2",
strings.TrimPrefix(refName, "refs/heads/"), packPass.repoID,
).Scan(&existingMRUser)