Documentation
¶
Index ¶
- func CleanupMergeConflicts(conflicts []string) []string
- func Run(ctx context.Context, refUpdater *hook.RefUpdater, tmpDir, repoPath string, ...) error
- type SharedRepo
- func (r *SharedRepo) AddObjectToIndex(ctx context.Context, mode string, objectHash sha.SHA, objectPath string) error
- func (r *SharedRepo) ClearIndex(ctx context.Context) error
- func (r *SharedRepo) Close(ctx context.Context)
- func (r *SharedRepo) CommitSHAsForRebase(ctx context.Context, target, source sha.SHA) ([]sha.SHA, error)
- func (r *SharedRepo) CommitTree(ctx context.Context, author, committer *api.Signature, treeHash sha.SHA, ...) (sha.SHA, error)
- func (r *SharedRepo) CreateFile(ctx context.Context, treeishSHA sha.SHA, filePath, mode string, payload []byte) error
- func (r *SharedRepo) DeleteFile(ctx context.Context, filePath string) error
- func (r *SharedRepo) Directory() string
- func (r *SharedRepo) GetTreeSHA(ctx context.Context, rev string) (sha.SHA, error)
- func (r *SharedRepo) Init(ctx context.Context, alternates ...string) error
- func (r *SharedRepo) LsFiles(ctx context.Context, filenames ...string) ([]string, error)
- func (r *SharedRepo) MergeBase(ctx context.Context, rev1, rev2 string) (string, error)
- func (r *SharedRepo) MergeTree(ctx context.Context, commitMergeBase, commitTarget, commitSource sha.SHA) (sha.SHA, []string, error)
- func (r *SharedRepo) MoveFile(ctx context.Context, treeishSHA sha.SHA, filePath string, objectSHA sha.SHA, ...) (string, error)
- func (r *SharedRepo) MoveObjects(ctx context.Context) error
- func (r *SharedRepo) PatchTextFile(ctx context.Context, treeishSHA sha.SHA, filePath string, objectSHA sha.SHA, ...) error
- func (r *SharedRepo) RemoveFilesFromIndex(ctx context.Context, filenames ...string) error
- func (r *SharedRepo) SetDefaultIndex(ctx context.Context) error
- func (r *SharedRepo) SetIndex(ctx context.Context, treeish sha.SHA) error
- func (r *SharedRepo) ShowFile(ctx context.Context, filePath string, rev string, writer io.Writer) error
- func (r *SharedRepo) UpdateFile(ctx context.Context, treeishSHA sha.SHA, filePath string, objectSHA sha.SHA, ...) error
- func (r *SharedRepo) WriteGitObject(ctx context.Context, content io.Reader) (sha.SHA, error)
- func (r *SharedRepo) WriteTree(ctx context.Context) (sha.SHA, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanupMergeConflicts ¶
func Run ¶
func Run( ctx context.Context, refUpdater *hook.RefUpdater, tmpDir, repoPath string, fn func(s *SharedRepo) error, alternates ...string, ) error
Run is helper function used to run the provided function inside a shared repository. If the provided hook.RefUpdater is not nil it will be used to update the reference. Inside the provided inline function there should be a call to initialize the ref updater. If the provided hook.RefUpdater is nil the entire operation is a read-only.
Types ¶
type SharedRepo ¶
type SharedRepo struct {
// contains filtered or unexported fields
}
func NewSharedRepo ¶
func NewSharedRepo( baseTmpDir string, sourceRepoPath string, ) (*SharedRepo, error)
NewSharedRepo creates a new temporary bare repository.
func (*SharedRepo) AddObjectToIndex ¶
func (r *SharedRepo) AddObjectToIndex( ctx context.Context, mode string, objectHash sha.SHA, objectPath string, ) error
AddObjectToIndex adds the provided object hash to the index with the provided mode and path.
func (*SharedRepo) ClearIndex ¶
func (r *SharedRepo) ClearIndex(ctx context.Context) error
ClearIndex clears the git index.
func (*SharedRepo) Close ¶
func (r *SharedRepo) Close(ctx context.Context)
func (*SharedRepo) CommitSHAsForRebase ¶
func (r *SharedRepo) CommitSHAsForRebase( ctx context.Context, target, source sha.SHA, ) ([]sha.SHA, error)
CommitSHAsForRebase returns list of SHAs of the commits between the two git revisions for a rebase operation - in the order they should be rebased in.
func (*SharedRepo) CommitTree ¶
func (r *SharedRepo) CommitTree( ctx context.Context, author, committer *api.Signature, treeHash sha.SHA, message string, signoff bool, parentCommits ...sha.SHA, ) (sha.SHA, error)
CommitTree creates a commit from a given tree for the user with provided message.
func (*SharedRepo) CreateFile ¶
func (*SharedRepo) DeleteFile ¶
func (r *SharedRepo) DeleteFile(ctx context.Context, filePath string) error
func (*SharedRepo) Directory ¶
func (r *SharedRepo) Directory() string
func (*SharedRepo) GetTreeSHA ¶
GetTreeSHA returns the tree SHA of the rev.
func (*SharedRepo) Init ¶
func (r *SharedRepo) Init(ctx context.Context, alternates ...string) error
func (*SharedRepo) MergeTree ¶
func (r *SharedRepo) MergeTree( ctx context.Context, commitMergeBase, commitTarget, commitSource sha.SHA, ) (sha.SHA, []string, error)
MergeTree merges commits in git index.
func (*SharedRepo) MoveObjects ¶
func (r *SharedRepo) MoveObjects(ctx context.Context) error
MoveObjects moves git object from the shared repository to the original repository.
func (*SharedRepo) PatchTextFile ¶
func (*SharedRepo) RemoveFilesFromIndex ¶
func (r *SharedRepo) RemoveFilesFromIndex( ctx context.Context, filenames ...string, ) error
RemoveFilesFromIndex removes the given files from the index.
func (*SharedRepo) SetDefaultIndex ¶
func (r *SharedRepo) SetDefaultIndex(ctx context.Context) error
SetDefaultIndex sets the git index to our HEAD.
func (*SharedRepo) ShowFile ¶
func (r *SharedRepo) ShowFile( ctx context.Context, filePath string, rev string, writer io.Writer, ) error
ShowFile dumps show file and write to io.Writer.
func (*SharedRepo) UpdateFile ¶
func (*SharedRepo) WriteGitObject ¶
WriteGitObject writes the provided content to the object db and returns its hash.