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>2022-08-10 14:21:29 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-08-11 15:08:47 +0300
commita466659bb61ed28cfce9676c64fa0351e61c5ab7 (patch)
treeefbf325c5a3400de51df3726a7dd9448f0a3918a /internal/git2go
parent1946de54c07b881e072a0d8629a4ffe58ef65edb (diff)
golangci-lint: Enforce consistent naming of `testing.TB` variables
Enforce consistent naming of `testing.TB` variables, which should be called `tb`, and adapt tests that violate this rule.
Diffstat (limited to 'internal/git2go')
-rw-r--r--internal/git2go/apply_test.go6
-rw-r--r--internal/git2go/commit_test.go30
2 files changed, 18 insertions, 18 deletions
diff --git a/internal/git2go/apply_test.go b/internal/git2go/apply_test.go
index c225f02b8..2888dab8b 100644
--- a/internal/git2go/apply_test.go
+++ b/internal/git2go/apply_test.go
@@ -98,9 +98,9 @@ func TestExecutor_Apply(t *testing.T) {
})
require.NoError(t, err)
- diffBetween := func(t testing.TB, fromCommit, toCommit git.ObjectID) []byte {
- t.Helper()
- return gittest.Exec(t, cfg, "-C", repoPath, "format-patch", "--stdout", fromCommit.String()+".."+toCommit.String())
+ diffBetween := func(tb testing.TB, fromCommit, toCommit git.ObjectID) []byte {
+ tb.Helper()
+ return gittest.Exec(tb, cfg, "-C", repoPath, "format-patch", "--stdout", fromCommit.String()+".."+toCommit.String())
}
for _, tc := range []struct {
diff --git a/internal/git2go/commit_test.go b/internal/git2go/commit_test.go
index 4999d668f..0fef58310 100644
--- a/internal/git2go/commit_test.go
+++ b/internal/git2go/commit_test.go
@@ -492,11 +492,11 @@ func TestExecutor_Commit(t *testing.T) {
}
}
-func getCommit(t testing.TB, ctx context.Context, repo *localrepo.Repo, oid git.ObjectID) commit {
- t.Helper()
+func getCommit(tb testing.TB, ctx context.Context, repo *localrepo.Repo, oid git.ObjectID) commit {
+ tb.Helper()
data, err := repo.ReadObject(ctx, oid)
- require.NoError(t, err)
+ require.NoError(tb, err)
var commit commit
lines := strings.Split(string(data), "\n")
@@ -507,19 +507,19 @@ func getCommit(t testing.TB, ctx context.Context, repo *localrepo.Repo, oid git.
}
split := strings.SplitN(line, " ", 2)
- require.Len(t, split, 2, "invalid commit: %q", data)
+ require.Len(tb, split, 2, "invalid commit: %q", data)
field, value := split[0], split[1]
switch field {
case "parent":
- require.Empty(t, commit.Parent, "multi parent parsing not implemented")
+ require.Empty(tb, commit.Parent, "multi parent parsing not implemented")
commit.Parent = git.ObjectID(value)
case "author":
- require.Empty(t, commit.Author, "commit contained multiple authors")
- commit.Author = unmarshalSignature(t, value)
+ require.Empty(tb, commit.Author, "commit contained multiple authors")
+ commit.Author = unmarshalSignature(tb, value)
case "committer":
- require.Empty(t, commit.Committer, "commit contained multiple committers")
- commit.Committer = unmarshalSignature(t, value)
+ require.Empty(tb, commit.Committer, "commit contained multiple committers")
+ commit.Committer = unmarshalSignature(tb, value)
default:
}
}
@@ -527,21 +527,21 @@ func getCommit(t testing.TB, ctx context.Context, repo *localrepo.Repo, oid git.
return commit
}
-func unmarshalSignature(t testing.TB, data string) Signature {
- t.Helper()
+func unmarshalSignature(tb testing.TB, data string) Signature {
+ tb.Helper()
// Format: NAME <EMAIL> DATE_UNIX DATE_TIMEZONE
split1 := strings.Split(data, " <")
- require.Len(t, split1, 2, "invalid signature: %q", data)
+ require.Len(tb, split1, 2, "invalid signature: %q", data)
split2 := strings.Split(split1[1], "> ")
- require.Len(t, split2, 2, "invalid signature: %q", data)
+ require.Len(tb, split2, 2, "invalid signature: %q", data)
split3 := strings.Split(split2[1], " ")
- require.Len(t, split3, 2, "invalid signature: %q", data)
+ require.Len(tb, split3, 2, "invalid signature: %q", data)
timestamp, err := strconv.ParseInt(split3[0], 10, 64)
- require.NoError(t, err)
+ require.NoError(tb, err)
return Signature{
Name: split1[0],