Documentation
¶
Index ¶
- Variables
- func AddBranches(ctx context.Context, branches []*Branch) error
- func AddDeletedBranch(ctx context.Context, repoID int64, branchName string, deletedByID int64) error
- func BranchesToNamesSet(branches []*Branch) container.Set[string]
- func CommitStatusesHideActionsURL(ctx context.Context, statuses []*CommitStatus)
- func CopyLFS(ctx context.Context, newRepo, oldRepo *repo_model.Repository) error
- func CountLFSLockByRepoID(ctx context.Context, repoID int64) (int64, error)
- func CountLFSMetaObjects(ctx context.Context, repoID int64) (int64, error)
- func CountLatestCommitStatus(ctx context.Context, repoID int64, sha string) (int64, error)
- func DeleteBranches(ctx context.Context, repoID, doerID int64, branchIDs []int64) error
- func DeleteProtectedBranch(ctx context.Context, repo *repo_model.Repository, id int64) (err error)
- func DeleteProtectedTag(ctx context.Context, pt *ProtectedTag) error
- func DeleteRepoBranches(ctx context.Context, repoID int64) error
- func ExistsLFSObject(ctx context.Context, oid string) (bool, error)
- func FindAllMatchedBranches(ctx context.Context, repoID int64, ruleName string) ([]string, error)
- func FindBranchNames(ctx context.Context, opts FindBranchOptions) ([]string, error)
- func FindBranchesByRepoAndBranchName(ctx context.Context, repoBranches map[int64]string) (map[int64]string, error)
- func FindRepoRecentCommitStatusContexts(ctx context.Context, repoID int64, before time.Duration) ([]string, error)
- func GetLatestCommitStatusForPairs(ctx context.Context, repoSHAs []RepoSHA) (map[int64][]*CommitStatus, error)
- func GetLatestCommitStatusForRepoCommitIDs(ctx context.Context, repoID int64, commitIDs []string) (map[string][]*CommitStatus, error)
- func GetNextCommitStatusIndex(ctx context.Context, repoID int64, sha string) (int64, error)
- func GetRepoLFSSize(ctx context.Context, repoID int64) (int64, error)
- func InsertProtectedTag(ctx context.Context, pt *ProtectedTag) error
- func IsBranchExist(ctx context.Context, repoID int64, branchName string) (bool, error)
- func IsBranchProtected(ctx context.Context, repoID int64, branchName string) (bool, error)
- func IsErrBranchAlreadyExists(err error) bool
- func IsErrBranchNameConflict(err error) bool
- func IsErrBranchNotExist(err error) bool
- func IsErrBranchesEqual(err error) bool
- func IsErrLFSLockAlreadyExist(err error) bool
- func IsErrLFSLockNotExist(err error) bool
- func IsRuleNameSpecial(ruleName string) bool
- func IsUserAllowedModifyTag(ctx context.Context, pt *ProtectedTag, userID int64) (bool, error)
- func IsUserAllowedToControlTag(ctx context.Context, tags []*ProtectedTag, tagName string, userID int64) (bool, error)
- func IsUserMergeWhitelisted(ctx context.Context, protectBranch *ProtectedBranch, userID int64, ...) bool
- func IsUserOfficialReviewer(ctx context.Context, protectBranch *ProtectedBranch, user *user_model.User) (bool, error)
- func IterateLFSMetaObjectsForRepo(ctx context.Context, repoID int64, ...) error
- func IterateRepositoryIDsWithLFSMetaObjects(ctx context.Context, f func(ctx context.Context, repoID, count int64) error) error
- func LFSAutoAssociate(ctx context.Context, metas []*LFSMetaObject, user *user_model.User, ...) error
- func LFSObjectAccessible(ctx context.Context, user *user_model.User, oid string) (bool, error)
- func MarkLFSMetaObject(ctx context.Context, id int64) error
- func NewCommitStatus(ctx context.Context, opts NewCommitStatusOptions) error
- func RemoveDeletedBranchByID(ctx context.Context, repoID, branchID int64) error
- func RemoveLFSMetaObjectByOid(ctx context.Context, repoID int64, oid string) (int64, error)
- func RemoveLFSMetaObjectByOidFn(ctx context.Context, repoID int64, oid string, fn func(count int64) error) (int64, error)
- func RemoveOldDeletedBranches(ctx context.Context, olderThan time.Duration)
- func RemoveTeamIDFromProtectedBranch(ctx context.Context, p *ProtectedBranch, teamID int64) error
- func RemoveUserIDFromProtectedBranch(ctx context.Context, p *ProtectedBranch, userID int64) error
- func RenameBranch(ctx context.Context, repo *repo_model.Repository, from, to string, ...) (err error)
- func UpdateBranch(ctx context.Context, repoID, pusherID int64, branchName string, ...) (int64, error)
- func UpdateCommitStatusSummary(ctx context.Context, repoID int64, sha string) error
- func UpdateProtectBranch(ctx context.Context, repo *repo_model.Repository, ...) (err error)
- func UpdateProtectBranchPriorities(ctx context.Context, repo *repo_model.Repository, ids []int64) error
- func UpdateProtectedTag(ctx context.Context, pt *ProtectedTag) error
- type Branch
- type BranchList
- type CommitStatus
- func (status *CommitStatus) APIURL(ctx context.Context) string
- func (status *CommitStatus) HideActionsURL(ctx context.Context)
- func (status *CommitStatus) LocaleString(lang translation.Locale) string
- func (status *CommitStatus) ParseGiteaActionsTargetURL(ctx context.Context) (runID, jobID int64, ok bool)
- type CommitStatusIndex
- type CommitStatusOptions
- type CommitStatusSummary
- type ErrBranchAlreadyExists
- type ErrBranchNameConflict
- type ErrBranchNotExist
- type ErrBranchesEqual
- type ErrLFSFileLocked
- type ErrLFSLockAlreadyExist
- type ErrLFSLockNotExist
- type FindBranchOptions
- type FindRecentlyPushedNewBranchesOptions
- type IterateLFSMetaObjectsForRepoOptions
- type LFSLock
- func CreateLFSLock(ctx context.Context, repo *repo_model.Repository, lock *LFSLock) (*LFSLock, error)
- func DeleteLFSLockByID(ctx context.Context, id int64, repo *repo_model.Repository, u *user_model.User, ...) (*LFSLock, error)
- func GetLFSLock(ctx context.Context, repo *repo_model.Repository, path string) (*LFSLock, error)
- func GetLFSLockByID(ctx context.Context, id int64) (*LFSLock, error)
- func GetTreePathLock(ctx context.Context, repoID int64, treePath string) (*LFSLock, error)
- type LFSLockList
- type LFSMetaObject
- type LFSTokenResponse
- type NewCommitStatusOptions
- type ProtectedBranch
- func GetFirstMatchProtectedBranchRule(ctx context.Context, repoID int64, branchName string) (*ProtectedBranch, error)
- func GetProtectedBranchRuleByID(ctx context.Context, repoID, ruleID int64) (*ProtectedBranch, error)
- func GetProtectedBranchRuleByName(ctx context.Context, repoID int64, ruleName string) (*ProtectedBranch, error)
- func (protectBranch *ProtectedBranch) CanUserForcePush(ctx context.Context, user *user_model.User) bool
- func (protectBranch *ProtectedBranch) CanUserPush(ctx context.Context, user *user_model.User) bool
- func (protectBranch *ProtectedBranch) GetProtectedFilePatterns() []glob.Glob
- func (protectBranch *ProtectedBranch) GetUnprotectedFilePatterns() []glob.Glob
- func (protectBranch *ProtectedBranch) IsProtectedFile(patterns []glob.Glob, path string) bool
- func (protectBranch *ProtectedBranch) IsUnprotectedFile(patterns []glob.Glob, path string) bool
- func (protectBranch *ProtectedBranch) LoadRepo(ctx context.Context) (err error)
- func (protectBranch *ProtectedBranch) Match(branchName string) bool
- func (protectBranch *ProtectedBranch) MergeBlockedByProtectedFiles(changedProtectedFiles []string) bool
- type ProtectedBranchRules
- type ProtectedTag
- type RecentlyPushedNewBranch
- type RenamedBranch
- type RepoSHA
- type SignCommitWithStatuses
- type WhitelistOptions
Constants ¶
This section is empty.
Variables ¶
var ErrBranchIsProtected = util.ErrorWrap(util.ErrPermissionDenied, "branch is protected")
var ErrLFSObjectNotExist = db.ErrNotExist{Resource: "LFS Meta object"}
ErrLFSObjectNotExist is returned from lfs models functions in order to differentiate between database and missing object errors.
Functions ¶
func AddDeletedBranch ¶
func AddDeletedBranch(ctx context.Context, repoID int64, branchName string, deletedByID int64) error
AddDeletedBranch adds a deleted branch to the database
func CommitStatusesHideActionsURL ¶
func CommitStatusesHideActionsURL(ctx context.Context, statuses []*CommitStatus)
CommitStatusesHideActionsURL hide Gitea Actions urls
func CopyLFS ¶
func CopyLFS(ctx context.Context, newRepo, oldRepo *repo_model.Repository) error
CopyLFS copies LFS data from one repo to another
func CountLFSLockByRepoID ¶
CountLFSLockByRepoID returns a count of all LFSLocks associated with a repository.
func CountLFSMetaObjects ¶
CountLFSMetaObjects returns a count of all LFSMetaObjects associated with a repository
func CountLatestCommitStatus ¶
func DeleteBranches ¶
func DeleteProtectedBranch ¶
func DeleteProtectedBranch(ctx context.Context, repo *repo_model.Repository, id int64) (err error)
DeleteProtectedBranch removes ProtectedBranch relation between the user and repository.
func DeleteProtectedTag ¶
func DeleteProtectedTag(ctx context.Context, pt *ProtectedTag) error
DeleteProtectedTag deletes a protected tag by ID
func ExistsLFSObject ¶
ExistsLFSObject checks if a provided Oid exists within the DB
func FindAllMatchedBranches ¶
FindAllMatchedBranches find all matched branches
func FindBranchNames ¶
func FindBranchNames(ctx context.Context, opts FindBranchOptions) ([]string, error)
func FindBranchesByRepoAndBranchName ¶
func FindRepoRecentCommitStatusContexts ¶
func FindRepoRecentCommitStatusContexts(ctx context.Context, repoID int64, before time.Duration) ([]string, error)
FindRepoRecentCommitStatusContexts returns repository's recent commit status contexts
func GetLatestCommitStatusForPairs ¶
func GetLatestCommitStatusForPairs(ctx context.Context, repoSHAs []RepoSHA) (map[int64][]*CommitStatus, error)
GetLatestCommitStatusForPairs returns all statuses with a unique context for a given list of repo-sha pairs
func GetLatestCommitStatusForRepoCommitIDs ¶
func GetLatestCommitStatusForRepoCommitIDs(ctx context.Context, repoID int64, commitIDs []string) (map[string][]*CommitStatus, error)
GetLatestCommitStatusForRepoCommitIDs returns all statuses with a unique context for a given list of repo-sha pairs
func GetNextCommitStatusIndex ¶
GetNextCommitStatusIndex retried 3 times to generate a resource index
func GetRepoLFSSize ¶
GetRepoLFSSize return a repository's lfs files size
func InsertProtectedTag ¶
func InsertProtectedTag(ctx context.Context, pt *ProtectedTag) error
InsertProtectedTag inserts a protected tag to database
func IsBranchExist ¶
IsBranchExist returns true if the branch exists in the repository.
func IsBranchProtected ¶
IsBranchProtected checks if branch is protected
func IsErrBranchAlreadyExists ¶
IsErrBranchAlreadyExists checks if an error is an ErrBranchAlreadyExists.
func IsErrBranchNameConflict ¶
IsErrBranchNameConflict checks if an error is an ErrBranchNameConflict.
func IsErrBranchNotExist ¶
IsErrBranchNotExist checks if an error is an ErrBranchDoesNotExist.
func IsErrBranchesEqual ¶
IsErrBranchesEqual checks if an error is an ErrBranchesEqual.
func IsErrLFSLockAlreadyExist ¶
IsErrLFSLockAlreadyExist checks if an error is a ErrLFSLockAlreadyExist.
func IsErrLFSLockNotExist ¶
IsErrLFSLockNotExist checks if an error is a ErrLFSLockNotExist.
func IsRuleNameSpecial ¶
IsRuleNameSpecial return true if it contains special character
func IsUserAllowedModifyTag ¶
IsUserAllowedModifyTag returns true if the user is allowed to modify the tag
func IsUserAllowedToControlTag ¶
func IsUserAllowedToControlTag(ctx context.Context, tags []*ProtectedTag, tagName string, userID int64) (bool, error)
IsUserAllowedToControlTag checks if a user can control the specific tag. It returns true if the tag name is not protected or the user is allowed to control it.
func IsUserMergeWhitelisted ¶
func IsUserMergeWhitelisted(ctx context.Context, protectBranch *ProtectedBranch, userID int64, permissionInRepo access_model.Permission) bool
IsUserMergeWhitelisted checks if some user is whitelisted to merge to this branch
func IsUserOfficialReviewer ¶
func IsUserOfficialReviewer(ctx context.Context, protectBranch *ProtectedBranch, user *user_model.User) (bool, error)
IsUserOfficialReviewer check if user is official reviewer for the branch (counts towards required approvals)
func IterateLFSMetaObjectsForRepo ¶
func IterateLFSMetaObjectsForRepo(ctx context.Context, repoID int64, f func(context.Context, *LFSMetaObject, int64) error, opts *IterateLFSMetaObjectsForRepoOptions) error
IterateLFSMetaObjectsForRepo provides a iterator for LFSMetaObjects per Repo
func IterateRepositoryIDsWithLFSMetaObjects ¶
func IterateRepositoryIDsWithLFSMetaObjects(ctx context.Context, f func(ctx context.Context, repoID, count int64) error) error
IterateRepositoryIDsWithLFSMetaObjects iterates across the repositories that have LFSMetaObjects
func LFSAutoAssociate ¶
func LFSAutoAssociate(ctx context.Context, metas []*LFSMetaObject, user *user_model.User, repoID int64) error
LFSAutoAssociate auto associates accessible LFSMetaObjects
func LFSObjectAccessible ¶
LFSObjectAccessible checks if a provided Oid is accessible to the user
func MarkLFSMetaObject ¶
MarkLFSMetaObject updates the updated time for the provided LFSMetaObject
func NewCommitStatus ¶
func NewCommitStatus(ctx context.Context, opts NewCommitStatusOptions) error
NewCommitStatus save commit statuses into database
func RemoveDeletedBranchByID ¶
func RemoveLFSMetaObjectByOid ¶
RemoveLFSMetaObjectByOid removes a LFSMetaObject entry from database by its OID. It may return ErrLFSObjectNotExist or a database error.
func RemoveLFSMetaObjectByOidFn ¶
func RemoveLFSMetaObjectByOidFn(ctx context.Context, repoID int64, oid string, fn func(count int64) error) (int64, error)
RemoveLFSMetaObjectByOidFn removes a LFSMetaObject entry from database by its OID. It may return ErrLFSObjectNotExist or a database error. It will run Fn with the current count within the transaction
func RemoveOldDeletedBranches ¶
RemoveOldDeletedBranches removes old deleted branches