* simple fix * fix test too * repair more twists use same sequence: first Author, then Commitertags/v1.11.0-rc1
NewBranchName: "master", | NewBranchName: "master", | ||||
Message: "Making this new file new/file.txt", | Message: "Making this new file new/file.txt", | ||||
Author: api.Identity{ | Author: api.Identity{ | ||||
Name: "John Doe", | |||||
Email: "johndoe@example.com", | |||||
Name: "Anne Doe", | |||||
Email: "annedoe@example.com", | |||||
}, | }, | ||||
Committer: api.Identity{ | Committer: api.Identity{ | ||||
Name: "Jane Doe", | |||||
Email: "janedoe@example.com", | |||||
Name: "John Doe", | |||||
Email: "johndoe@example.com", | |||||
}, | }, | ||||
}, | }, | ||||
Content: contentEncoded, | Content: contentEncoded, | ||||
HTMLURL: setting.AppURL + "user2/repo1/commit/" + commitID, | HTMLURL: setting.AppURL + "user2/repo1/commit/" + commitID, | ||||
Author: &api.CommitUser{ | Author: &api.CommitUser{ | ||||
Identity: api.Identity{ | Identity: api.Identity{ | ||||
Name: "Jane Doe", | |||||
Email: "janedoe@example.com", | |||||
Name: "Anne Doe", | |||||
Email: "annedoe@example.com", | |||||
}, | }, | ||||
}, | }, | ||||
Committer: &api.CommitUser{ | Committer: &api.CommitUser{ |
Email: "johndoe@example.com", | Email: "johndoe@example.com", | ||||
}, | }, | ||||
Committer: api.Identity{ | Committer: api.Identity{ | ||||
Name: "Jane Doe", | |||||
Email: "janedoe@example.com", | |||||
Name: "Anne Doe", | |||||
Email: "annedoe@example.com", | |||||
}, | }, | ||||
}, | }, | ||||
SHA: "103ff9234cefeee5ec5361d22b49fbb04d385885", | SHA: "103ff9234cefeee5ec5361d22b49fbb04d385885", | ||||
HTMLURL: setting.AppURL + "user2/repo1/commit/" + commitID, | HTMLURL: setting.AppURL + "user2/repo1/commit/" + commitID, | ||||
Author: &api.CommitUser{ | Author: &api.CommitUser{ | ||||
Identity: api.Identity{ | Identity: api.Identity{ | ||||
Name: "Jane Doe", | |||||
Email: "janedoe@example.com", | |||||
Name: "John Doe", | |||||
Email: "johndoe@example.com", | |||||
}, | }, | ||||
}, | }, | ||||
Committer: &api.CommitUser{ | Committer: &api.CommitUser{ | ||||
Identity: api.Identity{ | Identity: api.Identity{ | ||||
Name: "John Doe", | |||||
Email: "johndoe@example.com", | |||||
Name: "Anne Doe", | |||||
Email: "annedoe@example.com", | |||||
}, | }, | ||||
}, | }, | ||||
Message: "My update of README.md\n", | Message: "My update of README.md\n", |
message := strings.TrimSpace(opts.Message) | message := strings.TrimSpace(opts.Message) | ||||
author, committer := GetAuthorAndCommitterUsers(opts.Committer, opts.Author, doer) | |||||
author, committer := GetAuthorAndCommitterUsers(opts.Author, opts.Committer, doer) | |||||
t, err := NewTemporaryUploadRepository(repo) | t, err := NewTemporaryUploadRepository(repo) | ||||
if err != nil { | if err != nil { |
} | } | ||||
// GetAuthorAndCommitterUsers Gets the author and committer user objects from the IdentityOptions | // GetAuthorAndCommitterUsers Gets the author and committer user objects from the IdentityOptions | ||||
func GetAuthorAndCommitterUsers(author, committer *IdentityOptions, doer *models.User) (committerUser, authorUser *models.User) { | |||||
func GetAuthorAndCommitterUsers(author, committer *IdentityOptions, doer *models.User) (authorUser, committerUser *models.User) { | |||||
// Committer and author are optional. If they are not the doer (not same email address) | // Committer and author are optional. If they are not the doer (not same email address) | ||||
// then we use bogus User objects for them to store their FullName and Email. | // then we use bogus User objects for them to store their FullName and Email. | ||||
// If only one of the two are provided, we set both of them to it. | // If only one of the two are provided, we set both of them to it. |
message := strings.TrimSpace(opts.Message) | message := strings.TrimSpace(opts.Message) | ||||
author, committer := GetAuthorAndCommitterUsers(opts.Committer, opts.Author, doer) | |||||
author, committer := GetAuthorAndCommitterUsers(opts.Author, opts.Committer, doer) | |||||
t, err := NewTemporaryUploadRepository(repo) | t, err := NewTemporaryUploadRepository(repo) | ||||
if err != nil { | if err != nil { |