Documentation ¶
Index ¶
- func DeleteRepoFile(repo *models.Repository, doer *models.User, opts *DeleteRepoFileOptions) error
- func GetDiffPreview(repo *models.Repository, branch, treePath, content string) (*models.Diff, error)
- func UpdateRepoFile(repo *models.Repository, doer *models.User, opts *UpdateRepoFileOptions) error
- func UploadRepoFiles(repo *models.Repository, doer *models.User, opts *UploadRepoFileOptions) error
- type DeleteRepoFileOptions
- type TemporaryUploadRepository
- func (t *TemporaryUploadRepository) AddObjectToIndex(mode, objectHash, objectPath string) error
- func (t *TemporaryUploadRepository) CheckAttribute(attribute string, args ...string) (map[string]map[string]string, error)
- func (t *TemporaryUploadRepository) Clone(branch string) error
- func (t *TemporaryUploadRepository) Close()
- func (t *TemporaryUploadRepository) CommitTree(doer *models.User, treeHash string, message string) (string, error)
- func (t *TemporaryUploadRepository) DiffIndex() (diff *models.Diff, err error)
- func (t *TemporaryUploadRepository) HashObject(content io.Reader) (string, error)
- func (t *TemporaryUploadRepository) LsFiles(filenames ...string) ([]string, error)
- func (t *TemporaryUploadRepository) Push(doer *models.User, commitHash string, branch string) error
- func (t *TemporaryUploadRepository) RemoveFilesFromIndex(filenames ...string) error
- func (t *TemporaryUploadRepository) SetDefaultIndex() error
- func (t *TemporaryUploadRepository) WriteTree() (string, error)
- type UpdateRepoFileOptions
- type UploadRepoFileOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteRepoFile ¶
func DeleteRepoFile(repo *models.Repository, doer *models.User, opts *DeleteRepoFileOptions) error
DeleteRepoFile deletes a file in the given repository
func GetDiffPreview ¶
func GetDiffPreview(repo *models.Repository, branch, treePath, content string) (*models.Diff, error)
GetDiffPreview produces and returns diff result of a file which is not yet committed.
func UpdateRepoFile ¶
func UpdateRepoFile(repo *models.Repository, doer *models.User, opts *UpdateRepoFileOptions) error
UpdateRepoFile adds or updates a file in the given repository
func UploadRepoFiles ¶
func UploadRepoFiles(repo *models.Repository, doer *models.User, opts *UploadRepoFileOptions) error
UploadRepoFiles uploads files to the given repository
Types ¶
type DeleteRepoFileOptions ¶
type DeleteRepoFileOptions struct { LastCommitID string OldBranch string NewBranch string TreePath string Message string }
DeleteRepoFileOptions holds the repository delete file options
type TemporaryUploadRepository ¶
type TemporaryUploadRepository struct {
// contains filtered or unexported fields
}
TemporaryUploadRepository is a type to wrap our upload repositories
func NewTemporaryUploadRepository ¶
func NewTemporaryUploadRepository(repo *models.Repository) (*TemporaryUploadRepository, error)
NewTemporaryUploadRepository creates a new temporary upload repository
func (*TemporaryUploadRepository) AddObjectToIndex ¶
func (t *TemporaryUploadRepository) AddObjectToIndex(mode, objectHash, objectPath string) error
AddObjectToIndex adds the provided object hash to the index with the provided mode and path
func (*TemporaryUploadRepository) CheckAttribute ¶
func (t *TemporaryUploadRepository) CheckAttribute(attribute string, args ...string) (map[string]map[string]string, error)
CheckAttribute checks the given attribute of the provided files
func (*TemporaryUploadRepository) Clone ¶
func (t *TemporaryUploadRepository) Clone(branch string) error
Clone the base repository to our path and set branch as the HEAD
func (*TemporaryUploadRepository) Close ¶
func (t *TemporaryUploadRepository) Close()
Close the repository cleaning up all files
func (*TemporaryUploadRepository) CommitTree ¶
func (t *TemporaryUploadRepository) CommitTree(doer *models.User, treeHash string, message string) (string, error)
CommitTree creates a commit from a given tree for the user with provided message
func (*TemporaryUploadRepository) DiffIndex ¶
func (t *TemporaryUploadRepository) DiffIndex() (diff *models.Diff, err error)
DiffIndex returns a Diff of the current index to the head
func (*TemporaryUploadRepository) HashObject ¶
func (t *TemporaryUploadRepository) HashObject(content io.Reader) (string, error)
HashObject writes the provided content to the object db and returns its hash
func (*TemporaryUploadRepository) LsFiles ¶
func (t *TemporaryUploadRepository) LsFiles(filenames ...string) ([]string, error)
LsFiles checks if the given filename arguments are in the index
func (*TemporaryUploadRepository) Push ¶
Push the provided commitHash to the repository branch by the provided user
func (*TemporaryUploadRepository) RemoveFilesFromIndex ¶
func (t *TemporaryUploadRepository) RemoveFilesFromIndex(filenames ...string) error
RemoveFilesFromIndex removes the given files from the index
func (*TemporaryUploadRepository) SetDefaultIndex ¶
func (t *TemporaryUploadRepository) SetDefaultIndex() error
SetDefaultIndex sets the git index to our HEAD
func (*TemporaryUploadRepository) WriteTree ¶
func (t *TemporaryUploadRepository) WriteTree() (string, error)
WriteTree writes the current index as a tree to the object db and returns its hash