{"modulePath":"github.com/RedAFD/code-core","version":"v1.14.0-rc8","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package repository\n\n## Functions\n\n```go\nfunc AdoptRepository(doer, u *models.User, opts models.CreateRepoOptions) (*models.Repository, error)\n```\nAdoptRepository adopts a repository for the user/organization.\n\n```go\nfunc CacheRef(repo *models.Repository, gitRepo *git.Repository, fullRefName string) error\n```\nCacheRef cachhe last commit information of the branch or the tag\n\n```go\nfunc CheckDelegateHooks(repoPath string) ([]string, error)\n```\nCheckDelegateHooks checks the hooks scripts for the repo\n\n```go\nfunc CleanUpMigrateInfo(repo *models.Repository) (*models.Repository, error)\n```\nCleanUpMigrateInfo finishes migrating repository and/or wiki with things that don't need to be done for mirrors.\n\n```go\nfunc CreateDelegateHooks(repoPath string) error\n```\nCreateDelegateHooks creates all the hooks scripts for the repo\n\n```go\nfunc CreateNewBranch(doer *models.User, repo *models.Repository, oldBranchName, branchName string) (err error)\n```\nCreateNewBranch creates a new repository branch\n\n```go\nfunc CreateNewBranchFromCommit(doer *models.User, repo *models.Repository, commit, branchName string) (err error)\n```\nCreateNewBranchFromCommit creates a new repository branch\n\n```go\nfunc CreateRepository(doer, u *models.User, opts models.CreateRepoOptions) (*models.Repository, error)\n```\nCreateRepository creates a repository for the user/organization.\n\n```go\nfunc DeleteMissingRepositories(ctx context.Context, doer *models.User) error\n```\nDeleteMissingRepositories deletes all repository records that lost Git files.\n\n```go\nfunc DeleteUnadoptedRepository(doer, u *models.User, repoName string) error\n```\nDeleteUnadoptedRepository deletes unadopted repository files from the filesystem\n\n```go\nfunc ForkRepository(doer, owner *models.User, oldRepo *models.Repository, name, desc string) (_ *models.Repository, err error)\n```\nForkRepository forks a repository\n\n```go\nfunc GenerateGitContent(ctx models.DBContext, templateRepo, generateRepo *models.Repository) error\n```\nGenerateGitContent generates git content from a template repository\n\n```go\nfunc GenerateRepository(ctx models.DBContext, doer, owner *models.User, templateRepo *models.Repository, opts models.GenerateRepoOptions) (_ *models.Repository, err error)\n```\nGenerateRepository generates a repository from a template\n\n```go\nfunc GetBranch(repo *models.Repository, branch string) (*git.Branch, error)\n```\nGetBranch returns a branch by its name\n\n```go\nfunc GetBranches(repo *models.Repository, skip, limit int) ([]*git.Branch, int, error)\n```\nGetBranches returns branches from the repository, skipping skip initial branches and returning at most limit branches, or all branches if limit is 0.\n\n```go\nfunc GitFsck(ctx context.Context, timeout time.Duration, args []string) error\n```\nGitFsck calls 'git fsck' to check repository health.\n\n```go\nfunc GitGcRepos(ctx context.Context, timeout time.Duration, args ...string) error\n```\nGitGcRepos calls 'git gc' to remove unnecessary files and optimize the local repository\n\n```go\nfunc IsForcePush(opts *PushUpdateOptions) (bool, error)\n```\nIsForcePush detect if a push is a force push\n\n```go\nfunc ListUnadoptedRepositories(query string, opts *models.ListOptions) ([]string, int, error)\n```\nListUnadoptedRepositories lists all the unadopted repositories that match the provided query\n\n```go\nfunc MigrateRepositoryGitData(ctx context.Context, u *models.User, repo *models.Repository, opts migration.MigrateOptions) (*models.Repository, error)\n```\nMigrateRepositoryGitData starts migrating git related data after created migrating repository\n\n```go\nfunc PushUpdateAddDeleteTags(repo *models.Repository, gitRepo *git.Repository, addTags, delTags []string) error\n```\nPushUpdateAddDeleteTags updates a number of added and delete tags\n\n```go\nfunc PushUpdateAddTag(repo *models.Repository, gitRepo *git.Repository, tagName string) error\n```\nPushUpdateAddTag must be called for any push actions to add tag\n\n```go\nfunc ReinitMissingRepositories(ctx context.Context) error\n```\nReinitMissingRepositories reinitializes all repository records that lost Git files.\n\n```go\nfunc SyncReleasesWithTags(repo *models.Repository, gitRepo *git.Repository) error\n```\nSyncReleasesWithTags synchronizes release table with repository tags\n\n```go\nfunc SyncRepositoryHooks(ctx context.Context) error\n```\nSyncRepositoryHooks rewrites all repositories' pre-receive, update and post-receive hooks to make sure the binary and custom conf path are up-to-date.\n\n```go\nfunc WikiRemoteURL(remote string) string\n```\nWikiRemoteURL returns accessible repository URL for wiki if exists. Otherwise, it returns an empty string.\n\n## Types\n\n```go\ntype PushCommit struct {\n\tSha1           string\n\tMessage        string\n\tAuthorEmail    string\n\tAuthorName     string\n\tCommitterEmail string\n\tCommitterName  string\n\tTimestamp      time.Time\n}\n```\nPushCommit represents a commit in a push operation.\n\n```go\nfunc CommitToPushCommit(commit *git.Commit) *PushCommit\n```\nCommitToPushCommit transforms a git.Commit to PushCommit type.\n\n```go\ntype PushCommits struct {\n\tLen        int\n\tCommits    []*PushCommit\n\tCompareURL string\n\t// contains filtered or unexported fields\n}\n```\nPushCommits represents list of commits in a push operation.\n\n```go\nfunc ListToPushCommits(l *list.List) *PushCommits\n```\nListToPushCommits transforms a list.List to PushCommits type.\n\n```go\nfunc NewPushCommits() *PushCommits\n```\nNewPushCommits creates a new PushCommits object.\n\n```go\nfunc (pc *PushCommits) AvatarLink(email string) string\n```\nAvatarLink tries to match user in database with e-mail in order to show custom avatar, and falls back to general avatar link.\n\n```go\nfunc (pc *PushCommits) ToAPIPayloadCommits(repoPath, repoLink string) ([]*api.PayloadCommit, error)\n```\nToAPIPayloadCommits converts a PushCommits object to api.PayloadCommit format.\n\n```go\ntype PushUpdateOptions struct {\n\tPusherID     int64\n\tPusherName   string\n\tRepoUserName string\n\tRepoName     string\n\tRefFullName  string // branch, tag or other name to push\n\tOldCommitID  string\n\tNewCommitID  string\n}\n```\nPushUpdateOptions defines the push update options\n\n```go\nfunc (opts PushUpdateOptions) BranchName() string\n```\nBranchName returns simple branch name if it's an operation to branch\n\n```go\nfunc (opts PushUpdateOptions) IsBranch() bool\n```\nIsBranch return true if it's a push to branch\n\n```go\nfunc (opts PushUpdateOptions) IsDelBranch() bool\n```\nIsDelBranch return true if it's a deletion to a branch\n\n```go\nfunc (opts PushUpdateOptions) IsDelRef() bool\n```\nIsDelRef return true if it's a deletion to a branch or tag\n\n```go\nfunc (opts PushUpdateOptions) IsDelTag() bool\n```\nIsDelTag return true if it's a deletion to a tag\n\n```go\nfunc (opts PushUpdateOptions) IsNewBranch() bool\n```\nIsNewBranch return true if it's the first-time push to a branch\n\n```go\nfunc (opts PushUpdateOptions) IsNewRef() bool\n```\nIsNewRef return true if it's a first-time push to a branch, tag or etc.\n\n```go\nfunc (opts PushUpdateOptions) IsNewTag() bool\n```\nIsNewTag return true if it's a creation to a tag\n\n```go\nfunc (opts PushUpdateOptions) IsTag() bool\n```\nIsTag return true if it's an operation to a tag\n\n```go\nfunc (opts PushUpdateOptions) IsUpdateBranch() bool\n```\nIsUpdateBranch return true if it's not the first push to a branch\n\n```go\nfunc (opts PushUpdateOptions) IsUpdateRef() bool\n```\nIsUpdateRef return true if it's an update operation\n\n```go\nfunc (opts PushUpdateOptions) RefName() string\n```\nRefName returns simple name for ref\n\n```go\nfunc (opts PushUpdateOptions) RepoFullName() string\n```\nRepoFullName returns repo full name\n\n```go\nfunc (opts PushUpdateOptions) TagName() string\n```\nTagName returns simple tag name if it's an operation to a tag\n\n","path":"github.com/RedAFD/code-core/modules/repository","name":"repository","synopsis":"","isRedistributable":true}
