uploader

package
v1.8.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2019 License: MIT Imports: 19 Imported by: 0

Documentation

Index

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

func (t *TemporaryUploadRepository) Push(doer *models.User, commitHash string, branch string) error

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

type UpdateRepoFileOptions

type UpdateRepoFileOptions struct {
	LastCommitID string
	OldBranch    string
	NewBranch    string
	OldTreeName  string
	NewTreeName  string
	Message      string
	Content      string
	IsNewFile    bool
}

UpdateRepoFileOptions holds the repository file update options

type UploadRepoFileOptions

type UploadRepoFileOptions struct {
	LastCommitID string
	OldBranch    string
	NewBranch    string
	TreePath     string
	Message      string
	Files        []string // In UUID format.
}

UploadRepoFileOptions contains the uploaded repository file options

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL