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:
authorJames Fargher <jfargher@gitlab.com>2023-07-07 06:54:32 +0300
committerJames Fargher <jfargher@gitlab.com>2023-07-13 02:25:37 +0300
commit93e2e4e88bbf54a1936cdb4dd3428dc949d72978 (patch)
treee9409f91b70dcb138709a7c4b9aa8e2abc046aec
parentaccf7121bc9c2da9a2ebd9876c5697dead38c8ee (diff)
operations: Use HEAD for default in ApplyPatchapply_patch_head_reference
The ApplyPatch RPC was using a default branch heuristic instead of directly using HEAD.
-rw-r--r--internal/gitaly/service/operations/apply_patch.go2
-rw-r--r--internal/gitaly/service/operations/apply_patch_test.go24
2 files changed, 1 insertions, 25 deletions
diff --git a/internal/gitaly/service/operations/apply_patch.go b/internal/gitaly/service/operations/apply_patch.go
index 34cefcd2a..7c96008d4 100644
--- a/internal/gitaly/service/operations/apply_patch.go
+++ b/internal/gitaly/service/operations/apply_patch.go
@@ -72,7 +72,7 @@ func (s *Server) userApplyPatch(ctx context.Context, header *gitalypb.UserApplyP
return fmt.Errorf("resolve target branch: %w", err)
}
- defaultBranch, err := repo.GetDefaultBranch(ctx)
+ defaultBranch, err := repo.HeadReference(ctx)
if err != nil {
return fmt.Errorf("default branch name: %w", err)
}
diff --git a/internal/gitaly/service/operations/apply_patch_test.go b/internal/gitaly/service/operations/apply_patch_test.go
index b8dffa014..bee4faa28 100644
--- a/internal/gitaly/service/operations/apply_patch_test.go
+++ b/internal/gitaly/service/operations/apply_patch_test.go
@@ -145,30 +145,6 @@ To restore the original branch and stop patching, run "git am --abort".
},
},
{
- desc: "creating a new branch from the first listed branch works",
- baseTree: []gittest.TreeEntry{
- {Path: "file", Mode: "100644", Content: "base-content"},
- },
- baseReference: "refs/heads/a",
- extraBranches: []string{"refs/heads/b"},
- targetBranch: "new-branch",
- patches: []patchDescription{
- {
- newTree: []gittest.TreeEntry{
- {Path: "file", Mode: "100644", Content: "patch 1"},
- },
- },
- },
- expected: func(t *testing.T, repoPath string) expected {
- return expected{
- branchCreation: true,
- tree: []gittest.TreeEntry{
- {Mode: "100644", Path: "file", Content: "patch 1"},
- },
- }
- },
- },
- {
desc: "multiple patches apply cleanly",
baseTree: []gittest.TreeEntry{
{Path: "file", Mode: "100644", Content: "base-content"},