Documentation ¶
Index ¶
- Variables
- func AdoptRepository(doer, u *user_model.User, opts repo_module.CreateRepoOptions) (*repo_model.Repository, error)
- func CacheRef(ctx context.Context, repo *repo_model.Repository, gitRepo *git.Repository, ...) error
- func ChangeRepositoryName(doer *user_model.User, repo *repo_model.Repository, newRepoName string) error
- func ConvertForkToNormalRepository(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(doer, owner *user_model.User, opts repo_module.CreateRepoOptions) (*repo_model.Repository, error)
- func DeleteAvatar(repo *repo_model.Repository) error
- func DeleteBranch(doer *user_model.User, repo *repo_model.Repository, gitRepo *git.Repository, ...) error
- func DeleteMissingRepositories(ctx context.Context, doer *user_model.User) error
- func DeleteRepository(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, ...) error
- func DeleteUnadoptedRepository(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 GenerateGitHooks(ctx context.Context, templateRepo, generateRepo *repo_model.Repository) error
- func GenerateIssueLabels(ctx context.Context, templateRepo, generateRepo *repo_model.Repository) error
- func GenerateRepository(doer, owner *user_model.User, templateRepo *repo_model.Repository, ...) (_ *repo_model.Repository, err error)
- func GenerateWebhooks(ctx context.Context, templateRepo, generateRepo *repo_model.Repository) error
- func GetBranches(ctx context.Context, repo *repo_model.Repository, skip, limit int) ([]*git.Branch, int, error)
- func GetReviewerTeams(repo *repo_model.Repository) ([]*organization.Team, error)
- func GitFsck(ctx context.Context, timeout time.Duration, args []git.CmdArg) error
- func GitGcRepos(ctx context.Context, timeout time.Duration, args ...git.CmdArg) error
- func Init() error
- func IsErrForkAlreadyExist(err error) bool
- func LinkedRepository(a *repo_model.Attachment) (*repo_model.Repository, unit.Type, error)
- func ListUnadoptedRepositories(query string, opts *db.ListOptions) ([]string, int, error)
- func PushCreateRepo(authUser, owner *user_model.User, repoName string) (*repo_model.Repository, error)
- func PushUpdate(opts *repo_module.PushUpdateOptions) error
- func PushUpdateAddDeleteTags(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 RenameBranch(repo *repo_model.Repository, doer *user_model.User, gitRepo *git.Repository, ...) (string, error)
- func StartRepositoryTransfer(doer, newOwner *user_model.User, repo *repo_model.Repository, ...) error
- func SyncRepositoryHooks(ctx context.Context) error
- func TransferOwnership(doer, newOwner *user_model.User, repo *repo_model.Repository, ...) error
- func UpdateRepository(repo *repo_model.Repository, visibilityChanged bool) (err error)
- func UploadAvatar(repo *repo_model.Repository, data []byte) error
- type ErrForkAlreadyExist
- type ForkRepoOptions
Constants ¶
This section is empty.
Variables ¶
var ( ErrBranchIsDefault = errors.New("branch is default") ErrBranchIsProtected = errors.New("branch is protected") )
enmuerates all branch related errors
Functions ¶
func AdoptRepository ¶ added in v1.13.0
func AdoptRepository(doer, u *user_model.User, opts repo_module.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 string) error
CacheRef cachhe last commit information of the branch or the tag
func ChangeRepositoryName ¶
func ChangeRepositoryName(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(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, 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, commit, branchName string) (err error)
CreateNewBranchFromCommit creates a new repository branch
func CreateRepository ¶
func CreateRepository(doer, owner *user_model.User, opts repo_module.CreateRepoOptions) (*repo_model.Repository, error)
CreateRepository creates a repository for the user/organization.
func DeleteAvatar ¶ added in v1.16.0
func DeleteAvatar(repo *repo_model.Repository) error
DeleteAvatar deletes the repos's custom avatar.
func DeleteBranch ¶ added in v1.14.3
func DeleteBranch(doer *user_model.User, repo *repo_model.Repository, gitRepo *git.Repository, branchName string) error
DeleteBranch delete branch
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 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 DeleteUnadoptedRepository ¶ added in v1.13.0
func DeleteUnadoptedRepository(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 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 GenerateRepository ¶
func GenerateRepository(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 GetBranches ¶ added in v1.16.0
func GetBranches(ctx context.Context, repo *repo_model.Repository, skip, limit int) ([]*git.Branch, int, error)
GetBranches returns branches from the repository, skipping skip initial branches and returning at most limit branches, or all branches if limit is 0.
func GetReviewerTeams ¶ added in v1.17.0
func GetReviewerTeams(repo *repo_model.Repository) ([]*organization.Team, error)
GetReviewerTeams get all teams can be requested to review
func GitGcRepos ¶ added in v1.16.0
GitGcRepos calls 'git gc' to remove unnecessary files and optimize the local repository
func IsErrForkAlreadyExist ¶ added in v1.17.4
IsErrForkAlreadyExist checks if an error is an ErrForkAlreadyExist.
func LinkedRepository ¶ added in v1.17.0
func LinkedRepository(a *repo_model.Attachment) (*repo_model.Repository, unit.Type, error)
LinkedRepository returns the linked repo if any
func ListUnadoptedRepositories ¶ added in v1.16.0
ListUnadoptedRepositories lists all the unadopted repositories that match the provided query
func PushCreateRepo ¶
func PushCreateRepo(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(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 RenameBranch ¶ added in v1.16.0
func RenameBranch(repo *repo_model.Repository, doer *user_model.User, gitRepo *git.Repository, from, to string) (string, error)
RenameBranch rename a branch
func StartRepositoryTransfer ¶ added in v1.13.3
func StartRepositoryTransfer(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(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(repo *repo_model.Repository, visibilityChanged bool) (err error)
UpdateRepository updates a repository
func UploadAvatar ¶ added in v1.16.0
func UploadAvatar(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 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