{"modulePath":"github.com/RedAFD/code-core","version":"v1.14.0-rc8","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package repofiles\n\n## Functions\n\n```go\nfunc CleanUploadFileName(name string) string\n```\nCleanUploadFileName Trims a filename and returns empty string if it is a .git directory\n\n```go\nfunc CountDivergingCommits(repo *models.Repository, branch string) (*git.DivergeObject, error)\n```\nCountDivergingCommits determines how many commits a branch is ahead or behind the repository's base branch\n\n```go\nfunc CreateCommitStatus(repo *models.Repository, creator *models.User, sha string, status *models.CommitStatus) error\n```\nCreateCommitStatus creates a new CommitStatus given a bunch of parameters NOTE: All text-values will be trimmed from whitespaces. Requires: Repo, Creator, SHA\n\n```go\nfunc CreateOrUpdateRepoFile(repo *models.Repository, doer *models.User, opts *UpdateRepoFileOptions) (*structs.FileResponse, error)\n```\nCreateOrUpdateRepoFile adds or updates a file in the given repository\n\n```go\nfunc DeleteRepoFile(repo *models.Repository, doer *models.User, opts *DeleteRepoFileOptions) (*api.FileResponse, error)\n```\nDeleteRepoFile deletes a file in the given repository\n\n```go\nfunc GetAuthorAndCommitterUsers(author, committer *IdentityOptions, doer *models.User) (authorUser, committerUser *models.User)\n```\nGetAuthorAndCommitterUsers Gets the author and committer user objects from the IdentityOptions\n\n```go\nfunc GetBlobBySHA(repo *models.Repository, sha string) (*api.GitBlobResponse, error)\n```\nGetBlobBySHA get the GitBlobResponse of a repository using a sha hash.\n\n```go\nfunc GetContents(repo *models.Repository, treePath, ref string, forList bool) (*api.ContentsResponse, error)\n```\nGetContents gets the meta data on a file's contents. Ref can be a branch, commit or tag\n\n```go\nfunc GetContentsOrList(repo *models.Repository, treePath, ref string) (interface{}, error)\n```\nGetContentsOrList gets the meta data of a file's contents (\\*ContentsResponse) if treePath not a tree directory, otherwise a listing of file contents (\\[]\\*ContentsResponse). Ref can be a branch, commit or tag\n\n```go\nfunc GetDiffPreview(repo *models.Repository, branch, treePath, content string) (*gitdiff.Diff, error)\n```\nGetDiffPreview produces and returns diff result of a file which is not yet committed.\n\n```go\nfunc GetFileCommitResponse(repo *models.Repository, commit *git.Commit) (*api.FileCommitResponse, error)\n```\nGetFileCommitResponse Constructs a FileCommitResponse from a Commit object\n\n```go\nfunc GetFileResponseFromCommit(repo *models.Repository, commit *git.Commit, branch, treeName string) (*api.FileResponse, error)\n```\nGetFileResponseFromCommit Constructs a FileResponse from a Commit object\n\n```go\nfunc GetPayloadCommitVerification(commit *git.Commit) *structs.PayloadCommitVerification\n```\nGetPayloadCommitVerification returns the verification information of a commit\n\n```go\nfunc GetTreeBySHA(repo *models.Repository, sha string, page, perPage int, recursive bool) (*api.GitTreeResponse, error)\n```\nGetTreeBySHA get the GitTreeResponse of a repository using a sha hash.\n\n```go\nfunc UpdateIssuesCommit(doer *models.User, repo *models.Repository, commits []*repository.PushCommit, branchName string) error\n```\nUpdateIssuesCommit checks if issues are manipulated by commit message.\n\n```go\nfunc UploadRepoFiles(repo *models.Repository, doer *models.User, opts *UploadRepoFileOptions) error\n```\nUploadRepoFiles uploads files to the given repository\n\n## Types\n\n```go\ntype CommitDateOptions struct {\n\tAuthor    time.Time\n\tCommitter time.Time\n}\n```\nCommitDateOptions store dates for GIT\\_AUTHOR\\_DATE and GIT\\_COMMITTER\\_DATE\n\n```go\ntype ContentType string\n```\nContentType repo content type\n\n```go\nconst (\n\t// ContentTypeRegular regular content type (file)\n\tContentTypeRegular ContentType = \"file\"\n\t// ContentTypeDir dir content type (dir)\n\tContentTypeDir ContentType = \"dir\"\n\t// ContentLink link content type (symlink)\n\tContentTypeLink ContentType = \"symlink\"\n\t// ContentTag submodule content type (submodule)\n\tContentTypeSubmodule ContentType = \"submodule\"\n)\n```\nThe string representations of different content types\n\n```go\nfunc (ct *ContentType) String() string\n```\nString gets the string of ContentType\n\n```go\ntype DeleteRepoFileOptions struct {\n\tLastCommitID string\n\tOldBranch    string\n\tNewBranch    string\n\tTreePath     string\n\tMessage      string\n\tSHA          string\n\tAuthor       *IdentityOptions\n\tCommitter    *IdentityOptions\n\tDates        *CommitDateOptions\n\tSignoff      bool\n}\n```\nDeleteRepoFileOptions holds the repository delete file options\n\n```go\ntype IdentityOptions struct {\n\tName  string\n\tEmail string\n}\n```\nIdentityOptions for a person's identity like an author or committer\n\n```go\ntype TemporaryUploadRepository struct {\n\t// contains filtered or unexported fields\n}\n```\nTemporaryUploadRepository is a type to wrap our upload repositories as a shallow clone\n\n```go\nfunc NewTemporaryUploadRepository(repo *models.Repository) (*TemporaryUploadRepository, error)\n```\nNewTemporaryUploadRepository creates a new temporary upload repository\n\n```go\nfunc (t *TemporaryUploadRepository) AddObjectToIndex(mode, objectHash, objectPath string) error\n```\nAddObjectToIndex adds the provided object hash to the index with the provided mode and path\n\n```go\nfunc (t *TemporaryUploadRepository) Clone(branch string) error\n```\nClone the base repository to our path and set branch as the HEAD\n\n```go\nfunc (t *TemporaryUploadRepository) Close()\n```\nClose the repository cleaning up all files\n\n```go\nfunc (t *TemporaryUploadRepository) CommitTree(author, committer *models.User, treeHash string, message string, signoff bool) (string, error)\n```\nCommitTree creates a commit from a given tree for the user with provided message\n\n```go\nfunc (t *TemporaryUploadRepository) CommitTreeWithDate(author, committer *models.User, treeHash string, message string, signoff bool, authorDate, committerDate time.Time) (string, error)\n```\nCommitTreeWithDate creates a commit from a given tree for the user with provided message\n\n```go\nfunc (t *TemporaryUploadRepository) DiffIndex() (*gitdiff.Diff, error)\n```\nDiffIndex returns a Diff of the current index to the head\n\n```go\nfunc (t *TemporaryUploadRepository) GetBranchCommit(branch string) (*git.Commit, error)\n```\nGetBranchCommit Gets the commit object of the given branch\n\n```go\nfunc (t *TemporaryUploadRepository) GetCommit(commitID string) (*git.Commit, error)\n```\nGetCommit Gets the commit object of the given commit ID\n\n```go\nfunc (t *TemporaryUploadRepository) GetLastCommit() (string, error)\n```\nGetLastCommit gets the last commit ID SHA of the repo\n\n```go\nfunc (t *TemporaryUploadRepository) GetLastCommitByRef(ref string) (string, error)\n```\nGetLastCommitByRef gets the last commit ID SHA of the repo by ref\n\n```go\nfunc (t *TemporaryUploadRepository) HashObject(content io.Reader) (string, error)\n```\nHashObject writes the provided content to the object db and returns its hash\n\n```go\nfunc (t *TemporaryUploadRepository) LsFiles(filenames ...string) ([]string, error)\n```\nLsFiles checks if the given filename arguments are in the index\n\n```go\nfunc (t *TemporaryUploadRepository) Push(doer *models.User, commitHash string, branch string) error\n```\nPush the provided commitHash to the repository branch by the provided user\n\n```go\nfunc (t *TemporaryUploadRepository) RemoveFilesFromIndex(filenames ...string) error\n```\nRemoveFilesFromIndex removes the given files from the index\n\n```go\nfunc (t *TemporaryUploadRepository) SetDefaultIndex() error\n```\nSetDefaultIndex sets the git index to our HEAD\n\n```go\nfunc (t *TemporaryUploadRepository) WriteTree() (string, error)\n```\nWriteTree writes the current index as a tree to the object db and returns its hash\n\n```go\ntype UpdateRepoFileOptions struct {\n\tLastCommitID string\n\tOldBranch    string\n\tNewBranch    string\n\tTreePath     string\n\tFromTreePath string\n\tMessage      string\n\tContent      string\n\tSHA          string\n\tIsNewFile    bool\n\tAuthor       *IdentityOptions\n\tCommitter    *IdentityOptions\n\tDates        *CommitDateOptions\n\tSignoff      bool\n}\n```\nUpdateRepoFileOptions holds the repository file update options\n\n```go\ntype UploadRepoFileOptions struct {\n\tLastCommitID string\n\tOldBranch    string\n\tNewBranch    string\n\tTreePath     string\n\tMessage      string\n\tFiles        []string // In UUID format.\n\tSignoff      bool\n}\n```\nUploadRepoFileOptions contains the uploaded repository file options\n\n","path":"github.com/RedAFD/code-core/modules/repofiles","name":"repofiles","synopsis":"","isRedistributable":true}
