diff options
author | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2019-09-12 15:54:29 +0300 |
---|---|---|
committer | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2019-09-12 15:58:05 +0300 |
commit | 3e20c36d9cf7ea3d5dcee82b589c5d8b173459f8 (patch) | |
tree | 16158c121d2f8693072f3c1b963a32daa2f7b2c7 | |
parent | 67af2bf1f3d2b00249932476a5d16e7ef0cfa9a5 (diff) |
Fix mktree not having an authro
Allows me to run this test locally again, as we dynamically set an
author now.
-rw-r--r-- | internal/service/commit/list_last_commits_for_tree_test.go | 1 | ||||
-rw-r--r-- | internal/testhelper/commit.go | 17 |
2 files changed, 14 insertions, 4 deletions
diff --git a/internal/service/commit/list_last_commits_for_tree_test.go b/internal/service/commit/list_last_commits_for_tree_test.go index 722964c58..c7b611dba 100644 --- a/internal/service/commit/list_last_commits_for_tree_test.go +++ b/internal/service/commit/list_last_commits_for_tree_test.go @@ -311,6 +311,7 @@ func TestNonUtf8ListLastCommitsForTreeRequest(t *testing.T) { client, conn := newCommitServiceClient(t, serverSockerPath) defer conn.Close() + ctx, cancel := testhelper.Context() defer cancel() diff --git a/internal/testhelper/commit.go b/internal/testhelper/commit.go index f31a38ce2..4408f6fcb 100644 --- a/internal/testhelper/commit.go +++ b/internal/testhelper/commit.go @@ -19,6 +19,11 @@ type CreateCommitOpts struct { ParentID string } +const ( + committerName = "Scrooge McDuck" + committerEmail = "scrooge@mcduck.com" +) + // CreateCommit makes a new empty commit and updates the named branch to point to it. func CreateCommit(t *testing.T, repoPath, branchName string, opts *CreateCommitOpts) string { message := "message" @@ -35,9 +40,6 @@ func CreateCommit(t *testing.T, repoPath, branchName string, opts *CreateCommitO } } - committerName := "Scrooge McDuck" - committerEmail := "scrooge@mcduck.com" - // message can be very large, passing it directly in args would blow things up! stdin := bytes.NewBufferString(message) @@ -93,7 +95,14 @@ func CreateCommitInAlternateObjectDirectory(t *testing.T, repoPath, altObjectsDi func CommitBlobWithName(t *testing.T, testRepoPath, blobID, fileName, commitMessage string) string { mktreeIn := strings.NewReader(fmt.Sprintf("100644 blob %s\t%s", blobID, fileName)) treeID := text.ChompBytes(MustRunCommand(t, mktreeIn, "git", "-C", testRepoPath, "mktree")) - return text.ChompBytes(MustRunCommand(t, nil, "git", "-C", testRepoPath, "commit-tree", treeID, "-m", commitMessage)) + + return text.ChompBytes( + MustRunCommand(t, nil, "git", + "-c", fmt.Sprintf("user.name=%s", committerName), + "-c", fmt.Sprintf("user.email=%s", committerEmail), + "-C", testRepoPath, "commit-tree", treeID, "-m", commitMessage), + ) + } // CreateCommitOnNewBranch creates a branch and a commit, returning the commit sha and the branch name respectivelyi |