You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

git.go 1.2KB

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright 2021 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package repo
  4. import (
  5. "context"
  6. "code.gitea.io/gitea/models/db"
  7. )
  8. // MergeStyle represents the approach to merge commits into base branch.
  9. type MergeStyle string
  10. const (
  11. // MergeStyleMerge create merge commit
  12. MergeStyleMerge MergeStyle = "merge"
  13. // MergeStyleRebase rebase before merging, and fast-forward
  14. MergeStyleRebase MergeStyle = "rebase"
  15. // MergeStyleRebaseMerge rebase before merging with merge commit (--no-ff)
  16. MergeStyleRebaseMerge MergeStyle = "rebase-merge"
  17. // MergeStyleSquash squash commits into single commit before merging
  18. MergeStyleSquash MergeStyle = "squash"
  19. // MergeStyleManuallyMerged pr has been merged manually, just mark it as merged directly
  20. MergeStyleManuallyMerged MergeStyle = "manually-merged"
  21. // MergeStyleRebaseUpdate not a merge style, used to update pull head by rebase
  22. MergeStyleRebaseUpdate MergeStyle = "rebase-update-only"
  23. )
  24. // UpdateDefaultBranch updates the default branch
  25. func UpdateDefaultBranch(ctx context.Context, repo *Repository) error {
  26. _, err := db.GetEngine(ctx).ID(repo.ID).Cols("default_branch").Update(repo)
  27. return err
  28. }