diff options
author | Stan Hu <stanhu@gmail.com> | 2020-01-28 12:40:25 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2020-01-28 12:40:25 +0300 |
commit | caf867a98f36a863a25c1531f96c5e184c2f5f6e (patch) | |
tree | b88e94529ececd994cd0b4103a560e86b72f4a4a /internal | |
parent | e9fc43bd8bca4aa2a45dd3d4ce596a6615049e01 (diff) |
Make UserSquashRequest branch a reserved keyword
The target branch is irrelevant; a squash should target the source
branch (or SHA).
Diffstat (limited to 'internal')
-rw-r--r-- | internal/service/operations/squash.go | 4 | ||||
-rw-r--r-- | internal/service/operations/squash_test.go | 27 |
2 files changed, 0 insertions, 31 deletions
diff --git a/internal/service/operations/squash.go b/internal/service/operations/squash.go index 56480fc60..b51572a4a 100644 --- a/internal/service/operations/squash.go +++ b/internal/service/operations/squash.go @@ -41,10 +41,6 @@ func validateUserSquashRequest(req *gitalypb.UserSquashRequest) error { return fmt.Errorf("empty SquashId") } - if len(req.GetBranch()) == 0 { - return fmt.Errorf("empty Branch") - } - if req.GetStartSha() == "" { return fmt.Errorf("empty StartSha") } diff --git a/internal/service/operations/squash_test.go b/internal/service/operations/squash_test.go index f7ce71f41..7115f7977 100644 --- a/internal/service/operations/squash_test.go +++ b/internal/service/operations/squash_test.go @@ -43,7 +43,6 @@ func TestSuccessfulUserSquashRequest(t *testing.T) { Repository: testRepo, User: user, SquashId: "1", - Branch: []byte(branchName), Author: author, CommitMessage: commitMessage, StartSha: startSha, @@ -94,7 +93,6 @@ func TestSuccessfulUserSquashRequestWith3wayMerge(t *testing.T) { Repository: testRepo, User: user, SquashId: "1", - Branch: []byte("gitaly/squash-test"), Author: author, CommitMessage: commitMessage, // The diff between two of these commits results in some changes to files/ruby/popen.rb @@ -145,7 +143,6 @@ func TestSplitIndex(t *testing.T) { Repository: testRepo, User: user, SquashId: "1", - Branch: []byte(branchName), Author: author, CommitMessage: commitMessage, StartSha: startSha, @@ -200,7 +197,6 @@ func TestSquashRequestWithRenamedFiles(t *testing.T) { Repository: testRepo, User: user, SquashId: "1", - Branch: []byte("squash-rename-test"), Author: author, CommitMessage: commitMessage, StartSha: startCommitID, @@ -235,13 +231,11 @@ func TestSuccessfulUserSquashRequestWithMissingFileOnTargetBranch(t *testing.T) defer cleanup() conflictingStartSha := "bbd36ad238d14e1c03ece0f3358f545092dc9ca3" - branchName := "gitaly-stuff" request := &gitalypb.UserSquashRequest{ Repository: testRepo, User: user, SquashId: "1", - Branch: []byte(branchName), Author: author, CommitMessage: commitMessage, StartSha: conflictingStartSha, @@ -274,7 +268,6 @@ func TestFailedUserSquashRequestDueToValidations(t *testing.T) { Repository: nil, User: user, SquashId: "1", - Branch: []byte("some-branch"), Author: user, CommitMessage: commitMessage, StartSha: startSha, @@ -288,7 +281,6 @@ func TestFailedUserSquashRequestDueToValidations(t *testing.T) { Repository: testRepo, User: nil, SquashId: "1", - Branch: []byte("some-branch"), Author: user, CommitMessage: commitMessage, StartSha: startSha, @@ -302,21 +294,6 @@ func TestFailedUserSquashRequestDueToValidations(t *testing.T) { Repository: testRepo, User: user, SquashId: "", - Branch: []byte("some-branch"), - Author: user, - CommitMessage: commitMessage, - StartSha: startSha, - EndSha: endSha, - }, - code: codes.InvalidArgument, - }, - { - desc: "empty Branch", - request: &gitalypb.UserSquashRequest{ - Repository: testRepo, - User: user, - SquashId: "1", - Branch: nil, Author: user, CommitMessage: commitMessage, StartSha: startSha, @@ -330,7 +307,6 @@ func TestFailedUserSquashRequestDueToValidations(t *testing.T) { Repository: testRepo, User: user, SquashId: "1", - Branch: []byte("some-branch"), Author: user, CommitMessage: commitMessage, StartSha: "", @@ -344,7 +320,6 @@ func TestFailedUserSquashRequestDueToValidations(t *testing.T) { Repository: testRepo, User: user, SquashId: "1", - Branch: []byte("some-branch"), Author: user, CommitMessage: commitMessage, StartSha: startSha, @@ -358,7 +333,6 @@ func TestFailedUserSquashRequestDueToValidations(t *testing.T) { Repository: testRepo, User: user, SquashId: "1", - Branch: []byte("some-branch"), Author: nil, CommitMessage: commitMessage, StartSha: startSha, @@ -372,7 +346,6 @@ func TestFailedUserSquashRequestDueToValidations(t *testing.T) { Repository: testRepo, User: user, SquashId: "1", - Branch: []byte("some-branch"), Author: user, CommitMessage: nil, StartSha: startSha, |