Documentation
¶
Index ¶
- Variables
- func CloneRepo(source, target string) (*repository, error)
- func CloneRepoBare(source, target string) (*repository, error)
- func ConflictingFilesInIndex(idx *git.Index) ([]string, error)
- func CreateBareRepoWithRootCommit(path string) (*repository, error)
- func CreateEmptyBareRepo(path string) (*repository, error)
- func CreateNonBareRepoWithRootCommit(path, headBranchName string) (*repository, error)
- func NewCredentialsCallback(publicKey, privateKey string) git.CredentialsCallback
- func OpenRepo(path string) (*repository, error)
- func OpenRepoWithLFS(path, lfsHostname string) (*repository, error)
- func RemoteBareClone(url, target string) (*repository, error)
- func RemoteCloneWithCreds(url, target string, creds git.CredentialsCallback, bare bool) (*repository, error)
- type ConflictDiffs
- type DiffOption
- type DiffOptions
- type FileContents
- type LogEntry
- type RebasedCommit
- type RepoGitReader
- type RepoGitWriter
- type RepoReader
- type RepoReaderGitWriter
- type RepoWriter
- type SturdyRebase
- func (rebase *SturdyRebase) ConflictDiff(filePath string) (ConflictDiffs, error)
- func (rebase *SturdyRebase) ConflictingFiles() ([]string, error)
- func (rebase *SturdyRebase) Continue() (conflicts bool, rebasedCommits []RebasedCommit, err error)
- func (rebase *SturdyRebase) LastCompletedCommit() string
- func (rebase *SturdyRebase) Progress() (current, total uint, err error)
- func (rebase *SturdyRebase) ResolveFiles(resolves []SturdyRebaseResolve) error
- func (rebase *SturdyRebase) Status() (SturdyRebaseStatus, error)
- type SturdyRebaseResolve
- type SturdyRebaseStatus
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCommitNotFound = errors.New("commit not found")
View Source
var ErrFileNotFound = errors.New("file not found in tree")
View Source
var NoRebaseInProgress = errors.New("no rebasing in progress")
Functions ¶
func CloneRepoBare ¶
func CreateEmptyBareRepo ¶
func NewCredentialsCallback ¶
func NewCredentialsCallback(publicKey, privateKey string) git.CredentialsCallback
func OpenRepoWithLFS ¶
func RemoteBareClone ¶
func RemoteCloneWithCreds ¶
func RemoteCloneWithCreds(url, target string, creds git.CredentialsCallback, bare bool) (*repository, error)
Types ¶
type ConflictDiffs ¶
type DiffOption ¶
type DiffOption func(*DiffOptions)
func WithGitMaxSize ¶
func WithGitMaxSize(size int) DiffOption
func WithIndex ¶
func WithIndex() DiffOption
func WithReverse ¶
func WithReverse() DiffOption
type DiffOptions ¶
type DiffOptions struct {
// contains filtered or unexported fields
}
type FileContents ¶
type LogEntry ¶
type LogEntry struct {
Time time.Time
RawCommitMessage string
ID string // This is a Commit ID
Name string
Email string
// If this commits has been landed on sturdytrunk (potentially with another commit ID)
IsLanded bool
}
func CommitLogEntry ¶
type RebasedCommit ¶
type RepoGitReader ¶
type RepoGitReader interface {
CodebaseID() string
IsTrunk() bool
ViewID() *string
IsRebasing() bool
CurrentDiffNoIndex() (*git.Diff, error)
DiffCommits(firstCommitID, secondCommitID string) (*git.Diff, error)
RemoteBranchCommit(remoteName, branchName string) (*git.Commit, error)
GetDefaultBranch() (string, error)
HeadBranch() (string, error)
HeadCommit() (*git.Commit, error)
BranchCommitID(branchName string) (string, error)
BranchFirstNonMergeCommit(branchName string) (string, error)
GetCommitParents(commitID string) ([]string, error)
CommitMessage(id string) (author *git.Signature, message string, err error)
ShowCommit(id string) (diffs []string, entry *LogEntry, err error)
BranchHasCommit(branchName, commitID string) (bool, error)
FileContentsAtCommit(commitID, filePath string) ([]byte, error)
FileBlobAtCommit(commitID, filePath string) (*git.Blob, error)
DirectoryChildrenAtCommit(commitID, directoryPath string) ([]string, error)
LogHead(limit int) ([]*LogEntry, error)
LogBranch(branchName string, limit int) ([]*LogEntry, error)
OpenRebase() (*SturdyRebase, error)
}
RepoGitReader only need access to read .git on the filesystem.
type RepoGitWriter ¶
type RepoGitWriter interface {
RepoGitReader
CreateRootCommit() error
CommitIndexTree(treeID *git.Oid, message string, signature git.Signature) (string, error)
CommitIndexTreeWithReference(treeID *git.Oid, message string, signature git.Signature, ref string) (string, error)
CreateBranchTrackingUpstream(branchName string) error
DeleteBranch(name string) error
CreateNewBranchOnHEAD(name string) error
CreateNewBranchAt(name string, targetSha string) error
CreateNewCommitBasedOnCommit(newBranchName string, existingCommitID string, signature git.Signature, message string) (string, error)
CleanStaged() error
Push(logger *zap.Logger, branchName string) error
ForcePush(logger *zap.Logger, branchName string) error
PushNamedRemoteWithRefspec(logger *zap.Logger, remoteName string, creds git.CredentialsCallback, refspecs []string) (userError string, err error)
RemoteFetchWithCreds(remoteName string, creds git.CredentialsCallback, refspecs []string) error
FetchBranch(branches ...string) error
SetDefaultBranch(targetBranch string) error
CreateAndSetDefaultBranch(headBranchName string) error
CreateCommitWithFiles(files []FileContents, newBranchName string) (string, error)
ResetMixed(commitID string) error
GitGC() error
GitReflogExpire() error
MergeBranches(ourBranchName, theirBranchName string) (*git.Index, error)
MergeBranchInto(branchName, mergeIntoBranchName string) error
ApplyPatchesToIndex(patches [][]byte) (*git.Oid, error)
RevertOnBranch(revertCommitID, branchName string) (string, error)
}
RepoGitWriter can read and write to .git
type RepoReader ¶
type RepoReader interface {
RepoGitReader
Path() string
Diffs(...DiffOption) (*git.Diff, error)
CurrentDiff(opts ...DiffOption) (*git.Diff, error)
AddFilesToIndex(files []string) (*git.Oid, error)
AddAndCommit(msg string) (string, error)
LargeFilesClean(codebaseID string, paths []string) ([][]byte, error)
CanApplyPatch(patch []byte) (bool, error)
}
RepoReader needs to read repository files on the filesystem.
type RepoReaderGitWriter ¶
type RepoReaderGitWriter interface {
RepoReader
RepoGitWriter
}
type RepoWriter ¶
type RepoWriter interface {
RepoReader
RepoGitWriter
CheckoutFile(fileName string) error
DeleteFile(fileName string) error
CheckoutBranchWithForce(branchName string) error
CheckoutBranchSafely(branchName string) error
CreateAndCheckoutBranchAtCommit(commitID, newBranchName string) error
MoveBranchToCommit(branchName, targetCommitSha string) error
MoveBranch(branchName, targetBranchName string) error
MoveBranchToHEAD(branchName string) error
CherryPickOnto(commitID, onto string) (newCommitID string, conflicted bool, conflictingFiles []string, err error)
InitRebaseRaw(head, onto string) (*SturdyRebase, []RebasedCommit, error)
LargeFilesPull() error
ApplyPatchesToWorkdir(patches [][]byte) error
ResetHard(commitID string) error
}
RepoWriter might modify files on the filesystem.
func CloneRepoShared ¶
func CloneRepoShared(source, target string) (RepoWriter, error)
CloneRepoShared should only be used for testing purposes
type SturdyRebase ¶
type SturdyRebase struct {
// contains filtered or unexported fields
}
func (*SturdyRebase) ConflictDiff ¶
func (rebase *SturdyRebase) ConflictDiff(filePath string) (ConflictDiffs, error)
func (*SturdyRebase) ConflictingFiles ¶
func (rebase *SturdyRebase) ConflictingFiles() ([]string, error)
func (*SturdyRebase) Continue ¶
func (rebase *SturdyRebase) Continue() (conflicts bool, rebasedCommits []RebasedCommit, err error)
Continue the rebase until the next conflict, or the rebase is completed
func (*SturdyRebase) LastCompletedCommit ¶
func (rebase *SturdyRebase) LastCompletedCommit() string
func (*SturdyRebase) Progress ¶
func (rebase *SturdyRebase) Progress() (current, total uint, err error)
func (*SturdyRebase) ResolveFiles ¶
func (rebase *SturdyRebase) ResolveFiles(resolves []SturdyRebaseResolve) error
func (*SturdyRebase) Status ¶
func (rebase *SturdyRebase) Status() (SturdyRebaseStatus, error)
type SturdyRebaseResolve ¶
type SturdyRebaseStatus ¶
type SturdyRebaseStatus int
const ( RebaseInProgress SturdyRebaseStatus = iota // Used during initialization RebaseCanContinue // The rebase can continue RebaseHaveConflicts // There are conflicts that must be resolved before continuing RebaseCompleted // The rebase is completed )
Source Files
¶
Click to show internal directories.
Click to hide internal directories.