Documentation ¶
Index ¶
- func AdoptRepository(doer, u *models.User, opts models.CreateRepoOptions) (*models.Repository, error)
- func CacheRef(repo *models.Repository, gitRepo *git.Repository, fullRefName string) error
- func CheckDelegateHooks(repoPath string) ([]string, error)
- func CleanUpMigrateInfo(repo *models.Repository) (*models.Repository, error)
- func CreateDelegateHooks(repoPath string) error
- func CreateNewBranch(doer *models.User, repo *models.Repository, oldBranchName, branchName string) (err error)
- func CreateNewBranchFromCommit(doer *models.User, repo *models.Repository, commit, branchName string) (err error)
- func CreateRepository(doer, u *models.User, opts models.CreateRepoOptions) (*models.Repository, error)
- func DeleteMissingRepositories(ctx context.Context, doer *models.User) error
- func DeleteUnadoptedRepository(doer, u *models.User, repoName string) error
- func ForkRepository(doer, owner *models.User, oldRepo *models.Repository, name, desc string) (_ *models.Repository, err error)
- func GenerateGitContent(ctx models.DBContext, templateRepo, generateRepo *models.Repository) error
- func GenerateRepository(ctx models.DBContext, doer, owner *models.User, ...) (_ *models.Repository, err error)
- func GetBranch(repo *models.Repository, branch string) (*git.Branch, error)
- func GetBranches(repo *models.Repository, skip, limit int) ([]*git.Branch, int, error)
- func GitFsck(ctx context.Context, timeout time.Duration, args []string) error
- func GitGcRepos(ctx context.Context, timeout time.Duration, args ...string) error
- func IsForcePush(opts *PushUpdateOptions) (bool, error)
- func ListUnadoptedRepositories(query string, opts *models.ListOptions) ([]string, int, error)
- func MigrateRepositoryGitData(ctx context.Context, u *models.User, repo *models.Repository, ...) (*models.Repository, error)
- func PushUpdateAddDeleteTags(repo *models.Repository, gitRepo *git.Repository, addTags, delTags []string) error
- func PushUpdateAddTag(repo *models.Repository, gitRepo *git.Repository, tagName string) error
- func ReinitMissingRepositories(ctx context.Context) error
- func SyncReleasesWithTags(repo *models.Repository, gitRepo *git.Repository) error
- func SyncRepositoryHooks(ctx context.Context) error
- func WikiRemoteURL(remote string) string
- type PushCommit
- type PushCommits
- type PushUpdateOptions
- func (opts PushUpdateOptions) BranchName() string
- func (opts PushUpdateOptions) IsBranch() bool
- func (opts PushUpdateOptions) IsDelBranch() bool
- func (opts PushUpdateOptions) IsDelRef() bool
- func (opts PushUpdateOptions) IsDelTag() bool
- func (opts PushUpdateOptions) IsNewBranch() bool
- func (opts PushUpdateOptions) IsNewRef() bool
- func (opts PushUpdateOptions) IsNewTag() bool
- func (opts PushUpdateOptions) IsTag() bool
- func (opts PushUpdateOptions) IsUpdateBranch() bool
- func (opts PushUpdateOptions) IsUpdateRef() bool
- func (opts PushUpdateOptions) RefName() string
- func (opts PushUpdateOptions) RepoFullName() string
- func (opts PushUpdateOptions) TagName() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdoptRepository ¶
func AdoptRepository(doer, u *models.User, opts models.CreateRepoOptions) (*models.Repository, error)
AdoptRepository adopts a repository for the user/organization.
func CacheRef ¶
func CacheRef(repo *models.Repository, gitRepo *git.Repository, fullRefName string) error
CacheRef cachhe last commit information of the branch or the tag
func CheckDelegateHooks ¶
CheckDelegateHooks checks the hooks scripts for the repo
func CleanUpMigrateInfo ¶
func CleanUpMigrateInfo(repo *models.Repository) (*models.Repository, error)
CleanUpMigrateInfo finishes migrating repository and/or wiki with things that don't need to be done for mirrors.
func CreateDelegateHooks ¶
CreateDelegateHooks creates all the hooks scripts for the repo
func CreateNewBranch ¶
func CreateNewBranch(doer *models.User, repo *models.Repository, oldBranchName, branchName string) (err error)
CreateNewBranch creates a new repository branch
func CreateNewBranchFromCommit ¶
func CreateNewBranchFromCommit(doer *models.User, repo *models.Repository, commit, branchName string) (err error)
CreateNewBranchFromCommit creates a new repository branch
func CreateRepository ¶
func CreateRepository(doer, u *models.User, opts models.CreateRepoOptions) (*models.Repository, error)
CreateRepository creates a repository for the user/organization.
func DeleteMissingRepositories ¶
DeleteMissingRepositories deletes all repository records that lost Git files.
func DeleteUnadoptedRepository ¶
DeleteUnadoptedRepository deletes unadopted repository files from the filesystem
func ForkRepository ¶
func ForkRepository(doer, owner *models.User, oldRepo *models.Repository, name, desc string) (_ *models.Repository, err error)
ForkRepository forks a repository
func GenerateGitContent ¶
func GenerateGitContent(ctx models.DBContext, templateRepo, generateRepo *models.Repository) error
GenerateGitContent generates git content from a template repository
func GenerateRepository ¶
func GenerateRepository(ctx models.DBContext, doer, owner *models.User, templateRepo *models.Repository, opts models.GenerateRepoOptions) (_ *models.Repository, err error)
GenerateRepository generates a repository from a template
func GetBranches ¶
GetBranches returns branches from the repository, skipping skip initial branches and returning at most limit branches, or all branches if limit is 0.
func GitGcRepos ¶
GitGcRepos calls 'git gc' to remove unnecessary files and optimize the local repository
func IsForcePush ¶
func IsForcePush(opts *PushUpdateOptions) (bool, error)
IsForcePush detect if a push is a force push
func ListUnadoptedRepositories ¶
ListUnadoptedRepositories lists all the unadopted repositories that match the provided query
func MigrateRepositoryGitData ¶
func MigrateRepositoryGitData(ctx context.Context, u *models.User, repo *models.Repository, opts migration.MigrateOptions) (*models.Repository, error)
MigrateRepositoryGitData starts migrating git related data after created migrating repository
func PushUpdateAddDeleteTags ¶
func PushUpdateAddDeleteTags(repo *models.Repository, gitRepo *git.Repository, addTags, delTags []string) error
PushUpdateAddDeleteTags updates a number of added and delete tags
func PushUpdateAddTag ¶
func PushUpdateAddTag(repo *models.Repository, gitRepo *git.Repository, tagName string) error
PushUpdateAddTag must be called for any push actions to add tag
func ReinitMissingRepositories ¶
ReinitMissingRepositories reinitializes all repository records that lost Git files.
func SyncReleasesWithTags ¶
func SyncReleasesWithTags(repo *models.Repository, gitRepo *git.Repository) error
SyncReleasesWithTags synchronizes release table with repository tags
func SyncRepositoryHooks ¶
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 WikiRemoteURL ¶
WikiRemoteURL returns accessible repository URL for wiki if exists. Otherwise, it returns an empty string.
Types ¶
type PushCommit ¶
type PushCommit struct { Sha1 string Message string AuthorEmail string AuthorName string CommitterEmail string CommitterName string Timestamp time.Time }
PushCommit represents a commit in a push operation.
func CommitToPushCommit ¶
func CommitToPushCommit(commit *git.Commit) *PushCommit
CommitToPushCommit transforms a git.Commit to PushCommit type.
type PushCommits ¶
type PushCommits struct { Len int Commits []*PushCommit CompareURL string // contains filtered or unexported fields }
PushCommits represents list of commits in a push operation.
func ListToPushCommits ¶
func ListToPushCommits(l *list.List) *PushCommits
ListToPushCommits transforms a list.List to PushCommits type.
func NewPushCommits ¶
func NewPushCommits() *PushCommits
NewPushCommits creates a new PushCommits object.
func (*PushCommits) AvatarLink ¶
func (pc *PushCommits) AvatarLink(email string) string
AvatarLink tries to match user in database with e-mail in order to show custom avatar, and falls back to general avatar link.
func (*PushCommits) ToAPIPayloadCommits ¶
func (pc *PushCommits) ToAPIPayloadCommits(repoPath, repoLink string) ([]*api.PayloadCommit, error)
ToAPIPayloadCommits converts a PushCommits object to api.PayloadCommit format.
type PushUpdateOptions ¶
type PushUpdateOptions struct { PusherID int64 PusherName string RepoUserName string RepoName string RefFullName string // branch, tag or other name to push OldCommitID string NewCommitID string }
PushUpdateOptions defines the push update options
func (PushUpdateOptions) BranchName ¶
func (opts PushUpdateOptions) BranchName() string
BranchName returns simple branch name if it's an operation to branch
func (PushUpdateOptions) IsBranch ¶
func (opts PushUpdateOptions) IsBranch() bool
IsBranch return true if it's a push to branch
func (PushUpdateOptions) IsDelBranch ¶
func (opts PushUpdateOptions) IsDelBranch() bool
IsDelBranch return true if it's a deletion to a branch
func (PushUpdateOptions) IsDelRef ¶
func (opts PushUpdateOptions) IsDelRef() bool
IsDelRef return true if it's a deletion to a branch or tag
func (PushUpdateOptions) IsDelTag ¶
func (opts PushUpdateOptions) IsDelTag() bool
IsDelTag return true if it's a deletion to a tag
func (PushUpdateOptions) IsNewBranch ¶
func (opts PushUpdateOptions) IsNewBranch() bool
IsNewBranch return true if it's the first-time push to a branch
func (PushUpdateOptions) IsNewRef ¶
func (opts PushUpdateOptions) IsNewRef() bool
IsNewRef return true if it's a first-time push to a branch, tag or etc.
func (PushUpdateOptions) IsNewTag ¶
func (opts PushUpdateOptions) IsNewTag() bool
IsNewTag return true if it's a creation to a tag
func (PushUpdateOptions) IsTag ¶
func (opts PushUpdateOptions) IsTag() bool
IsTag return true if it's an operation to a tag
func (PushUpdateOptions) IsUpdateBranch ¶
func (opts PushUpdateOptions) IsUpdateBranch() bool
IsUpdateBranch return true if it's not the first push to a branch
func (PushUpdateOptions) IsUpdateRef ¶
func (opts PushUpdateOptions) IsUpdateRef() bool
IsUpdateRef return true if it's an update operation
func (PushUpdateOptions) RefName ¶
func (opts PushUpdateOptions) RefName() string
RefName returns simple name for ref
func (PushUpdateOptions) RepoFullName ¶
func (opts PushUpdateOptions) RepoFullName() string
RepoFullName returns repo full name
func (PushUpdateOptions) TagName ¶
func (opts PushUpdateOptions) TagName() string
TagName returns simple tag name if it's an operation to a tag