diff --git a/integrations/api_issue_reaction_test.go b/integrations/api_issue_reaction_test.go index 20b83db2aab6..ad4adc1eae75 100644 --- a/integrations/api_issue_reaction_test.go +++ b/integrations/api_issue_reaction_test.go @@ -61,7 +61,7 @@ func TestAPIIssuesReactions(t *testing.T) { DecodeJSON(t, resp, &apiReactions) expectResponse := make(map[int]api.Reaction) expectResponse[0] = api.Reaction{ - User: convert.ToUser(user2, true, true), + User: convert.ToUser(user2, user2), Reaction: "eyes", Created: time.Unix(1573248003, 0), } @@ -121,12 +121,12 @@ func TestAPICommentReactions(t *testing.T) { DecodeJSON(t, resp, &apiReactions) expectResponse := make(map[int]api.Reaction) expectResponse[0] = api.Reaction{ - User: convert.ToUser(user2, true, true), + User: convert.ToUser(user2, user2), Reaction: "laugh", Created: time.Unix(1573248004, 0), } expectResponse[1] = api.Reaction{ - User: convert.ToUser(user1, true, true), + User: convert.ToUser(user1, user1), Reaction: "laugh", Created: time.Unix(1573248005, 0), } diff --git a/integrations/api_team_user_test.go b/integrations/api_team_user_test.go index eec8634cb034..5a8fba512ff3 100644 --- a/integrations/api_team_user_test.go +++ b/integrations/api_team_user_test.go @@ -31,5 +31,13 @@ func TestAPITeamUser(t *testing.T) { user2.Created = user2.Created.In(time.Local) user := models.AssertExistsAndLoadBean(t, &models.User{Name: "user2"}).(*models.User) - assert.Equal(t, convert.ToUser(user, true, false), user2) + expectedUser := convert.ToUser(user, user) + + // test time via unix timestamp + assert.EqualValues(t, expectedUser.LastLogin.Unix(), user2.LastLogin.Unix()) + assert.EqualValues(t, expectedUser.Created.Unix(), user2.Created.Unix()) + expectedUser.LastLogin = user2.LastLogin + expectedUser.Created = user2.Created + + assert.Equal(t, expectedUser, user2) } diff --git a/models/repo.go b/models/repo.go index 0cef30bbd2eb..7f2ec1f742bb 100644 --- a/models/repo.go +++ b/models/repo.go @@ -1083,7 +1083,7 @@ func CreateRepository(ctx DBContext, doer, u *User, repo *Repository, overwriteO units = append(units, RepoUnit{ RepoID: repo.ID, Type: tp, - Config: &PullRequestsConfig{AllowMerge: true, AllowRebase: true, AllowRebaseMerge: true, AllowSquash: true}, + Config: &PullRequestsConfig{AllowMerge: true, AllowRebase: true, AllowRebaseMerge: true, AllowSquash: true, DefaultMergeStyle: MergeStyleMerge}, }) } else { units = append(units, RepoUnit{ diff --git a/models/repo_unit.go b/models/repo_unit.go index 7702697ffae0..1d54579a6e72 100644 --- a/models/repo_unit.go +++ b/models/repo_unit.go @@ -102,6 +102,7 @@ type PullRequestsConfig struct { AllowSquash bool AllowManualMerge bool AutodetectManualMerge bool + DefaultMergeStyle MergeStyle } // FromDB fills up a PullRequestsConfig from serialized format. @@ -125,6 +126,15 @@ func (cfg *PullRequestsConfig) IsMergeStyleAllowed(mergeStyle MergeStyle) bool { mergeStyle == MergeStyleManuallyMerged && cfg.AllowManualMerge } +// GetDefaultMergeStyle returns the default merge style for this pull request +func (cfg *PullRequestsConfig) GetDefaultMergeStyle() MergeStyle { + if len(cfg.DefaultMergeStyle) != 0 { + return cfg.DefaultMergeStyle + } + + return MergeStyleMerge +} + // AllowedMergeStyleCount returns the total count of allowed merge styles for the PullRequestsConfig func (cfg *PullRequestsConfig) AllowedMergeStyleCount() int { count := 0 diff --git a/modules/convert/git_commit.go b/modules/convert/git_commit.go index 4e30ec2c0b33..c647dd4e1843 100644 --- a/modules/convert/git_commit.go +++ b/modules/convert/git_commit.go @@ -86,13 +86,13 @@ func ToCommit(repo *models.Repository, commit *git.Commit, userCache map[string] } if ok { - apiAuthor = ToUser(cacheAuthor, false, false) + apiAuthor = ToUser(cacheAuthor, nil) } else { author, err := models.GetUserByEmail(commit.Author.Email) if err != nil && !models.IsErrUserNotExist(err) { return nil, err } else if err == nil { - apiAuthor = ToUser(author, false, false) + apiAuthor = ToUser(author, nil) if userCache != nil { userCache[commit.Author.Email] = author } @@ -108,13 +108,13 @@ func ToCommit(repo *models.Repository, commit *git.Commit, userCache map[string] } if ok { - apiCommitter = ToUser(cacheCommitter, false, false) + apiCommitter = ToUser(cacheCommitter, nil) } else { committer, err := models.GetUserByEmail(commit.Committer.Email) if err != nil && !models.IsErrUserNotExist(err) { return nil, err } else if err == nil { - apiCommitter = ToUser(committer, false, false) + apiCommitter = ToUser(committer, nil) if userCache != nil { userCache[commit.Committer.Email] = committer } diff --git a/modules/convert/issue.go b/modules/convert/issue.go index b773e78a6b5c..da09aeaca41e 100644 --- a/modules/convert/issue.go +++ b/modules/convert/issue.go @@ -31,7 +31,7 @@ func ToAPIIssue(issue *models.Issue) *api.Issue { URL: issue.APIURL(), HTMLURL: issue.HTMLURL(), Index: issue.Index, - Poster: ToUser(issue.Poster, false, false), + Poster: ToUser(issue.Poster, nil), Title: issue.Title, Body: issue.Content, Ref: issue.Ref, @@ -66,9 +66,9 @@ func ToAPIIssue(issue *models.Issue) *api.Issue { } if len(issue.Assignees) > 0 { for _, assignee := range issue.Assignees { - apiIssue.Assignees = append(apiIssue.Assignees, ToUser(assignee, false, false)) + apiIssue.Assignees = append(apiIssue.Assignees, ToUser(assignee, nil)) } - apiIssue.Assignee = ToUser(issue.Assignees[0], false, false) // For compatibility, we're keeping the first assignee as `apiIssue.Assignee` + apiIssue.Assignee = ToUser(issue.Assignees[0], nil) // For compatibility, we're keeping the first assignee as `apiIssue.Assignee` } if issue.IsPull { if err := issue.LoadPullRequest(); err != nil { diff --git a/modules/convert/issue_comment.go b/modules/convert/issue_comment.go index cf65c876d3d0..1610b9f0d88c 100644 --- a/modules/convert/issue_comment.go +++ b/modules/convert/issue_comment.go @@ -13,7 +13,7 @@ import ( func ToComment(c *models.Comment) *api.Comment { return &api.Comment{ ID: c.ID, - Poster: ToUser(c.Poster, false, false), + Poster: ToUser(c.Poster, nil), HTMLURL: c.HTMLURL(), IssueURL: c.IssueURL(), PRURL: c.PRURL(), diff --git a/modules/convert/pull.go b/modules/convert/pull.go index 3c24f4532f3c..8bdf17a04942 100644 --- a/modules/convert/pull.go +++ b/modules/convert/pull.go @@ -159,7 +159,7 @@ func ToAPIPullRequest(pr *models.PullRequest) *api.PullRequest { if pr.HasMerged { apiPullRequest.Merged = pr.MergedUnix.AsTimePtr() apiPullRequest.MergedCommitID = &pr.MergedCommitID - apiPullRequest.MergedBy = ToUser(pr.Merger, false, false) + apiPullRequest.MergedBy = ToUser(pr.Merger, nil) } return apiPullRequest diff --git a/modules/convert/pull_review.go b/modules/convert/pull_review.go index 418cb711dc5e..18c6c8e58c87 100644 --- a/modules/convert/pull_review.go +++ b/modules/convert/pull_review.go @@ -20,14 +20,9 @@ func ToPullReview(r *models.Review, doer *models.User) (*api.PullReview, error) r.Reviewer = models.NewGhostUser() } - auth := false - if doer != nil { - auth = doer.IsAdmin || doer.ID == r.ReviewerID - } - result := &api.PullReview{ ID: r.ID, - Reviewer: ToUser(r.Reviewer, doer != nil, auth), + Reviewer: ToUser(r.Reviewer, doer), ReviewerTeam: ToTeam(r.ReviewerTeam), State: api.ReviewStateUnknown, Body: r.Content, @@ -88,14 +83,10 @@ func ToPullReviewCommentList(review *models.Review, doer *models.User) ([]*api.P for _, lines := range review.CodeComments { for _, comments := range lines { for _, comment := range comments { - auth := false - if doer != nil { - auth = doer.IsAdmin || doer.ID == comment.Poster.ID - } apiComment := &api.PullReviewComment{ ID: comment.ID, Body: comment.Content, - Reviewer: ToUser(comment.Poster, doer != nil, auth), + Reviewer: ToUser(comment.Poster, doer), ReviewID: review.ID, Created: comment.CreatedUnix.AsTime(), Updated: comment.UpdatedUnix.AsTime(), diff --git a/modules/convert/release.go b/modules/convert/release.go index d9def8963782..70f0d6e76405 100644 --- a/modules/convert/release.go +++ b/modules/convert/release.go @@ -29,7 +29,7 @@ func ToRelease(r *models.Release) *api.Release { IsPrerelease: r.IsPrerelease, CreatedAt: r.CreatedUnix.AsTime(), PublishedAt: r.CreatedUnix.AsTime(), - Publisher: ToUser(r.Publisher, false, false), + Publisher: ToUser(r.Publisher, nil), Attachments: assets, } } diff --git a/modules/convert/repository.go b/modules/convert/repository.go index 813201ca6844..9a4fbb97caec 100644 --- a/modules/convert/repository.go +++ b/modules/convert/repository.go @@ -71,6 +71,7 @@ func innerToRepo(repo *models.Repository, mode models.AccessMode, isParent bool) allowRebase := false allowRebaseMerge := false allowSquash := false + defaultMergeStyle := models.MergeStyleMerge if unit, err := repo.GetUnit(models.UnitTypePullRequests); err == nil { config := unit.PullRequestsConfig() hasPullRequests = true @@ -79,6 +80,7 @@ func innerToRepo(repo *models.Repository, mode models.AccessMode, isParent bool) allowRebase = config.AllowRebase allowRebaseMerge = config.AllowRebaseMerge allowSquash = config.AllowSquash + defaultMergeStyle = config.GetDefaultMergeStyle() } hasProjects := false if _, err := repo.GetUnit(models.UnitTypeProjects); err == nil { @@ -100,7 +102,7 @@ func innerToRepo(repo *models.Repository, mode models.AccessMode, isParent bool) return &api.Repository{ ID: repo.ID, - Owner: ToUser(repo.Owner, mode != models.AccessModeNone, mode >= models.AccessModeAdmin), + Owner: ToUserWithAccessMode(repo.Owner, mode), Name: repo.Name, FullName: repo.FullName(), Description: repo.Description, @@ -139,6 +141,7 @@ func innerToRepo(repo *models.Repository, mode models.AccessMode, isParent bool) AllowRebase: allowRebase, AllowRebaseMerge: allowRebaseMerge, AllowSquash: allowSquash, + DefaultMergeStyle: string(defaultMergeStyle), AvatarURL: repo.AvatarLink(), Internal: !repo.IsPrivate && repo.Owner.Visibility == api.VisibleTypePrivate, MirrorInterval: mirrorInterval, diff --git a/modules/convert/status.go b/modules/convert/status.go index f972fc333c13..bb2f964fe441 100644 --- a/modules/convert/status.go +++ b/modules/convert/status.go @@ -24,7 +24,7 @@ func ToCommitStatus(status *models.CommitStatus) *api.CommitStatus { if status.CreatorID != 0 { creator, _ := models.GetUserByID(status.CreatorID) - apiStatus.Creator = ToUser(creator, false, false) + apiStatus.Creator = ToUser(creator, nil) } return apiStatus diff --git a/modules/convert/user.go b/modules/convert/user.go index f5d853fd4d10..f3a33aee411d 100644 --- a/modules/convert/user.go +++ b/modules/convert/user.go @@ -11,11 +11,32 @@ import ( ) // ToUser convert models.User to api.User -// signed shall only be set if requester is logged in. authed shall only be set if user is site admin or user himself -func ToUser(user *models.User, signed, authed bool) *api.User { +// if doer is set, private information is added if the doer has the permission to see it +func ToUser(user, doer *models.User) *api.User { + if user == nil { + return nil + } + authed := false + signed := false + if doer != nil { + signed = true + authed = doer.ID == user.ID || doer.IsAdmin + } + return toUser(user, signed, authed) +} + +// ToUserWithAccessMode convert models.User to api.User +// AccessMode is not none show add some more information +func ToUserWithAccessMode(user *models.User, accessMode models.AccessMode) *api.User { if user == nil { return nil } + return toUser(user, accessMode != models.AccessModeNone, false) +} + +// toUser convert models.User to api.User +// signed shall only be set if requester is logged in. authed shall only be set if user is site admin or user himself +func toUser(user *models.User, signed, authed bool) *api.User { result := &api.User{ ID: user.ID, UserName: user.Name, diff --git a/modules/convert/user_test.go b/modules/convert/user_test.go index eff60d51830e..39396534410f 100644 --- a/modules/convert/user_test.go +++ b/modules/convert/user_test.go @@ -15,14 +15,14 @@ func TestUser_ToUser(t *testing.T) { user1 := models.AssertExistsAndLoadBean(t, &models.User{ID: 1, IsAdmin: true}).(*models.User) - apiUser := ToUser(user1, true, true) + apiUser := toUser(user1, true, true) assert.True(t, apiUser.IsAdmin) user2 := models.AssertExistsAndLoadBean(t, &models.User{ID: 2, IsAdmin: false}).(*models.User) - apiUser = ToUser(user2, true, true) + apiUser = toUser(user2, true, true) assert.False(t, apiUser.IsAdmin) - apiUser = ToUser(user1, false, false) + apiUser = toUser(user1, false, false) assert.False(t, apiUser.IsAdmin) } diff --git a/modules/forms/repo_form.go b/modules/forms/repo_form.go index 6c7c9bea138d..d9eb06d194db 100644 --- a/modules/forms/repo_form.go +++ b/modules/forms/repo_form.go @@ -140,6 +140,7 @@ type RepoSettingForm struct { PullsAllowRebaseMerge bool PullsAllowSquash bool PullsAllowManualMerge bool + PullsDefaultMergeStyle string EnableAutodetectManualMerge bool EnableTimetracker bool AllowOnlyContributorsToTrackTime bool diff --git a/modules/notification/webhook/webhook.go b/modules/notification/webhook/webhook.go index a7357a51cab7..90dc59021c5c 100644 --- a/modules/notification/webhook/webhook.go +++ b/modules/notification/webhook/webhook.go @@ -53,7 +53,7 @@ func (m *webhookNotifier) NotifyIssueClearLabels(doer *models.User, issue *model Index: issue.Index, PullRequest: convert.ToAPIPullRequest(issue.PullRequest), Repository: convert.ToRepo(issue.Repo, mode), - Sender: convert.ToUser(doer, false, false), + Sender: convert.ToUser(doer, nil), }) } else { err = webhook_services.PrepareWebhooks(issue.Repo, models.HookEventIssueLabel, &api.IssuePayload{ @@ -61,7 +61,7 @@ func (m *webhookNotifier) NotifyIssueClearLabels(doer *models.User, issue *model Index: issue.Index, Issue: convert.ToAPIIssue(issue), Repository: convert.ToRepo(issue.Repo, mode), - Sender: convert.ToUser(doer, false, false), + Sender: convert.ToUser(doer, nil), }) } if err != nil { @@ -77,7 +77,7 @@ func (m *webhookNotifier) NotifyForkRepository(doer *models.User, oldRepo, repo if err := webhook_services.PrepareWebhooks(oldRepo, models.HookEventFork, &api.ForkPayload{ Forkee: convert.ToRepo(oldRepo, oldMode), Repo: convert.ToRepo(repo, mode), - Sender: convert.ToUser(doer, false, false), + Sender: convert.ToUser(doer, nil), }); err != nil { log.Error("PrepareWebhooks [repo_id: %d]: %v", oldRepo.ID, err) } @@ -89,8 +89,8 @@ func (m *webhookNotifier) NotifyForkRepository(doer *models.User, oldRepo, repo if err := webhook_services.PrepareWebhooks(repo, models.HookEventRepository, &api.RepositoryPayload{ Action: api.HookRepoCreated, Repository: convert.ToRepo(repo, models.AccessModeOwner), - Organization: convert.ToUser(u, false, false), - Sender: convert.ToUser(doer, false, false), + Organization: convert.ToUser(u, nil), + Sender: convert.ToUser(doer, nil), }); err != nil { log.Error("PrepareWebhooks [repo_id: %d]: %v", repo.ID, err) } @@ -102,8 +102,8 @@ func (m *webhookNotifier) NotifyCreateRepository(doer *models.User, u *models.Us if err := webhook_services.PrepareWebhooks(repo, models.HookEventRepository, &api.RepositoryPayload{ Action: api.HookRepoCreated, Repository: convert.ToRepo(repo, models.AccessModeOwner), - Organization: convert.ToUser(u, false, false), - Sender: convert.ToUser(doer, false, false), + Organization: convert.ToUser(u, nil), + Sender: convert.ToUser(doer, nil), }); err != nil { log.Error("PrepareWebhooks [repo_id: %d]: %v", repo.ID, err) } @@ -115,8 +115,8 @@ func (m *webhookNotifier) NotifyDeleteRepository(doer *models.User, repo *models if err := webhook_services.PrepareWebhooks(repo, models.HookEventRepository, &api.RepositoryPayload{ Action: api.HookRepoDeleted, Repository: convert.ToRepo(repo, models.AccessModeOwner), - Organization: convert.ToUser(u, false, false), - Sender: convert.ToUser(doer, false, false), + Organization: convert.ToUser(u, nil), + Sender: convert.ToUser(doer, nil), }); err != nil { log.Error("PrepareWebhooks [repo_id: %d]: %v", repo.ID, err) } @@ -127,8 +127,8 @@ func (m *webhookNotifier) NotifyMigrateRepository(doer *models.User, u *models.U if err := webhook_services.PrepareWebhooks(repo, models.HookEventRepository, &api.RepositoryPayload{ Action: api.HookRepoCreated, Repository: convert.ToRepo(repo, models.AccessModeOwner), - Organization: convert.ToUser(u, false, false), - Sender: convert.ToUser(doer, false, false), + Organization: convert.ToUser(u, nil), + Sender: convert.ToUser(doer, nil), }); err != nil { log.Error("PrepareWebhooks [repo_id: %d]: %v", repo.ID, err) } @@ -147,7 +147,7 @@ func (m *webhookNotifier) NotifyIssueChangeAssignee(doer *models.User, issue *mo Index: issue.Index, PullRequest: convert.ToAPIPullRequest(issue.PullRequest), Repository: convert.ToRepo(issue.Repo, mode), - Sender: convert.ToUser(doer, false, false), + Sender: convert.ToUser(doer, nil), } if removed { apiPullRequest.Action = api.HookIssueUnassigned @@ -165,7 +165,7 @@ func (m *webhookNotifier) NotifyIssueChangeAssignee(doer *models.User, issue *mo Index: issue.Index, Issue: convert.ToAPIIssue(issue), Repository: convert.ToRepo(issue.Repo, mode), - Sender: convert.ToUser(doer, false, false), + Sender: convert.ToUser(doer, nil), } if removed { apiIssue.Action = api.HookIssueUnassigned @@ -199,7 +199,7 @@ func (m *webhookNotifier) NotifyIssueChangeTitle(doer *models.User, issue *model }, PullRequest: convert.ToAPIPullRequest(issue.PullRequest), Repository: convert.ToRepo(issue.Repo, mode), - Sender: convert.ToUser(doer, false, false), + Sender: convert.ToUser(doer, nil), }) } else { err = webhook_services.PrepareWebhooks(issue.Repo, models.HookEventIssues, &api.IssuePayload{ @@ -212,7 +212,7 @@ func (m *webhookNotifier) NotifyIssueChangeTitle(doer *models.User, issue *model }, Issue: convert.ToAPIIssue(issue), Repository: convert.ToRepo(issue.Repo, mode), - Sender: convert.ToUser(issue.Poster, false, false), + Sender: convert.ToUser(issue.Poster, nil), }) } @@ -234,7 +234,7 @@ func (m *webhookNotifier) NotifyIssueChangeStatus(doer *models.User, issue *mode Index: issue.Index, PullRequest: convert.ToAPIPullRequest(issue.PullRequest), Repository: convert.ToRepo(issue.Repo, mode), - Sender: convert.ToUser(doer, false, false), + Sender: convert.ToUser(doer, nil), } if isClosed { apiPullRequest.Action = api.HookIssueClosed @@ -247,7 +247,7 @@ func (m *webhookNotifier) NotifyIssueChangeStatus(doer *models.User, issue *mode Index: issue.Index, Issue: convert.ToAPIIssue(issue), Repository: convert.ToRepo(issue.Repo, mode), - Sender: convert.ToUser(doer, false, false), + Sender: convert.ToUser(doer, nil), } if isClosed { apiIssue.Action = api.HookIssueClosed @@ -277,7 +277,7 @@ func (m *webhookNotifier) NotifyNewIssue(issue *models.Issue, mentions []*models Index: issue.Index, Issue: convert.ToAPIIssue(issue), Repository: convert.ToRepo(issue.Repo, mode), - Sender: convert.ToUser(issue.Poster, false, false), + Sender: convert.ToUser(issue.Poster, nil), }); err != nil { log.Error("PrepareWebhooks: %v", err) } @@ -303,7 +303,7 @@ func (m *webhookNotifier) NotifyNewPullRequest(pull *models.PullRequest, mention Index: pull.Issue.Index, PullRequest: convert.ToAPIPullRequest(pull), Repository: convert.ToRepo(pull.Issue.Repo, mode), - Sender: convert.ToUser(pull.Issue.Poster, false, false), + Sender: convert.ToUser(pull.Issue.Poster, nil), }); err != nil { log.Error("PrepareWebhooks: %v", err) } @@ -324,7 +324,7 @@ func (m *webhookNotifier) NotifyIssueChangeContent(doer *models.User, issue *mod }, PullRequest: convert.ToAPIPullRequest(issue.PullRequest), Repository: convert.ToRepo(issue.Repo, mode), - Sender: convert.ToUser(doer, false, false), + Sender: convert.ToUser(doer, nil), }) } else { err = webhook_services.PrepareWebhooks(issue.Repo, models.HookEventIssues, &api.IssuePayload{ @@ -337,7 +337,7 @@ func (m *webhookNotifier) NotifyIssueChangeContent(doer *models.User, issue *mod }, Issue: convert.ToAPIIssue(issue), Repository: convert.ToRepo(issue.Repo, mode), - Sender: convert.ToUser(doer, false, false), + Sender: convert.ToUser(doer, nil), }) } if err != nil { @@ -374,7 +374,7 @@ func (m *webhookNotifier) NotifyUpdateComment(doer *models.User, c *models.Comme }, }, Repository: convert.ToRepo(c.Issue.Repo, mode), - Sender: convert.ToUser(doer, false, false), + Sender: convert.ToUser(doer, nil), IsPull: true, }) } else { @@ -388,7 +388,7 @@ func (m *webhookNotifier) NotifyUpdateComment(doer *models.User, c *models.Comme }, }, Repository: convert.ToRepo(c.Issue.Repo, mode), - Sender: convert.ToUser(doer, false, false), + Sender: convert.ToUser(doer, nil), IsPull: false, }) } @@ -409,7 +409,7 @@ func (m *webhookNotifier) NotifyCreateIssueComment(doer *models.User, repo *mode Issue: convert.ToAPIIssue(issue), Comment: convert.ToComment(comment), Repository: convert.ToRepo(repo, mode), - Sender: convert.ToUser(doer, false, false), + Sender: convert.ToUser(doer, nil), IsPull: true, }) } else { @@ -418,7 +418,7 @@ func (m *webhookNotifier) NotifyCreateIssueComment(doer *models.User, repo *mode Issue: convert.ToAPIIssue(issue), Comment: convert.ToComment(comment), Repository: convert.ToRepo(repo, mode), - Sender: convert.ToUser(doer, false, false), + Sender: convert.ToUser(doer, nil), IsPull: false, }) } @@ -453,7 +453,7 @@ func (m *webhookNotifier) NotifyDeleteComment(doer *models.User, comment *models Issue: convert.ToAPIIssue(comment.Issue), Comment: convert.ToComment(comment), Repository: convert.ToRepo(comment.Issue.Repo, mode), - Sender: convert.ToUser(doer, false, false), + Sender: convert.ToUser(doer, nil), IsPull: true, }) } else { @@ -462,7 +462,7 @@ func (m *webhookNotifier) NotifyDeleteComment(doer *models.User, comment *models Issue: convert.ToAPIIssue(comment.Issue), Comment: convert.ToComment(comment), Repository: convert.ToRepo(comment.Issue.Repo, mode), - Sender: convert.ToUser(doer, false, false), + Sender: convert.ToUser(doer, nil), IsPull: false, }) } @@ -502,7 +502,7 @@ func (m *webhookNotifier) NotifyIssueChangeLabels(doer *models.User, issue *mode Index: issue.Index, PullRequest: convert.ToAPIPullRequest(issue.PullRequest), Repository: convert.ToRepo(issue.Repo, models.AccessModeNone), - Sender: convert.ToUser(doer, false, false), + Sender: convert.ToUser(doer, nil), }) } else { err = webhook_services.PrepareWebhooks(issue.Repo, models.HookEventIssueLabel, &api.IssuePayload{ @@ -510,7 +510,7 @@ func (m *webhookNotifier) NotifyIssueChangeLabels(doer *models.User, issue *mode Index: issue.Index, Issue: convert.ToAPIIssue(issue), Repository: convert.ToRepo(issue.Repo, mode), - Sender: convert.ToUser(doer, false, false), + Sender: convert.ToUser(doer, nil), }) } if err != nil { @@ -544,7 +544,7 @@ func (m *webhookNotifier) NotifyIssueChangeMilestone(doer *models.User, issue *m Index: issue.Index, PullRequest: convert.ToAPIPullRequest(issue.PullRequest), Repository: convert.ToRepo(issue.Repo, mode), - Sender: convert.ToUser(doer, false, false), + Sender: convert.ToUser(doer, nil), }) } else { err = webhook_services.PrepareWebhooks(issue.Repo, models.HookEventIssueMilestone, &api.IssuePayload{ @@ -552,7 +552,7 @@ func (m *webhookNotifier) NotifyIssueChangeMilestone(doer *models.User, issue *m Index: issue.Index, Issue: convert.ToAPIIssue(issue), Repository: convert.ToRepo(issue.Repo, mode), - Sender: convert.ToUser(doer, false, false), + Sender: convert.ToUser(doer, nil), }) } if err != nil { @@ -561,7 +561,7 @@ func (m *webhookNotifier) NotifyIssueChangeMilestone(doer *models.User, issue *m } func (m *webhookNotifier) NotifyPushCommits(pusher *models.User, repo *models.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits) { - apiPusher := convert.ToUser(pusher, false, false) + apiPusher := convert.ToUser(pusher, nil) apiCommits, err := commits.ToAPIPayloadCommits(repo.RepoPath(), repo.HTMLURL()) if err != nil { log.Error("commits.ToAPIPayloadCommits failed: %v", err) @@ -610,7 +610,7 @@ func (*webhookNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *mod Index: pr.Issue.Index, PullRequest: convert.ToAPIPullRequest(pr), Repository: convert.ToRepo(pr.Issue.Repo, mode), - Sender: convert.ToUser(doer, false, false), + Sender: convert.ToUser(doer, nil), Action: api.HookIssueClosed, } @@ -643,7 +643,7 @@ func (m *webhookNotifier) NotifyPullRequestChangeTargetBranch(doer *models.User, }, PullRequest: convert.ToAPIPullRequest(issue.PullRequest), Repository: convert.ToRepo(issue.Repo, mode), - Sender: convert.ToUser(doer, false, false), + Sender: convert.ToUser(doer, nil), }) if err != nil { @@ -682,7 +682,7 @@ func (m *webhookNotifier) NotifyPullRequestReview(pr *models.PullRequest, review Index: review.Issue.Index, PullRequest: convert.ToAPIPullRequest(pr), Repository: convert.ToRepo(review.Issue.Repo, mode), - Sender: convert.ToUser(review.Reviewer, false, false), + Sender: convert.ToUser(review.Reviewer, nil), Review: &api.ReviewPayload{ Type: string(reviewHookType), Content: review.Content, @@ -693,7 +693,7 @@ func (m *webhookNotifier) NotifyPullRequestReview(pr *models.PullRequest, review } func (m *webhookNotifier) NotifyCreateRef(pusher *models.User, repo *models.Repository, refType, refFullName string) { - apiPusher := convert.ToUser(pusher, false, false) + apiPusher := convert.ToUser(pusher, nil) apiRepo := convert.ToRepo(repo, models.AccessModeNone) refName := git.RefEndName(refFullName) @@ -737,14 +737,14 @@ func (m *webhookNotifier) NotifyPullRequestSynchronized(doer *models.User, pr *m Index: pr.Issue.Index, PullRequest: convert.ToAPIPullRequest(pr), Repository: convert.ToRepo(pr.Issue.Repo, models.AccessModeNone), - Sender: convert.ToUser(doer, false, false), + Sender: convert.ToUser(doer, nil), }); err != nil { log.Error("PrepareWebhooks [pull_id: %v]: %v", pr.ID, err) } } func (m *webhookNotifier) NotifyDeleteRef(pusher *models.User, repo *models.Repository, refType, refFullName string) { - apiPusher := convert.ToUser(pusher, false, false) + apiPusher := convert.ToUser(pusher, nil) apiRepo := convert.ToRepo(repo, models.AccessModeNone) refName := git.RefEndName(refFullName) @@ -770,7 +770,7 @@ func sendReleaseHook(doer *models.User, rel *models.Release, action api.HookRele Action: action, Release: convert.ToRelease(rel), Repository: convert.ToRepo(rel.Repo, mode), - Sender: convert.ToUser(rel.Publisher, false, false), + Sender: convert.ToUser(rel.Publisher, nil), }); err != nil { log.Error("PrepareWebhooks: %v", err) } @@ -789,7 +789,7 @@ func (m *webhookNotifier) NotifyDeleteRelease(doer *models.User, rel *models.Rel } func (m *webhookNotifier) NotifySyncPushCommits(pusher *models.User, repo *models.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits) { - apiPusher := convert.ToUser(pusher, false, false) + apiPusher := convert.ToUser(pusher, nil) apiCommits, err := commits.ToAPIPayloadCommits(repo.RepoPath(), repo.HTMLURL()) if err != nil { log.Error("commits.ToAPIPayloadCommits failed: %v", err) diff --git a/modules/structs/repo.go b/modules/structs/repo.go index c47700cd0093..c23bd1033f1c 100644 --- a/modules/structs/repo.go +++ b/modules/structs/repo.go @@ -89,6 +89,7 @@ type Repository struct { AllowRebase bool `json:"allow_rebase"` AllowRebaseMerge bool `json:"allow_rebase_explicit"` AllowSquash bool `json:"allow_squash_merge"` + DefaultMergeStyle string `json:"default_merge_style"` AvatarURL string `json:"avatar_url"` Internal bool `json:"internal"` MirrorInterval string `json:"mirror_interval"` @@ -171,6 +172,8 @@ type EditRepoOption struct { AllowManualMerge *bool `json:"allow_manual_merge,omitempty"` // either `true` to enable AutodetectManualMerge, or `false` to prevent it. `has_pull_requests` must be `true`, Note: In some special cases, misjudgments can occur. AutodetectManualMerge *bool `json:"autodetect_manual_merge,omitempty"` + // set to a merge style to be used by this repository: "merge", "rebase", "rebase-merge", or "squash". `has_pull_requests` must be `true`. + DefaultMergeStyle *string `json:"default_merge_style,omitempty"` // set to `true` to archive this repository. Archived *bool `json:"archived,omitempty"` // set to a string like `8h30m0s` to set the mirror interval time diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index e679e1e87497..3a8783930efb 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1791,6 +1791,7 @@ settings.block_on_official_review_requests_desc = Merging will not be possible w settings.block_outdated_branch = Block merge if pull request is outdated settings.block_outdated_branch_desc = Merging will not be possible when head branch is behind base branch. settings.default_branch_desc = Select a default repository branch for pull requests and code commits: +settings.default_merge_style_desc = Default merge style for pull requests: settings.choose_branch = Choose a branch… settings.no_protected_branch = There are no protected branches. settings.edit_protected_branch = Edit diff --git a/routers/api/v1/admin/user.go b/routers/api/v1/admin/user.go index 116c622048d6..cbb9f6b21c4b 100644 --- a/routers/api/v1/admin/user.go +++ b/routers/api/v1/admin/user.go @@ -116,7 +116,7 @@ func CreateUser(ctx *context.APIContext) { if form.SendNotify { mailer.SendRegisterNotifyMail(ctx.Locale, u) } - ctx.JSON(http.StatusCreated, convert.ToUser(u, ctx.IsSigned, ctx.User.IsAdmin)) + ctx.JSON(http.StatusCreated, convert.ToUser(u, ctx.User)) } // EditUser api for modifying a user's information @@ -238,7 +238,7 @@ func EditUser(ctx *context.APIContext) { } log.Trace("Account profile updated by admin (%s): %s", ctx.User.Name, u.Name) - ctx.JSON(http.StatusOK, convert.ToUser(u, ctx.IsSigned, ctx.User.IsAdmin)) + ctx.JSON(http.StatusOK, convert.ToUser(u, ctx.User)) } // DeleteUser api for deleting a user @@ -403,7 +403,7 @@ func GetAllUsers(ctx *context.APIContext) { results := make([]*api.User, len(users)) for i := range users { - results[i] = convert.ToUser(users[i], ctx.IsSigned, ctx.User.IsAdmin) + results[i] = convert.ToUser(users[i], ctx.User) } ctx.SetLinkHeader(int(maxResults), listOptions.PageSize) diff --git a/routers/api/v1/org/member.go b/routers/api/v1/org/member.go index 5f0e36386ef3..09abad25572d 100644 --- a/routers/api/v1/org/member.go +++ b/routers/api/v1/org/member.go @@ -32,7 +32,7 @@ func listMembers(ctx *context.APIContext, publicOnly bool) { apiMembers := make([]*api.User, len(members)) for i, member := range members { - apiMembers[i] = convert.ToUser(member, ctx.IsSigned, ctx.User != nil && ctx.User.IsAdmin) + apiMembers[i] = convert.ToUser(member, ctx.User) } ctx.JSON(http.StatusOK, apiMembers) diff --git a/routers/api/v1/org/team.go b/routers/api/v1/org/team.go index c749751ac4db..99bbd9eefeee 100644 --- a/routers/api/v1/org/team.go +++ b/routers/api/v1/org/team.go @@ -337,7 +337,7 @@ func GetTeamMembers(ctx *context.APIContext) { } members := make([]*api.User, len(team.Members)) for i, member := range team.Members { - members[i] = convert.ToUser(member, ctx.IsSigned, ctx.User.IsAdmin) + members[i] = convert.ToUser(member, ctx.User) } ctx.JSON(http.StatusOK, members) } @@ -380,7 +380,7 @@ func GetTeamMember(ctx *context.APIContext) { ctx.NotFound() return } - ctx.JSON(http.StatusOK, convert.ToUser(u, ctx.IsSigned, ctx.User.IsAdmin)) + ctx.JSON(http.StatusOK, convert.ToUser(u, ctx.User)) } // AddTeamMember api for add a member to a team diff --git a/routers/api/v1/repo/collaborators.go b/routers/api/v1/repo/collaborators.go index a4fc1d8f114a..d0936019fadd 100644 --- a/routers/api/v1/repo/collaborators.go +++ b/routers/api/v1/repo/collaborators.go @@ -54,7 +54,7 @@ func ListCollaborators(ctx *context.APIContext) { } users := make([]*api.User, len(collaborators)) for i, collaborator := range collaborators { - users[i] = convert.ToUser(collaborator.User, ctx.IsSigned, ctx.User != nil && ctx.User.IsAdmin) + users[i] = convert.ToUser(collaborator.User, ctx.User) } ctx.JSON(http.StatusOK, users) } diff --git a/routers/api/v1/repo/hook.go b/routers/api/v1/repo/hook.go index 520a7a02027b..5a0911544a05 100644 --- a/routers/api/v1/repo/hook.go +++ b/routers/api/v1/repo/hook.go @@ -148,8 +148,8 @@ func TestHook(ctx *context.APIContext) { convert.ToPayloadCommit(ctx.Repo.Repository, ctx.Repo.Commit), }, Repo: convert.ToRepo(ctx.Repo.Repository, models.AccessModeNone), - Pusher: convert.ToUser(ctx.User, ctx.IsSigned, false), - Sender: convert.ToUser(ctx.User, ctx.IsSigned, false), + Pusher: convert.ToUserWithAccessMode(ctx.User, models.AccessModeNone), + Sender: convert.ToUserWithAccessMode(ctx.User, models.AccessModeNone), }); err != nil { ctx.Error(http.StatusInternalServerError, "PrepareWebhook: ", err) return diff --git a/routers/api/v1/repo/issue_reaction.go b/routers/api/v1/repo/issue_reaction.go index 3994c6b94134..d0ba8dac6583 100644 --- a/routers/api/v1/repo/issue_reaction.go +++ b/routers/api/v1/repo/issue_reaction.go @@ -81,7 +81,7 @@ func GetIssueCommentReactions(ctx *context.APIContext) { var result []api.Reaction for _, r := range reactions { result = append(result, api.Reaction{ - User: convert.ToUser(r.User, ctx.IsSigned, false), + User: convert.ToUser(r.User, ctx.User), Reaction: r.Type, Created: r.CreatedUnix.AsTime(), }) @@ -203,7 +203,7 @@ func changeIssueCommentReaction(ctx *context.APIContext, form api.EditReactionOp ctx.Error(http.StatusForbidden, err.Error(), err) } else if models.IsErrReactionAlreadyExist(err) { ctx.JSON(http.StatusOK, api.Reaction{ - User: convert.ToUser(ctx.User, true, true), + User: convert.ToUser(ctx.User, ctx.User), Reaction: reaction.Type, Created: reaction.CreatedUnix.AsTime(), }) @@ -214,7 +214,7 @@ func changeIssueCommentReaction(ctx *context.APIContext, form api.EditReactionOp } ctx.JSON(http.StatusCreated, api.Reaction{ - User: convert.ToUser(ctx.User, true, true), + User: convert.ToUser(ctx.User, ctx.User), Reaction: reaction.Type, Created: reaction.CreatedUnix.AsTime(), }) @@ -299,7 +299,7 @@ func GetIssueReactions(ctx *context.APIContext) { var result []api.Reaction for _, r := range reactions { result = append(result, api.Reaction{ - User: convert.ToUser(r.User, ctx.IsSigned, false), + User: convert.ToUser(r.User, ctx.User), Reaction: r.Type, Created: r.CreatedUnix.AsTime(), }) @@ -412,7 +412,7 @@ func changeIssueReaction(ctx *context.APIContext, form api.EditReactionOption, i ctx.Error(http.StatusForbidden, err.Error(), err) } else if models.IsErrReactionAlreadyExist(err) { ctx.JSON(http.StatusOK, api.Reaction{ - User: convert.ToUser(ctx.User, true, true), + User: convert.ToUser(ctx.User, ctx.User), Reaction: reaction.Type, Created: reaction.CreatedUnix.AsTime(), }) @@ -423,7 +423,7 @@ func changeIssueReaction(ctx *context.APIContext, form api.EditReactionOption, i } ctx.JSON(http.StatusCreated, api.Reaction{ - User: convert.ToUser(ctx.User, true, true), + User: convert.ToUser(ctx.User, ctx.User), Reaction: reaction.Type, Created: reaction.CreatedUnix.AsTime(), }) diff --git a/routers/api/v1/repo/issue_subscription.go b/routers/api/v1/repo/issue_subscription.go index 2bbd72299ab5..8acd378cc5e0 100644 --- a/routers/api/v1/repo/issue_subscription.go +++ b/routers/api/v1/repo/issue_subscription.go @@ -279,7 +279,7 @@ func GetIssueSubscribers(ctx *context.APIContext) { } apiUsers := make([]*api.User, 0, len(users)) for i := range users { - apiUsers[i] = convert.ToUser(users[i], ctx.IsSigned, false) + apiUsers[i] = convert.ToUser(users[i], ctx.User) } ctx.JSON(http.StatusOK, apiUsers) diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go index b7ed2951ad66..c422feb04327 100644 --- a/routers/api/v1/repo/repo.go +++ b/routers/api/v1/repo/repo.go @@ -731,6 +731,7 @@ func updateRepoUnits(ctx *context.APIContext, opts api.EditRepoOption) error { AllowSquash: true, AllowManualMerge: true, AutodetectManualMerge: false, + DefaultMergeStyle: models.MergeStyleMerge, } } else { config = unit.PullRequestsConfig() @@ -757,6 +758,9 @@ func updateRepoUnits(ctx *context.APIContext, opts api.EditRepoOption) error { if opts.AutodetectManualMerge != nil { config.AutodetectManualMerge = *opts.AutodetectManualMerge } + if opts.DefaultMergeStyle != nil { + config.DefaultMergeStyle = models.MergeStyle(*opts.DefaultMergeStyle) + } units = append(units, models.RepoUnit{ RepoID: repo.ID, diff --git a/routers/api/v1/repo/star.go b/routers/api/v1/repo/star.go index 774b326472ab..3af0a4ac125a 100644 --- a/routers/api/v1/repo/star.go +++ b/routers/api/v1/repo/star.go @@ -50,7 +50,7 @@ func ListStargazers(ctx *context.APIContext) { } users := make([]*api.User, len(stargazers)) for i, stargazer := range stargazers { - users[i] = convert.ToUser(stargazer, ctx.IsSigned, ctx.User != nil && ctx.User.IsAdmin) + users[i] = convert.ToUser(stargazer, ctx.User) } ctx.JSON(http.StatusOK, users) } diff --git a/routers/api/v1/repo/subscriber.go b/routers/api/v1/repo/subscriber.go index ac61710bd2bd..37bf3c29d466 100644 --- a/routers/api/v1/repo/subscriber.go +++ b/routers/api/v1/repo/subscriber.go @@ -50,7 +50,7 @@ func ListSubscribers(ctx *context.APIContext) { } users := make([]*api.User, len(subscribers)) for i, subscriber := range subscribers { - users[i] = convert.ToUser(subscriber, ctx.IsSigned, ctx.User != nil && ctx.User.IsAdmin) + users[i] = convert.ToUser(subscriber, ctx.User) } ctx.JSON(http.StatusOK, users) } diff --git a/routers/api/v1/user/follower.go b/routers/api/v1/user/follower.go index 39f3c2092738..4d316425cd09 100644 --- a/routers/api/v1/user/follower.go +++ b/routers/api/v1/user/follower.go @@ -18,7 +18,7 @@ import ( func responseAPIUsers(ctx *context.APIContext, users []*models.User) { apiUsers := make([]*api.User, len(users)) for i := range users { - apiUsers[i] = convert.ToUser(users[i], ctx.IsSigned, ctx.User != nil && ctx.User.IsAdmin) + apiUsers[i] = convert.ToUser(users[i], ctx.User) } ctx.JSON(http.StatusOK, &apiUsers) } diff --git a/routers/api/v1/user/key.go b/routers/api/v1/user/key.go index df8a11c61f1d..780cdf417c03 100644 --- a/routers/api/v1/user/key.go +++ b/routers/api/v1/user/key.go @@ -25,13 +25,13 @@ func appendPrivateInformation(apiKey *api.PublicKey, key *models.PublicKey, defa apiKey.KeyType = "user" if defaultUser.ID == key.OwnerID { - apiKey.Owner = convert.ToUser(defaultUser, true, true) + apiKey.Owner = convert.ToUser(defaultUser, defaultUser) } else { user, err := models.GetUserByID(key.OwnerID) if err != nil { return apiKey, err } - apiKey.Owner = convert.ToUser(user, true, true) + apiKey.Owner = convert.ToUser(user, user) } } else { apiKey.KeyType = "unknown" diff --git a/routers/api/v1/user/user.go b/routers/api/v1/user/user.go index ecc149fe52d3..6e811bf0f8a4 100644 --- a/routers/api/v1/user/user.go +++ b/routers/api/v1/user/user.go @@ -75,7 +75,7 @@ func Search(ctx *context.APIContext) { results := make([]*api.User, len(users)) for i := range users { - results[i] = convert.ToUser(users[i], ctx.IsSigned, ctx.User != nil && ctx.User.IsAdmin) + results[i] = convert.ToUser(users[i], ctx.User) } ctx.SetLinkHeader(int(maxResults), listOptions.PageSize) @@ -112,7 +112,7 @@ func GetInfo(ctx *context.APIContext) { return } - ctx.JSON(http.StatusOK, convert.ToUser(u, ctx.IsSigned, ctx.User != nil && (ctx.User.ID == u.ID || ctx.User.IsAdmin))) + ctx.JSON(http.StatusOK, convert.ToUser(u, ctx.User)) } // GetAuthenticatedUser get current user's information @@ -126,7 +126,7 @@ func GetAuthenticatedUser(ctx *context.APIContext) { // "200": // "$ref": "#/responses/User" - ctx.JSON(http.StatusOK, convert.ToUser(ctx.User, ctx.IsSigned, ctx.User != nil)) + ctx.JSON(http.StatusOK, convert.ToUser(ctx.User, ctx.User)) } // GetUserHeatmapData is the handler to get a users heatmap diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 15459cd0e6d3..c2969ca4bdf6 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -1484,7 +1484,10 @@ func ViewIssue(ctx *context.Context) { // Check correct values and select default if ms, ok := ctx.Data["MergeStyle"].(models.MergeStyle); !ok || !prConfig.IsMergeStyleAllowed(ms) { - if prConfig.AllowMerge { + defaultMergeStyle := prConfig.GetDefaultMergeStyle() + if prConfig.IsMergeStyleAllowed(defaultMergeStyle) && !ok { + ctx.Data["MergeStyle"] = defaultMergeStyle + } else if prConfig.AllowMerge { ctx.Data["MergeStyle"] = models.MergeStyleMerge } else if prConfig.AllowRebase { ctx.Data["MergeStyle"] = models.MergeStyleRebase diff --git a/routers/repo/setting.go b/routers/repo/setting.go index dc14b69b3b0b..8349164d4c62 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -322,6 +322,7 @@ func SettingsPost(ctx *context.Context) { AllowSquash: form.PullsAllowSquash, AllowManualMerge: form.PullsAllowManualMerge, AutodetectManualMerge: form.EnableAutodetectManualMerge, + DefaultMergeStyle: models.MergeStyle(form.PullsDefaultMergeStyle), }, }) } else if !models.UnitTypePullRequests.UnitGlobalDisabled() { diff --git a/routers/repo/webhook.go b/routers/repo/webhook.go index d1d4dc020828..1a5090a24ecb 100644 --- a/routers/repo/webhook.go +++ b/routers/repo/webhook.go @@ -1083,7 +1083,7 @@ func TestWebhook(ctx *context.Context) { } } - apiUser := convert.ToUser(ctx.User, true, true) + apiUser := convert.ToUserWithAccessMode(ctx.User, models.AccessModeNone) p := &api.PushPayload{ Ref: git.BranchPrefix + ctx.Repo.Repository.DefaultBranch, Before: commit.ID.String(), diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index f944eb8d8dea..514a2f5c0a9f 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -346,6 +346,39 @@ +
+

+ {{.i18n.Tr "repo.settings.default_merge_style_desc"}} +

+ +
{{end}} diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index d44583b81684..120d020958e5 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -13626,6 +13626,11 @@ "type": "string", "x-go-name": "DefaultBranch" }, + "default_merge_style": { + "description": "set to a merge style to be used by this repository: \"merge\", \"rebase\", \"rebase-merge\", or \"squash\". `has_pull_requests` must be `true`.", + "type": "string", + "x-go-name": "DefaultMergeStyle" + }, "description": { "description": "a short description of the repository.", "type": "string", @@ -15676,6 +15681,10 @@ "type": "string", "x-go-name": "DefaultBranch" }, + "default_merge_style": { + "type": "string", + "x-go-name": "DefaultMergeStyle" + }, "description": { "type": "string", "x-go-name": "Description"