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:
authorQuang-Minh Nguyen <qmnguyen@gitlab.com>2023-03-14 13:40:15 +0300
committerQuang-Minh Nguyen <qmnguyen@gitlab.com>2023-03-16 05:50:46 +0300
commit936640076881092ad60202823f2dc81828aa4b6d (patch)
treeaa79a72dd5362f5185f5b55e8265d7106a9625a6 /internal/gitaly/hook
parent5c42c9509ff0fab716f7b903b9dc4be77f1c15d9 (diff)
lint: Fix manual quote interpolation offenses
This commit fixes manually quoted string interpolation with '%s' and "%s". Quoting this way doesn't escape special characters such as endline and makes debugging harder later. We encourage to use %q verb instead.
Diffstat (limited to 'internal/gitaly/hook')
-rw-r--r--internal/gitaly/hook/postreceive_test.go2
-rw-r--r--internal/gitaly/hook/prereceive_test.go1
-rw-r--r--internal/gitaly/hook/update_test.go1
3 files changed, 3 insertions, 1 deletions
diff --git a/internal/gitaly/hook/postreceive_test.go b/internal/gitaly/hook/postreceive_test.go
index d498ec0cc..b15b51906 100644
--- a/internal/gitaly/hook/postreceive_test.go
+++ b/internal/gitaly/hook/postreceive_test.go
@@ -382,7 +382,7 @@ func TestPostReceive_quarantine(t *testing.T) {
gittest.WriteCustomHook(t, repoPath, "post-receive", []byte(fmt.Sprintf(
`#!/bin/sh
- git cat-file -p '%s' || true
+ git cat-file -p %q || true
`, blobID.String())))
for repo, isQuarantined := range map[*gitalypb.Repository]bool{
diff --git a/internal/gitaly/hook/prereceive_test.go b/internal/gitaly/hook/prereceive_test.go
index 294c15941..54e4b22ea 100644
--- a/internal/gitaly/hook/prereceive_test.go
+++ b/internal/gitaly/hook/prereceive_test.go
@@ -196,6 +196,7 @@ func TestPrereceive_quarantine(t *testing.T) {
t, gitlab.MockAllowed, gitlab.MockPreReceive, gitlab.MockPostReceive,
))
+ //nolint:gitaly-linters
gittest.WriteCustomHook(t, repoPath, "pre-receive", []byte(fmt.Sprintf(
`#!/bin/sh
git cat-file -p '%s' || true
diff --git a/internal/gitaly/hook/update_test.go b/internal/gitaly/hook/update_test.go
index 6c968ea47..d34cb632c 100644
--- a/internal/gitaly/hook/update_test.go
+++ b/internal/gitaly/hook/update_test.go
@@ -227,6 +227,7 @@ func TestUpdate_quarantine(t *testing.T) {
t, gitlab.MockAllowed, gitlab.MockPreReceive, gitlab.MockPostReceive,
))
+ //nolint:gitaly-linters
gittest.WriteCustomHook(t, repoPath, "update", []byte(fmt.Sprintf(
`#!/bin/sh
git cat-file -p '%s' || true