Improve push update options (#10105)

* Improve push update options

* fix test

* More refactor and fix lint

* fix lint

* Fix lint

Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
Lunny Xiao 2020-02-03 04:27:34 +08:00 committed by GitHub
parent 70aa629ae7
commit bf1970d0bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 193 additions and 153 deletions

View file

@ -32,9 +32,11 @@ func TestCommitRepoAction(t *testing.T) {
userID: 2,
repositoryID: 16,
commitRepoActionOptions: CommitRepoActionOptions{
RefFullName: "refName",
OldCommitID: "oldCommitID",
NewCommitID: "newCommitID",
PushUpdateOptions: PushUpdateOptions{
RefFullName: "refName",
OldCommitID: "oldCommitID",
NewCommitID: "newCommitID",
},
Commits: &repository.PushCommits{
Commits: []*repository.PushCommit{
{
@ -66,10 +68,12 @@ func TestCommitRepoAction(t *testing.T) {
userID: 2,
repositoryID: 1,
commitRepoActionOptions: CommitRepoActionOptions{
RefFullName: git.TagPrefix + "v1.1",
OldCommitID: git.EmptySHA,
NewCommitID: "newCommitID",
Commits: &repository.PushCommits{},
PushUpdateOptions: PushUpdateOptions{
RefFullName: git.TagPrefix + "v1.1",
OldCommitID: git.EmptySHA,
NewCommitID: "newCommitID",
},
Commits: &repository.PushCommits{},
},
action: models.Action{
OpType: models.ActionPushTag,
@ -80,10 +84,12 @@ func TestCommitRepoAction(t *testing.T) {
userID: 2,
repositoryID: 1,
commitRepoActionOptions: CommitRepoActionOptions{
RefFullName: git.TagPrefix + "v1.1",
OldCommitID: "oldCommitID",
NewCommitID: git.EmptySHA,
Commits: &repository.PushCommits{},
PushUpdateOptions: PushUpdateOptions{
RefFullName: git.TagPrefix + "v1.1",
OldCommitID: "oldCommitID",
NewCommitID: git.EmptySHA,
},
Commits: &repository.PushCommits{},
},
action: models.Action{
OpType: models.ActionDeleteTag,
@ -94,10 +100,12 @@ func TestCommitRepoAction(t *testing.T) {
userID: 2,
repositoryID: 1,
commitRepoActionOptions: CommitRepoActionOptions{
RefFullName: git.BranchPrefix + "feature/1",
OldCommitID: "oldCommitID",
NewCommitID: git.EmptySHA,
Commits: &repository.PushCommits{},
PushUpdateOptions: PushUpdateOptions{
RefFullName: git.BranchPrefix + "feature/1",
OldCommitID: "oldCommitID",
NewCommitID: git.EmptySHA,
},
Commits: &repository.PushCommits{},
},
action: models.Action{
OpType: models.ActionDeleteBranch,