Documentation ¶
Index ¶
- Variables
- func AddAllRepoBranchesToSyncQueue(ctx context.Context, doerID int64) error
- func AdoptRepository(ctx context.Context, doer, u *user_model.User, opts CreateRepoOptions) (*repo_model.Repository, error)
- func CacheRef(ctx context.Context, repo *repo_model.Repository, gitRepo *git.Repository, ...) error
- func ChangeRepositoryName(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, ...) error
- func ConvertForkToNormalRepository(ctx context.Context, repo *repo_model.Repository) error
- func CreateNewBranch(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, ...) (err error)
- func CreateNewBranchFromCommit(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, ...) (err error)
- func CreateRepository(ctx context.Context, doer, owner *user_model.User, opts CreateRepoOptions) (*repo_model.Repository, error)
- func CreateRepositoryDirectly(ctx context.Context, doer, u *user_model.User, opts CreateRepoOptions) (*repo_model.Repository, error)
- func DeleteAvatar(ctx context.Context, repo *repo_model.Repository) error
- func DeleteBranch(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, ...) error
- func DeleteCollaboration(ctx context.Context, repo *repo_model.Repository, uid int64) (err error)
- func DeleteMissingRepositories(ctx context.Context, doer *user_model.User) error
- func DeleteOwnerRepositoriesDirectly(ctx context.Context, owner *user_model.User) error
- func DeleteRepository(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, ...) error
- func DeleteRepositoryDirectly(ctx context.Context, doer *user_model.User, uid, repoID int64, ...) error
- func DeleteUnadoptedRepository(ctx context.Context, doer, u *user_model.User, repoName string) error
- func ForkRepository(ctx context.Context, doer, owner *user_model.User, opts ForkRepoOptions) (*repo_model.Repository, error)
- func GarbageCollectLFSMetaObjects(ctx context.Context, opts GarbageCollectLFSMetaObjectsOptions) error
- func GarbageCollectLFSMetaObjectsForRepo(ctx context.Context, repo *repo_model.Repository, ...) error
- func GenerateGitHooks(ctx context.Context, templateRepo, generateRepo *repo_model.Repository) error
- func GenerateIssueLabels(ctx context.Context, templateRepo, generateRepo *repo_model.Repository) error
- func GenerateProtectedBranch(ctx context.Context, templateRepo, generateRepo *repo_model.Repository) error
- func GenerateRepository(ctx context.Context, doer, owner *user_model.User, ...) (_ *repo_model.Repository, err error)
- func GenerateWebhooks(ctx context.Context, templateRepo, generateRepo *repo_model.Repository) error
- func GetBranchCommitID(ctx context.Context, repo *repo_model.Repository, branch string) (string, error)
- func GetReviewerTeams(ctx context.Context, repo *repo_model.Repository) ([]*organization.Team, error)
- func GitFsckRepo(ctx context.Context, repo *repo_model.Repository, timeout time.Duration, ...) error
- func GitFsckRepos(ctx context.Context, timeout time.Duration, args git.TrustedCmdArgs) error
- func GitGcRepo(ctx context.Context, repo *repo_model.Repository, timeout time.Duration, ...) error
- func GitGcRepos(ctx context.Context, timeout time.Duration, args git.TrustedCmdArgs) error
- func HasRepository(ctx context.Context, t *organization.Team, repoID int64) bool
- func Init(ctx context.Context) error
- func IsErrForkAlreadyExist(err error) bool
- func LinkedRepository(ctx context.Context, a *repo_model.Attachment) (*repo_model.Repository, unit.Type, error)
- func ListUnadoptedRepositories(ctx context.Context, query string, opts *db.ListOptions) ([]string, int, error)
- func LoadBranches(ctx context.Context, repo *repo_model.Repository, gitRepo *git.Repository, ...) (*Branch, []*Branch, int64, error)
- func PushCreateRepo(ctx context.Context, authUser, owner *user_model.User, repoName string) (*repo_model.Repository, error)
- func PushUpdate(opts *repo_module.PushUpdateOptions) error
- func PushUpdateAddDeleteTags(ctx context.Context, repo *repo_model.Repository, gitRepo *git.Repository, ...) error
- func PushUpdates(opts []*repo_module.PushUpdateOptions) error
- func ReinitMissingRepositories(ctx context.Context) error
- func RemoveRandomAvatars(ctx context.Context) error
- func RemoveRepositoryFromTeam(ctx context.Context, t *organization.Team, repoID int64) error
- func RenameBranch(ctx context.Context, repo *repo_model.Repository, doer *user_model.User, ...) (string, error)
- func SetRepoDefaultBranch(ctx context.Context, repo *repo_model.Repository, gitRepo *git.Repository, ...) error
- func StartRepositoryTransfer(ctx context.Context, doer, newOwner *user_model.User, ...) error
- func SyncRepositoryHooks(ctx context.Context) error
- func TransferOwnership(ctx context.Context, doer, newOwner *user_model.User, ...) error
- func UpdateRepository(ctx context.Context, repo *repo_model.Repository, visibilityChanged bool) (err error)
- func UpdateRepositoryUnits(ctx context.Context, repo *repo_model.Repository, units []repo_model.RepoUnit, ...) (err error)
- func UploadAvatar(ctx context.Context, repo *repo_model.Repository, data []byte) error
- type Branch
- type BranchSyncOptions
- type ContainedLinks
- type CreateRepoOptions
- type ErrForkAlreadyExist
- type ForkRepoOptions
- type GarbageCollectLFSMetaObjectsOptions
- type WebSearchRepository
- type WebSearchResults
Constants ¶
This section is empty.
Variables ¶
var (
ErrBranchIsDefault = errors.New("branch is default")
)
enmuerates all branch related errors
Functions ¶
func AddAllRepoBranchesToSyncQueue ¶ added in v1.21.0
func AdoptRepository ¶ added in v1.13.0
func AdoptRepository(ctx context.Context, doer, u *user_model.User, opts CreateRepoOptions) (*repo_model.Repository, error)
AdoptRepository adopts pre-existing repository files for the user/organization.
func CacheRef ¶ added in v1.16.0
func CacheRef(ctx context.Context, repo *repo_model.Repository, gitRepo *git.Repository, fullRefName git.RefName) error
CacheRef cachhe last commit information of the branch or the tag
func ChangeRepositoryName ¶
func ChangeRepositoryName(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, newRepoName string) error
ChangeRepositoryName changes all corresponding setting from old repository name to new one.
func ConvertForkToNormalRepository ¶ added in v1.16.0
func ConvertForkToNormalRepository(ctx context.Context, repo *repo_model.Repository) error
ConvertForkToNormalRepository convert the provided repo from a forked repo to normal repo
func CreateNewBranch ¶ added in v1.16.0
func CreateNewBranch(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, gitRepo *git.Repository, oldBranchName, branchName string) (err error)
CreateNewBranch creates a new repository branch
func CreateNewBranchFromCommit ¶ added in v1.16.0
func CreateNewBranchFromCommit(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, gitRepo *git.Repository, commitID, branchName string) (err error)
CreateNewBranchFromCommit creates a new repository branch
func CreateRepository ¶
func CreateRepository(ctx context.Context, doer, owner *user_model.User, opts CreateRepoOptions) (*repo_model.Repository, error)
CreateRepository creates a repository for the user/organization.
func CreateRepositoryDirectly ¶ added in v1.21.0
func CreateRepositoryDirectly(ctx context.Context, doer, u *user_model.User, opts CreateRepoOptions) (*repo_model.Repository, error)
CreateRepositoryDirectly creates a repository for the user/organization.
func DeleteAvatar ¶ added in v1.16.0
func DeleteAvatar(ctx context.Context, repo *repo_model.Repository) error
DeleteAvatar deletes the repos's custom avatar.
func DeleteBranch ¶ added in v1.14.3
func DeleteBranch(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, gitRepo *git.Repository, branchName string) error
DeleteBranch delete branch
func DeleteCollaboration ¶ added in v1.21.0
func DeleteCollaboration(ctx context.Context, repo *repo_model.Repository, uid int64) (err error)
DeleteCollaboration removes collaboration relation between the user and repository.
func DeleteMissingRepositories ¶ added in v1.16.0
func DeleteMissingRepositories(ctx context.Context, doer *user_model.User) error
DeleteMissingRepositories deletes all repository records that lost Git files.
func DeleteOwnerRepositoriesDirectly ¶ added in v1.21.0
func DeleteOwnerRepositoriesDirectly(ctx context.Context, owner *user_model.User) error
DeleteOwnerRepositoriesDirectly calls DeleteRepositoryDirectly for all repos of the given owner
func DeleteRepository ¶
func DeleteRepository(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, notify bool) error
DeleteRepository deletes a repository for a user or organization.
func DeleteRepositoryDirectly ¶ added in v1.21.0
func DeleteRepositoryDirectly(ctx context.Context, doer *user_model.User, uid, repoID int64, ignoreOrgTeams ...bool) error
DeleteRepository deletes a repository for a user or organization. make sure if you call this func to close open sessions (sqlite will otherwise get a deadlock)
func DeleteUnadoptedRepository ¶ added in v1.13.0
func DeleteUnadoptedRepository(ctx context.Context, doer, u *user_model.User, repoName string) error
DeleteUnadoptedRepository deletes unadopted repository files from the filesystem
func ForkRepository ¶
func ForkRepository(ctx context.Context, doer, owner *user_model.User, opts ForkRepoOptions) (*repo_model.Repository, error)
ForkRepository forks a repository
func GarbageCollectLFSMetaObjects ¶ added in v1.17.4
func GarbageCollectLFSMetaObjects(ctx context.Context, opts GarbageCollectLFSMetaObjectsOptions) error
GarbageCollectLFSMetaObjects garbage collects LFS objects for all repositories
func GarbageCollectLFSMetaObjectsForRepo ¶ added in v1.17.4
func GarbageCollectLFSMetaObjectsForRepo(ctx context.Context, repo *repo_model.Repository, opts GarbageCollectLFSMetaObjectsOptions) error
GarbageCollectLFSMetaObjectsForRepo garbage collects LFS objects for a specific repository
func GenerateGitHooks ¶ added in v1.16.0
func GenerateGitHooks(ctx context.Context, templateRepo, generateRepo *repo_model.Repository) error
GenerateGitHooks generates git hooks from a template repository
func GenerateIssueLabels ¶ added in v1.17.0
func GenerateIssueLabels(ctx context.Context, templateRepo, generateRepo *repo_model.Repository) error
GenerateIssueLabels generates issue labels from a template repository
func GenerateProtectedBranch ¶ added in v1.21.0
func GenerateProtectedBranch(ctx context.Context, templateRepo, generateRepo *repo_model.Repository) error
func GenerateRepository ¶
func GenerateRepository(ctx context.Context, doer, owner *user_model.User, templateRepo *repo_model.Repository, opts repo_module.GenerateRepoOptions) (_ *repo_model.Repository, err error)
GenerateRepository generates a repository from a template
func GenerateWebhooks ¶ added in v1.17.0
func GenerateWebhooks(ctx context.Context, templateRepo, generateRepo *repo_model.Repository) error
GenerateWebhooks generates webhooks from a template repository
func GetBranchCommitID ¶ added in v1.20.0
func GetBranchCommitID(ctx context.Context, repo *repo_model.Repository, branch string) (string, error)
func GetReviewerTeams ¶ added in v1.17.0
func GetReviewerTeams(ctx context.Context, repo *repo_model.Repository) ([]*organization.Team, error)
GetReviewerTeams get all teams can be requested to review
func GitFsckRepo ¶ added in v1.17.4
func GitFsckRepo(ctx context.Context, repo *repo_model.Repository, timeout time.Duration, args git.TrustedCmdArgs) error
GitFsckRepo calls 'git fsck' to check an individual repository's health.
func GitFsckRepos ¶ added in v1.17.4
GitFsckRepos calls 'git fsck' to check repository health.
func GitGcRepo ¶ added in v1.17.4
func GitGcRepo(ctx context.Context, repo *repo_model.Repository, timeout time.Duration, args git.TrustedCmdArgs) error
GitGcRepo calls 'git gc' to remove unnecessary files and optimize the local repository
func GitGcRepos ¶ added in v1.16.0
GitGcRepos calls 'git gc' to remove unnecessary files and optimize the local repository
func HasRepository ¶ added in v1.21.0
HasRepository returns true if given repository belong to team.
func IsErrForkAlreadyExist ¶ added in v1.17.4
IsErrForkAlreadyExist checks if an error is an ErrForkAlreadyExist.
func LinkedRepository ¶ added in v1.17.0
func LinkedRepository(ctx context.Context, a *repo_model.Attachment) (*repo_model.Repository, unit.Type, error)
LinkedRepository returns the linked repo if any
func ListUnadoptedRepositories ¶ added in v1.16.0
func ListUnadoptedRepositories(ctx context.Context, query string, opts *db.ListOptions) ([]string, int, error)
ListUnadoptedRepositories lists all the unadopted repositories that match the provided query
func LoadBranches ¶ added in v1.21.0
func LoadBranches(ctx context.Context, repo *repo_model.Repository, gitRepo *git.Repository, isDeletedBranch util.OptionalBool, keyword string, page, pageSize int) (*Branch, []*Branch, int64, error)
LoadBranches loads branches from the repository limited by page & pageSize.
func PushCreateRepo ¶
func PushCreateRepo(ctx context.Context, authUser, owner *user_model.User, repoName string) (*repo_model.Repository, error)
PushCreateRepo creates a repository when a new repository is pushed to an appropriate namespace
func PushUpdate ¶ added in v1.13.0
func PushUpdate(opts *repo_module.PushUpdateOptions) error
PushUpdate is an alias of PushUpdates for single push update options
func PushUpdateAddDeleteTags ¶ added in v1.16.0
func PushUpdateAddDeleteTags(ctx context.Context, repo *repo_model.Repository, gitRepo *git.Repository, addTags, delTags []string) error
PushUpdateAddDeleteTags updates a number of added and delete tags
func PushUpdates ¶ added in v1.13.0
func PushUpdates(opts []*repo_module.PushUpdateOptions) error
PushUpdates adds a push update to push queue
func ReinitMissingRepositories ¶ added in v1.16.0
ReinitMissingRepositories reinitializes all repository records that lost Git files.
func RemoveRandomAvatars ¶ added in v1.16.0
RemoveRandomAvatars removes the randomly generated avatars that were created for repositories
func RemoveRepositoryFromTeam ¶ added in v1.21.0
RemoveRepositoryFromTeam removes repository from team of organization. If the team shall include all repositories the request is ignored.
func RenameBranch ¶ added in v1.16.0
func RenameBranch(ctx context.Context, repo *repo_model.Repository, doer *user_model.User, gitRepo *git.Repository, from, to string) (string, error)
RenameBranch rename a branch
func SetRepoDefaultBranch ¶ added in v1.21.4
func SetRepoDefaultBranch(ctx context.Context, repo *repo_model.Repository, gitRepo *git.Repository, newBranchName string) error
func StartRepositoryTransfer ¶ added in v1.13.3
func StartRepositoryTransfer(ctx context.Context, doer, newOwner *user_model.User, repo *repo_model.Repository, teams []*organization.Team) error
StartRepositoryTransfer transfer a repo from one owner to a new one. it make repository into pending transfer state, if doer can not create repo for new owner.
func SyncRepositoryHooks ¶ added in v1.16.0
SyncRepositoryHooks rewrites all repositories' pre-receive, update and post-receive hooks to make sure the binary and custom conf path are up-to-date.
func TransferOwnership ¶
func TransferOwnership(ctx context.Context, doer, newOwner *user_model.User, repo *repo_model.Repository, teams []*organization.Team) error
TransferOwnership transfers all corresponding setting from old user to new one.
func UpdateRepository ¶ added in v1.17.0
func UpdateRepository(ctx context.Context, repo *repo_model.Repository, visibilityChanged bool) (err error)
UpdateRepository updates a repository
func UpdateRepositoryUnits ¶ added in v1.21.4
func UpdateRepositoryUnits(ctx context.Context, repo *repo_model.Repository, units []repo_model.RepoUnit, deleteUnitTypes []unit.Type) (err error)
UpdateRepositoryUnits updates a repository's units
func UploadAvatar ¶ added in v1.16.0
func UploadAvatar(ctx context.Context, repo *repo_model.Repository, data []byte) error
UploadAvatar saves custom avatar for repository. FIXME: split uploads to different subdirs in case we have massive number of repos.
Types ¶
type Branch ¶ added in v1.21.0
type Branch struct { DBBranch *git_model.Branch IsProtected bool IsIncluded bool CommitsAhead int CommitsBehind int LatestPullRequest *issues_model.PullRequest MergeMovedOn bool }
Branch contains the branch information
type BranchSyncOptions ¶ added in v1.21.0
type BranchSyncOptions struct {
RepoID int64
}
type ContainedLinks ¶ added in v1.21.0
type ContainedLinks struct { Branches []*namedLink `json:"branches"` Tags []*namedLink `json:"tags"` DefaultBranch string `json:"default_branch"` }
func LoadBranchesAndTags ¶ added in v1.21.0
func LoadBranchesAndTags(ctx context.Context, baseRepo *gitea_ctx.Repository, commitSHA string) (*ContainedLinks, error)
LoadBranchesAndTags creates a new repository branch
type CreateRepoOptions ¶ added in v1.21.0
type CreateRepoOptions struct { Name string Description string OriginalURL string GitServiceType api.GitServiceType Gitignores string IssueLabels string License string Readme string DefaultBranch string IsPrivate bool IsMirror bool IsTemplate bool AutoInit bool Status repo_model.RepositoryStatus TrustModel repo_model.TrustModelType MirrorInterval string }
CreateRepoOptions contains the create repository options
type ErrForkAlreadyExist ¶ added in v1.17.4
ErrForkAlreadyExist represents a "ForkAlreadyExist" kind of error.
func (ErrForkAlreadyExist) Error ¶ added in v1.17.4
func (err ErrForkAlreadyExist) Error() string
func (ErrForkAlreadyExist) Unwrap ¶ added in v1.17.4
func (err ErrForkAlreadyExist) Unwrap() error
type ForkRepoOptions ¶ added in v1.16.0
type ForkRepoOptions struct { BaseRepo *repo_model.Repository Name string Description string }
ForkRepoOptions contains the fork repository options
type GarbageCollectLFSMetaObjectsOptions ¶ added in v1.19.0
type GarbageCollectLFSMetaObjectsOptions struct { LogDetail func(format string, v ...any) AutoFix bool OlderThan time.Time UpdatedLessRecentlyThan time.Time NumberToCheckPerRepo int64 ProportionToCheckPerRepo float64 }
GarbageCollectLFSMetaObjectsOptions provides options for GarbageCollectLFSMetaObjects function
type WebSearchRepository ¶ added in v1.20.0
type WebSearchRepository struct { Repository *structs.Repository `json:"repository"` LatestCommitStatus *git.CommitStatus `json:"latest_commit_status"` LocaleLatestCommitStatus string `json:"locale_latest_commit_status"` }
WebSearchRepository represents a repository returned by web search
type WebSearchResults ¶ added in v1.20.0
type WebSearchResults struct { OK bool `json:"ok"` Data []*WebSearchRepository `json:"data"` }
WebSearchResults results of a successful web search