From f0b42f343247aea940e5b465ca2221a731f617f5 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sun, 7 Jun 2026 08:57:29 +0000 Subject: internal/testgit: Fix lints too --- internal/testgit/commit.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'internal/testgit/commit.go') diff --git a/internal/testgit/commit.go b/internal/testgit/commit.go index b33b8904..a608d2fa 100644 --- a/internal/testgit/commit.go +++ b/internal/testgit/commit.go @@ -34,7 +34,9 @@ func (repo *Repo) CommitTree( ) (id.ObjectID, error) { tb.Helper() - args := []string{"commit-tree"} + args := make([]string, 0, 1+2*len(parents)+4) + args = append(args, "commit-tree") + for _, parent := range parents { args = append(args, "-p", parent.String()) } @@ -45,18 +47,23 @@ func (repo *Repo) CommitTree( if opts.Author.Name != "" { cmd.Env = setEnv(cmd.Env, "GIT_AUTHOR_NAME", opts.Author.Name) } + if opts.Author.Email != "" { cmd.Env = setEnv(cmd.Env, "GIT_AUTHOR_EMAIL", opts.Author.Email) } + if opts.AuthorDate != "" { cmd.Env = setEnv(cmd.Env, "GIT_AUTHOR_DATE", opts.AuthorDate) } + if opts.Committer.Name != "" { cmd.Env = setEnv(cmd.Env, "GIT_COMMITTER_NAME", opts.Committer.Name) } + if opts.Committer.Email != "" { cmd.Env = setEnv(cmd.Env, "GIT_COMMITTER_EMAIL", opts.Committer.Email) } + if opts.CommitterDate != "" { cmd.Env = setEnv(cmd.Env, "GIT_COMMITTER_DATE", opts.CommitterDate) } -- cgit v1.3.1-10-gc9f91