diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-12-07 10:50:23 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-12-13 15:32:45 +0300 |
commit | cb45100fe4702186595829d6264db49ba22b1711 (patch) | |
tree | a76bef57a7f80ffdfff090b0a739f9e290505a25 | |
parent | 7818d8a0a4a0348a50923642e04e9369a18a354f (diff) |
operaitons: Refactor how we write empty refs in UserApplyPatch tests
We're using thi gitaly-git2go executor to write empty commits, which is
needlessly verbose. Convert the code to use the gittest package instead.
-rw-r--r-- | internal/gitaly/service/operations/apply_patch_test.go | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/internal/gitaly/service/operations/apply_patch_test.go b/internal/gitaly/service/operations/apply_patch_test.go index e0953bf76..dc977080e 100644 --- a/internal/gitaly/service/operations/apply_patch_test.go +++ b/internal/gitaly/service/operations/apply_patch_test.go @@ -309,18 +309,9 @@ To restore the original branch and stop patching, run "git am --abort". } if tc.extraBranches != nil { - emptyCommit, err := executor.Commit(ctx, rewrittenRepo, git2go.CommitCommand{ - Repository: repoPath, - Author: author, - Committer: committer, - Message: "empty commit", - }) - require.NoError(t, err) - + emptyCommit := gittest.WriteCommit(t, cfg, repoPath) for _, extraBranch := range tc.extraBranches { - require.NoError(t, repo.UpdateRef(ctx, - git.NewReferenceNameFromBranchName(extraBranch), emptyCommit, git.ObjectHashSHA1.ZeroOID), - ) + gittest.WriteRef(t, cfg, repoPath, git.NewReferenceNameFromBranchName(extraBranch), emptyCommit) } } |