Documentation
¶
Index ¶
- Constants
- type Author
- type BisectCommands
- func (self *BisectCommands) GetInfo() *BisectInfo
- func (self *BisectCommands) IsDone() (bool, []string, error)
- func (self *BisectCommands) Mark(ref string, term string) error
- func (self *BisectCommands) ReachableFromStart(bisectInfo *BisectInfo) bool
- func (self *BisectCommands) Reset() error
- func (self *BisectCommands) Skip(ref string) error
- func (self *BisectCommands) Start() error
- type BisectInfo
- func (self *BisectInfo) Bisecting() bool
- func (self *BisectInfo) GetCurrentSha() string
- func (self *BisectInfo) GetNewSha() string
- func (self *BisectInfo) GetStartSha() string
- func (self *BisectInfo) NewTerm() string
- func (self *BisectInfo) OldTerm() string
- func (self *BisectInfo) Started() bool
- func (self *BisectInfo) Status(commitSha string) (BisectStatus, bool)
- type BisectStatus
- type BranchCommands
- func (self *BranchCommands) AllBranchesLogCmdObj() oscommands.ICmdObj
- func (self *BranchCommands) Checkout(branch string, options CheckoutOptions) error
- func (self *BranchCommands) CurrentBranchName() (string, string, error)
- func (self *BranchCommands) Delete(branch string, force bool) error
- func (self *BranchCommands) GetCommitDifferences(from, to string) (string, string)
- func (self *BranchCommands) GetCurrentBranchUpstreamDifferenceCount() (string, string)
- func (self *BranchCommands) GetGraph(branchName string) (string, error)
- func (self *BranchCommands) GetGraphCmdObj(branchName string) oscommands.ICmdObj
- func (self *BranchCommands) GetRawBranches() (string, error)
- func (self *BranchCommands) GetUpstreamDifferenceCount(branchName string) (string, string)
- func (self *BranchCommands) IsHeadDetached() bool
- func (self *BranchCommands) Merge(branchName string, opts MergeOpts) error
- func (self *BranchCommands) New(name string, base string) error
- func (self *BranchCommands) Rename(oldName string, newName string) error
- func (self *BranchCommands) SetCurrentBranchUpstream(remoteName string, remoteBranchName string) error
- func (self *BranchCommands) SetUpstream(remoteName string, remoteBranchName string, branchName string) error
- func (self *BranchCommands) UnsetUpstream(branchName string) error
- type CheckoutOptions
- type CommitCommands
- func (self *CommitCommands) AmendHead() error
- func (self *CommitCommands) AmendHeadCmdObj() oscommands.ICmdObj
- func (self *CommitCommands) CommitCmdObj(message string) oscommands.ICmdObj
- func (self *CommitCommands) CommitEditorCmdObj() oscommands.ICmdObj
- func (self *CommitCommands) CreateFixupCommit(sha string) error
- func (self *CommitCommands) GetCommitAuthor(commitSha string) (Author, error)
- func (self *CommitCommands) GetCommitDiff(commitSha string) (string, error)
- func (self *CommitCommands) GetCommitMessage(commitSha string) (string, error)
- func (self *CommitCommands) GetCommitMessageFirstLine(sha string) (string, error)
- func (self *CommitCommands) GetCommitMessagesFirstLine(shas []string) (string, error)
- func (self *CommitCommands) GetCommitsOneline(shas []string) (string, error)
- func (self *CommitCommands) GetHeadCommitMessage() (string, error)
- func (self *CommitCommands) ResetAuthor() error
- func (self *CommitCommands) ResetToCommit(sha string, strength string, envVars []string) error
- func (self *CommitCommands) Revert(sha string) error
- func (self *CommitCommands) RevertMerge(sha string, parentNumber int) error
- func (self *CommitCommands) RewordLastCommit(message string) error
- func (self *CommitCommands) SetAuthor(value string) error
- func (self *CommitCommands) ShowCmdObj(sha string, filterPath string) oscommands.ICmdObj
- type ConfigCommands
- func (self *ConfigCommands) Branches() (map[string]*config.Branch, error)
- func (self *ConfigCommands) ConfiguredPager() string
- func (self *ConfigCommands) GetCoreEditor() string
- func (self *ConfigCommands) GetGitFlowPrefixes() string
- func (self *ConfigCommands) GetPager(width int) string
- func (self *ConfigCommands) GetPushToCurrent() bool
- func (self *ConfigCommands) GetRemoteURL() string
- func (self *ConfigCommands) GetShowUntrackedFiles() string
- func (self *ConfigCommands) UsingGpg() bool
- type CustomCommands
- type FetchOptions
- type FileCommands
- type FlowCommands
- type GitCommon
- type IFileNode
- type MergeOpts
- type PatchCommands
- func (self *PatchCommands) DeletePatchesFromCommit(commits []*models.Commit, commitIndex int) error
- func (self *PatchCommands) MovePatchIntoIndex(commits []*models.Commit, commitIdx int, stash bool) error
- func (self *PatchCommands) MovePatchToSelectedCommit(commits []*models.Commit, sourceCommitIdx int, destinationCommitIdx int) error
- func (self *PatchCommands) PullPatchIntoNewCommit(commits []*models.Commit, commitIdx int) error
- type PullOptions
- type PushOpts
- type RebaseCommands
- func (self *RebaseCommands) AbortRebase() error
- func (self *RebaseCommands) AmendTo(sha string) error
- func (self *RebaseCommands) BeginInteractiveRebaseForCommit(commits []*models.Commit, commitIndex int) error
- func (self *RebaseCommands) BuildSingleActionTodo(commits []*models.Commit, actionIndex int, action string) ([]TodoLine, string, error)
- func (self *RebaseCommands) BuildTodoLines(commits []*models.Commit, f func(*models.Commit, int) string) []TodoLine
- func (self *RebaseCommands) BuildTodoLinesSingleAction(commits []*models.Commit, action string) []TodoLine
- func (self *RebaseCommands) CherryPickCommits(commits []*models.Commit) error
- func (self *RebaseCommands) ContinueRebase() error
- func (self *RebaseCommands) DiscardOldFileChanges(commits []*models.Commit, commitIndex int, fileName string) error
- func (self *RebaseCommands) EditRebaseTodo(index int, action string) error
- func (self *RebaseCommands) GenericAmend(commits []*models.Commit, index int, f func() error) error
- func (self *RebaseCommands) GenericMergeOrRebaseAction(commandType string, command string) error
- func (self *RebaseCommands) GenericMergeOrRebaseActionCmdObj(commandType string, command string) oscommands.ICmdObj
- func (self *RebaseCommands) InteractiveRebase(commits []*models.Commit, index int, action string) error
- func (self *RebaseCommands) MoveCommitDown(commits []*models.Commit, index int) error
- func (self *RebaseCommands) MoveTodoDown(index int) error
- func (self *RebaseCommands) PrepareInteractiveRebaseCommand(baseSha string, todoLines []TodoLine, overrideEditor bool) oscommands.ICmdObj
- func (self *RebaseCommands) RebaseBranch(branchName string) error
- func (self *RebaseCommands) ResetCommitAuthor(commits []*models.Commit, index int) error
- func (self *RebaseCommands) RewordCommit(commits []*models.Commit, index int, message string) error
- func (self *RebaseCommands) RewordCommitInEditor(commits []*models.Commit, index int) (oscommands.ICmdObj, error)
- func (self *RebaseCommands) SetCommitAuthor(commits []*models.Commit, index int, value string) error
- func (self *RebaseCommands) SquashAllAboveFixupCommits(sha string) error
- type RemoteCommands
- func (self *RemoteCommands) AddRemote(name string, url string) error
- func (self *RemoteCommands) CheckRemoteBranchExists(branchName string) bool
- func (self *RemoteCommands) DeleteRemoteBranch(remoteName string, branchName string) error
- func (self *RemoteCommands) RemoveRemote(name string) error
- func (self *RemoteCommands) RenameRemote(oldRemoteName string, newRemoteName string) error
- func (self *RemoteCommands) UpdateRemoteUrl(remoteName string, updatedUrl string) error
- type StashCommands
- func (self *StashCommands) Apply(index int) error
- func (self *StashCommands) Drop(index int) error
- func (self *StashCommands) DropNewest() error
- func (self *StashCommands) Pop(index int) error
- func (self *StashCommands) Save(message string) error
- func (self *StashCommands) SaveStagedChanges(message string) error
- func (self *StashCommands) ShowStashEntryCmdObj(index int) oscommands.ICmdObj
- func (self *StashCommands) StashAndKeepIndex(message string) error
- func (self *StashCommands) StashUnstagedChanges(message string) error
- type StatusCommands
- type SubmoduleCommands
- func (self *SubmoduleCommands) Add(name string, path string, url string) error
- func (self *SubmoduleCommands) BulkDeinitCmdObj() oscommands.ICmdObj
- func (self *SubmoduleCommands) BulkInitCmdObj() oscommands.ICmdObj
- func (self *SubmoduleCommands) BulkUpdateCmdObj() oscommands.ICmdObj
- func (self *SubmoduleCommands) Delete(submodule *models.SubmoduleConfig) error
- func (self *SubmoduleCommands) ForceBulkUpdateCmdObj() oscommands.ICmdObj
- func (self *SubmoduleCommands) GetConfigs() ([]*models.SubmoduleConfig, error)
- func (self *SubmoduleCommands) Init(path string) error
- func (self *SubmoduleCommands) Reset(submodule *models.SubmoduleConfig) error
- func (self *SubmoduleCommands) ResetSubmodules(submodules []*models.SubmoduleConfig) error
- func (self *SubmoduleCommands) Stash(submodule *models.SubmoduleConfig) error
- func (self *SubmoduleCommands) Update(path string) error
- func (self *SubmoduleCommands) UpdateAll() error
- func (self *SubmoduleCommands) UpdateUrl(name string, path string, newUrl string) error
- type SyncCommands
- func (self *SyncCommands) FastForward(branchName string, remoteName string, remoteBranchName string) error
- func (self *SyncCommands) Fetch(opts FetchOptions) error
- func (self *SyncCommands) FetchRemote(remoteName string) error
- func (self *SyncCommands) Pull(opts PullOptions) error
- func (self *SyncCommands) Push(opts PushOpts) error
- func (self *SyncCommands) PushCmdObj(opts PushOpts) (oscommands.ICmdObj, error)
- type TagCommands
- type TodoLine
- type WorkingTreeCommands
- func (self *WorkingTreeCommands) ApplyPatch(patch string, flags ...string) error
- func (self *WorkingTreeCommands) ApplyPatchFile(filepath string, flags ...string) error
- func (self *WorkingTreeCommands) BeforeAndAfterFileForRename(file *models.File) (*models.File, *models.File, error)
- func (self *WorkingTreeCommands) CheckoutFile(commitSha, fileName string) error
- func (self *WorkingTreeCommands) DiscardAllDirChanges(node IFileNode) error
- func (self *WorkingTreeCommands) DiscardAllFileChanges(file *models.File) error
- func (self *WorkingTreeCommands) DiscardAnyUnstagedFileChanges() error
- func (self *WorkingTreeCommands) DiscardUnstagedDirChanges(node IFileNode) error
- func (self *WorkingTreeCommands) DiscardUnstagedFileChanges(file *models.File) error
- func (self *WorkingTreeCommands) Exclude(filename string) error
- func (self *WorkingTreeCommands) Ignore(filename string) error
- func (self *WorkingTreeCommands) OpenMergeTool() error
- func (self *WorkingTreeCommands) OpenMergeToolCmdObj() oscommands.ICmdObj
- func (self *WorkingTreeCommands) RemoveTrackedFiles(name string) error
- func (self *WorkingTreeCommands) RemoveUntrackedDirFiles(node IFileNode) error
- func (self *WorkingTreeCommands) RemoveUntrackedFiles() error
- func (self *WorkingTreeCommands) ResetAndClean() error
- func (self *WorkingTreeCommands) ResetHard(ref string) error
- func (self *WorkingTreeCommands) ResetMixed(ref string) error
- func (self *WorkingTreeCommands) ResetSoft(ref string) error
- func (self *WorkingTreeCommands) SaveTemporaryPatch(patch string) (string, error)
- func (self *WorkingTreeCommands) ShowFileDiff(from string, to string, reverse bool, fileName string, plain bool) (string, error)
- func (self *WorkingTreeCommands) ShowFileDiffCmdObj(from string, to string, reverse bool, fileName string, plain bool) oscommands.ICmdObj
- func (self *WorkingTreeCommands) StageAll() error
- func (self *WorkingTreeCommands) StageFile(path string) error
- func (self *WorkingTreeCommands) StageFiles(paths []string) error
- func (self *WorkingTreeCommands) UnStageFile(fileNames []string, reset bool) error
- func (self *WorkingTreeCommands) UnstageAll() error
- func (self *WorkingTreeCommands) WorktreeFileDiff(file *models.File, plain bool, cached bool, ignoreWhitespace bool) string
- func (self *WorkingTreeCommands) WorktreeFileDiffCmdObj(node models.IFile, plain bool, cached bool, ignoreWhitespace bool) oscommands.ICmdObj
Constants ¶
const CurrentBranchNameRegex = `(?m)^\*.*?([^ ]*?)\)?$`
this takes something like:
- (HEAD detached at 264fc6f5) remotes
and returns '264fc6f5' as the second match
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BisectCommands ¶ added in v0.35.0
type BisectCommands struct {
*GitCommon
}
func NewBisectCommands ¶ added in v0.35.0
func NewBisectCommands(gitCommon *GitCommon) *BisectCommands
func (*BisectCommands) GetInfo ¶ added in v0.35.0
func (self *BisectCommands) GetInfo() *BisectInfo
This command is pretty cheap to run so we're not storing the result anywhere. But if it becomes problematic we can chang that.
func (*BisectCommands) IsDone ¶ added in v0.35.0
func (self *BisectCommands) IsDone() (bool, []string, error)
tells us whether we've found our problem commit(s). We return a string slice of commit sha's if we're done, and that slice may have more that one item if skipped commits are involved.
func (*BisectCommands) Mark ¶ added in v0.35.0
func (self *BisectCommands) Mark(ref string, term string) error
func (*BisectCommands) ReachableFromStart ¶ added in v0.35.0
func (self *BisectCommands) ReachableFromStart(bisectInfo *BisectInfo) bool
tells us whether the 'start' ref that we'll be sent back to after we're done bisecting is actually a descendant of our current bisect commit. If it's not, we need to render the commits from the bad commit.
func (*BisectCommands) Reset ¶ added in v0.35.0
func (self *BisectCommands) Reset() error
func (*BisectCommands) Skip ¶ added in v0.35.0
func (self *BisectCommands) Skip(ref string) error
func (*BisectCommands) Start ¶ added in v0.35.0
func (self *BisectCommands) Start() error
type BisectInfo ¶ added in v0.35.0
type BisectInfo struct {
// contains filtered or unexported fields
}
func (*BisectInfo) Bisecting ¶ added in v0.35.0
func (self *BisectInfo) Bisecting() bool
this is where we have both a good and bad revision and we're actually starting to narrow things down
func (*BisectInfo) GetCurrentSha ¶ added in v0.35.0
func (self *BisectInfo) GetCurrentSha() string
func (*BisectInfo) GetNewSha ¶ added in v0.35.0
func (self *BisectInfo) GetNewSha() string
func (*BisectInfo) GetStartSha ¶ added in v0.35.0
func (self *BisectInfo) GetStartSha() string
func (*BisectInfo) NewTerm ¶ added in v0.35.0
func (self *BisectInfo) NewTerm() string
func (*BisectInfo) OldTerm ¶ added in v0.35.0
func (self *BisectInfo) OldTerm() string
func (*BisectInfo) Started ¶ added in v0.35.0
func (self *BisectInfo) Started() bool
this is for when we have called `git bisect start`. It does not mean that we have actually started narrowing things down or selecting good/bad commits
func (*BisectInfo) Status ¶ added in v0.35.0
func (self *BisectInfo) Status(commitSha string) (BisectStatus, bool)
type BisectStatus ¶ added in v0.35.0
type BisectStatus int
const ( BisectStatusOld BisectStatus = iota BisectStatusNew BisectStatusSkipped )
type BranchCommands ¶
type BranchCommands struct {
*GitCommon
}
func NewBranchCommands ¶
func NewBranchCommands(gitCommon *GitCommon) *BranchCommands
func (*BranchCommands) AllBranchesLogCmdObj ¶
func (self *BranchCommands) AllBranchesLogCmdObj() oscommands.ICmdObj
func (*BranchCommands) Checkout ¶
func (self *BranchCommands) Checkout(branch string, options CheckoutOptions) error
func (*BranchCommands) CurrentBranchName ¶
func (self *BranchCommands) CurrentBranchName() (string, string, error)
CurrentBranchName get the current branch name and displayname. the first returned string is the name and the second is the displayname e.g. name is 123asdf and displayname is '(HEAD detached at 123asdf)'
func (*BranchCommands) Delete ¶
func (self *BranchCommands) Delete(branch string, force bool) error
Delete delete branch
func (*BranchCommands) GetCommitDifferences ¶
func (self *BranchCommands) GetCommitDifferences(from, to string) (string, string)
GetCommitDifferences checks how many pushables/pullables there are for the current branch
func (*BranchCommands) GetCurrentBranchUpstreamDifferenceCount ¶
func (self *BranchCommands) GetCurrentBranchUpstreamDifferenceCount() (string, string)
func (*BranchCommands) GetGraph ¶
func (self *BranchCommands) GetGraph(branchName string) (string, error)
GetGraph gets the color-formatted graph of the log for the given branch Currently it limits the result to 100 commits, but when we get async stuff working we can do lazy loading
func (*BranchCommands) GetGraphCmdObj ¶
func (self *BranchCommands) GetGraphCmdObj(branchName string) oscommands.ICmdObj
func (*BranchCommands) GetRawBranches ¶
func (self *BranchCommands) GetRawBranches() (string, error)
func (*BranchCommands) GetUpstreamDifferenceCount ¶
func (self *BranchCommands) GetUpstreamDifferenceCount(branchName string) (string, string)
func (*BranchCommands) IsHeadDetached ¶
func (self *BranchCommands) IsHeadDetached() bool
func (*BranchCommands) Merge ¶
func (self *BranchCommands) Merge(branchName string, opts MergeOpts) error
func (*BranchCommands) New ¶
func (self *BranchCommands) New(name string, base string) error
New creates a new branch
func (*BranchCommands) Rename ¶
func (self *BranchCommands) Rename(oldName string, newName string) error
func (*BranchCommands) SetCurrentBranchUpstream ¶
func (self *BranchCommands) SetCurrentBranchUpstream(remoteName string, remoteBranchName string) error
func (*BranchCommands) SetUpstream ¶
func (self *BranchCommands) SetUpstream(remoteName string, remoteBranchName string, branchName string) error
func (*BranchCommands) UnsetUpstream ¶ added in v0.35.0
func (self *BranchCommands) UnsetUpstream(branchName string) error
type CheckoutOptions ¶
Checkout checks out a branch (or commit), with --force if you set the force arg to true
type CommitCommands ¶
type CommitCommands struct {
*GitCommon
}
func NewCommitCommands ¶
func NewCommitCommands(gitCommon *GitCommon) *CommitCommands
func (*CommitCommands) AmendHead ¶
func (self *CommitCommands) AmendHead() error
AmendHead amends HEAD with whatever is staged in your working tree
func (*CommitCommands) AmendHeadCmdObj ¶
func (self *CommitCommands) AmendHeadCmdObj() oscommands.ICmdObj
func (*CommitCommands) CommitCmdObj ¶
func (self *CommitCommands) CommitCmdObj(message string) oscommands.ICmdObj
func (*CommitCommands) CommitEditorCmdObj ¶
func (self *CommitCommands) CommitEditorCmdObj() oscommands.ICmdObj
runs git commit without the -m argument meaning it will invoke the user's editor
func (*CommitCommands) CreateFixupCommit ¶
func (self *CommitCommands) CreateFixupCommit(sha string) error
CreateFixupCommit creates a commit that fixes up a previous commit
func (*CommitCommands) GetCommitAuthor ¶ added in v0.35.0
func (self *CommitCommands) GetCommitAuthor(commitSha string) (Author, error)
func (*CommitCommands) GetCommitDiff ¶ added in v0.35.0
func (self *CommitCommands) GetCommitDiff(commitSha string) (string, error)
func (*CommitCommands) GetCommitMessage ¶
func (self *CommitCommands) GetCommitMessage(commitSha string) (string, error)
func (*CommitCommands) GetCommitMessageFirstLine ¶
func (self *CommitCommands) GetCommitMessageFirstLine(sha string) (string, error)
func (*CommitCommands) GetCommitMessagesFirstLine ¶ added in v0.35.0
func (self *CommitCommands) GetCommitMessagesFirstLine(shas []string) (string, error)
func (*CommitCommands) GetCommitsOneline ¶ added in v0.35.0
func (self *CommitCommands) GetCommitsOneline(shas []string) (string, error)
func (*CommitCommands) GetHeadCommitMessage ¶
func (self *CommitCommands) GetHeadCommitMessage() (string, error)
Get the subject of the HEAD commit
func (*CommitCommands) ResetAuthor ¶ added in v0.35.0
func (self *CommitCommands) ResetAuthor() error
ResetAuthor resets the author of the topmost commit
func (*CommitCommands) ResetToCommit ¶
func (self *CommitCommands) ResetToCommit(sha string, strength string, envVars []string) error
ResetToCommit reset to commit
func (*CommitCommands) Revert ¶
func (self *CommitCommands) Revert(sha string) error
Revert reverts the selected commit by sha
func (*CommitCommands) RevertMerge ¶
func (self *CommitCommands) RevertMerge(sha string, parentNumber int) error
func (*CommitCommands) RewordLastCommit ¶
func (self *CommitCommands) RewordLastCommit(message string) error
RewordLastCommit rewords the topmost commit with the given message
func (*CommitCommands) SetAuthor ¶ added in v0.35.0
func (self *CommitCommands) SetAuthor(value string) error
Sets the commit's author to the supplied value. Value is expected to be of the form 'Name <Email>'
func (*CommitCommands) ShowCmdObj ¶
func (self *CommitCommands) ShowCmdObj(sha string, filterPath string) oscommands.ICmdObj
type ConfigCommands ¶
func NewConfigCommands ¶
func NewConfigCommands( common *common.Common, gitConfig git_config.IGitConfig, repo *gogit.Repository, ) *ConfigCommands
func (*ConfigCommands) Branches ¶
func (self *ConfigCommands) Branches() (map[string]*config.Branch, error)
returns the repo's branches as specified in the git config
func (*ConfigCommands) ConfiguredPager ¶
func (self *ConfigCommands) ConfiguredPager() string
func (*ConfigCommands) GetCoreEditor ¶
func (self *ConfigCommands) GetCoreEditor() string
func (*ConfigCommands) GetGitFlowPrefixes ¶
func (self *ConfigCommands) GetGitFlowPrefixes() string
func (*ConfigCommands) GetPager ¶
func (self *ConfigCommands) GetPager(width int) string
func (*ConfigCommands) GetPushToCurrent ¶
func (self *ConfigCommands) GetPushToCurrent() bool
this determines whether the user has configured to push to the remote branch of the same name as the current or not
func (*ConfigCommands) GetRemoteURL ¶
func (self *ConfigCommands) GetRemoteURL() string
GetRemoteURL returns current repo remote url
func (*ConfigCommands) GetShowUntrackedFiles ¶
func (self *ConfigCommands) GetShowUntrackedFiles() string
func (*ConfigCommands) UsingGpg ¶
func (self *ConfigCommands) UsingGpg() bool
UsingGpg tells us whether the user has gpg enabled so that we can know whether we need to run a subprocess to allow them to enter their password
type CustomCommands ¶
type CustomCommands struct {
*GitCommon
}
func NewCustomCommands ¶
func NewCustomCommands(gitCommon *GitCommon) *CustomCommands
func (*CustomCommands) RunWithOutput ¶
func (self *CustomCommands) RunWithOutput(cmdStr string) (string, error)
Only to be used for the sake of running custom commands specified by the user. If you want to run a new command, try finding a place for it in one of the neighbouring files, or creating a new BlahCommands struct to hold it.
type FetchOptions ¶
type FileCommands ¶
type FileCommands struct {
*GitCommon
}
func NewFileCommands ¶
func NewFileCommands(gitCommon *GitCommon) *FileCommands
func (*FileCommands) Cat ¶
func (self *FileCommands) Cat(fileName string) (string, error)
Cat obtains the content of a file
func (*FileCommands) GetEditCmdStr ¶
func (self *FileCommands) GetEditCmdStr(filename string, lineNumber int) (string, error)
type FlowCommands ¶
type FlowCommands struct {
*GitCommon
}
func NewFlowCommands ¶
func NewFlowCommands( gitCommon *GitCommon, ) *FlowCommands
func (*FlowCommands) FinishCmdObj ¶
func (self *FlowCommands) FinishCmdObj(branchName string) (oscommands.ICmdObj, error)
func (*FlowCommands) GitFlowEnabled ¶
func (self *FlowCommands) GitFlowEnabled() bool
func (*FlowCommands) StartCmdObj ¶
func (self *FlowCommands) StartCmdObj(branchType string, name string) oscommands.ICmdObj
type GitCommon ¶ added in v0.35.0
func NewGitCommon ¶ added in v0.35.0
func NewGitCommon( cmn *common.Common, cmd oscommands.ICmdObjBuilder, osCommand *oscommands.OSCommand, dotGitDir string, repo *gogit.Repository, config *ConfigCommands, syncMutex *sync.Mutex, ) *GitCommon
type PatchCommands ¶
type PatchCommands struct { *GitCommon PatchManager *patch.PatchManager // contains filtered or unexported fields }
func NewPatchCommands ¶
func NewPatchCommands( gitCommon *GitCommon, rebase *RebaseCommands, commit *CommitCommands, status *StatusCommands, stash *StashCommands, patchManager *patch.PatchManager, ) *PatchCommands
func (*PatchCommands) DeletePatchesFromCommit ¶
func (self *PatchCommands) DeletePatchesFromCommit(commits []*models.Commit, commitIndex int) error
DeletePatchesFromCommit applies a patch in reverse for a commit
func (*PatchCommands) MovePatchIntoIndex ¶
func (*PatchCommands) MovePatchToSelectedCommit ¶
func (*PatchCommands) PullPatchIntoNewCommit ¶
func (self *PatchCommands) PullPatchIntoNewCommit(commits []*models.Commit, commitIdx int) error
type PullOptions ¶
type RebaseCommands ¶
type RebaseCommands struct { *GitCommon // contains filtered or unexported fields }
func NewRebaseCommands ¶
func NewRebaseCommands( gitCommon *GitCommon, commitCommands *CommitCommands, workingTreeCommands *WorkingTreeCommands, ) *RebaseCommands
func (*RebaseCommands) AbortRebase ¶
func (self *RebaseCommands) AbortRebase() error
func (*RebaseCommands) AmendTo ¶
func (self *RebaseCommands) AmendTo(sha string) error
AmendTo amends the given commit with whatever files are staged
func (*RebaseCommands) BeginInteractiveRebaseForCommit ¶
func (self *RebaseCommands) BeginInteractiveRebaseForCommit(commits []*models.Commit, commitIndex int) error
BeginInteractiveRebaseForCommit starts an interactive rebase to edit the current commit and pick all others. After this you'll want to call `self.ContinueRebase()
func (*RebaseCommands) BuildSingleActionTodo ¶ added in v0.35.0
func (self *RebaseCommands) BuildSingleActionTodo(commits []*models.Commit, actionIndex int, action string) ([]TodoLine, string, error)
produces TodoLines where every commit is picked (or dropped for merge commits) except for the commit at the given index, which will have the given action applied to it.
func (*RebaseCommands) BuildTodoLines ¶ added in v0.35.0
func (*RebaseCommands) BuildTodoLinesSingleAction ¶ added in v0.35.0
func (self *RebaseCommands) BuildTodoLinesSingleAction(commits []*models.Commit, action string) []TodoLine
func (*RebaseCommands) CherryPickCommits ¶
func (self *RebaseCommands) CherryPickCommits(commits []*models.Commit) error
CherryPickCommits begins an interactive rebase with the given shas being cherry picked onto HEAD
func (*RebaseCommands) ContinueRebase ¶
func (self *RebaseCommands) ContinueRebase() error
func (*RebaseCommands) DiscardOldFileChanges ¶
func (self *RebaseCommands) DiscardOldFileChanges(commits []*models.Commit, commitIndex int, fileName string) error
DiscardOldFileChanges discards changes to a file from an old commit
func (*RebaseCommands) EditRebaseTodo ¶
func (self *RebaseCommands) EditRebaseTodo(index int, action string) error
EditRebaseTodo sets the action at a given index in the git-rebase-todo file
func (*RebaseCommands) GenericAmend ¶ added in v0.35.0
func (*RebaseCommands) GenericMergeOrRebaseAction ¶
func (self *RebaseCommands) GenericMergeOrRebaseAction(commandType string, command string) error
GenericMerge takes a commandType of "merge" or "rebase" and a command of "abort", "skip" or "continue" By default we skip the editor in the case where a commit will be made
func (*RebaseCommands) GenericMergeOrRebaseActionCmdObj ¶
func (self *RebaseCommands) GenericMergeOrRebaseActionCmdObj(commandType string, command string) oscommands.ICmdObj
func (*RebaseCommands) InteractiveRebase ¶
func (*RebaseCommands) MoveCommitDown ¶
func (self *RebaseCommands) MoveCommitDown(commits []*models.Commit, index int) error
func (*RebaseCommands) MoveTodoDown ¶
func (self *RebaseCommands) MoveTodoDown(index int) error
MoveTodoDown moves a rebase todo item down by one position
func (*RebaseCommands) PrepareInteractiveRebaseCommand ¶
func (self *RebaseCommands) PrepareInteractiveRebaseCommand(baseSha string, todoLines []TodoLine, overrideEditor bool) oscommands.ICmdObj
PrepareInteractiveRebaseCommand returns the cmd for an interactive rebase we tell git to run lazygit to edit the todo list, and we pass the client lazygit a todo string to write to the todo file
func (*RebaseCommands) RebaseBranch ¶
func (self *RebaseCommands) RebaseBranch(branchName string) error
RebaseBranch interactive rebases onto a branch
func (*RebaseCommands) ResetCommitAuthor ¶ added in v0.35.0
func (self *RebaseCommands) ResetCommitAuthor(commits []*models.Commit, index int) error
func (*RebaseCommands) RewordCommit ¶
func (*RebaseCommands) RewordCommitInEditor ¶
func (self *RebaseCommands) RewordCommitInEditor(commits []*models.Commit, index int) (oscommands.ICmdObj, error)
func (*RebaseCommands) SetCommitAuthor ¶ added in v0.35.0
func (*RebaseCommands) SquashAllAboveFixupCommits ¶
func (self *RebaseCommands) SquashAllAboveFixupCommits(sha string) error
SquashAllAboveFixupCommits squashes all fixup! commits above the given one
type RemoteCommands ¶
type RemoteCommands struct {
*GitCommon
}
func NewRemoteCommands ¶
func NewRemoteCommands(gitCommon *GitCommon) *RemoteCommands
func (*RemoteCommands) AddRemote ¶
func (self *RemoteCommands) AddRemote(name string, url string) error
func (*RemoteCommands) CheckRemoteBranchExists ¶
func (self *RemoteCommands) CheckRemoteBranchExists(branchName string) bool
CheckRemoteBranchExists Returns remote branch
func (*RemoteCommands) DeleteRemoteBranch ¶
func (self *RemoteCommands) DeleteRemoteBranch(remoteName string, branchName string) error
func (*RemoteCommands) RemoveRemote ¶
func (self *RemoteCommands) RemoveRemote(name string) error
func (*RemoteCommands) RenameRemote ¶
func (self *RemoteCommands) RenameRemote(oldRemoteName string, newRemoteName string) error
func (*RemoteCommands) UpdateRemoteUrl ¶
func (self *RemoteCommands) UpdateRemoteUrl(remoteName string, updatedUrl string) error
type StashCommands ¶
type StashCommands struct { *GitCommon // contains filtered or unexported fields }
func NewStashCommands ¶
func NewStashCommands( gitCommon *GitCommon, fileLoader *loaders.FileLoader, workingTree *WorkingTreeCommands, ) *StashCommands
func (*StashCommands) Apply ¶
func (self *StashCommands) Apply(index int) error
func (*StashCommands) Drop ¶
func (self *StashCommands) Drop(index int) error
func (*StashCommands) DropNewest ¶ added in v0.35.0
func (self *StashCommands) DropNewest() error
func (*StashCommands) Pop ¶
func (self *StashCommands) Pop(index int) error
func (*StashCommands) SaveStagedChanges ¶
func (self *StashCommands) SaveStagedChanges(message string) error
SaveStagedChanges stashes only the currently staged changes. This takes a few steps shoutouts to Joe on https://stackoverflow.com/questions/14759748/stashing-only-staged-changes-in-git-is-it-possible
func (*StashCommands) ShowStashEntryCmdObj ¶
func (self *StashCommands) ShowStashEntryCmdObj(index int) oscommands.ICmdObj
func (*StashCommands) StashAndKeepIndex ¶ added in v0.35.0
func (self *StashCommands) StashAndKeepIndex(message string) error
func (*StashCommands) StashUnstagedChanges ¶ added in v0.35.0
func (self *StashCommands) StashUnstagedChanges(message string) error
type StatusCommands ¶
type StatusCommands struct {
*GitCommon
}
func NewStatusCommands ¶
func NewStatusCommands( gitCommon *GitCommon, ) *StatusCommands
func (*StatusCommands) IsBareRepo ¶
func (self *StatusCommands) IsBareRepo() bool
func (*StatusCommands) IsInMergeState ¶
func (self *StatusCommands) IsInMergeState() (bool, error)
IsInMergeState states whether we are still mid-merge
func (*StatusCommands) RebaseMode ¶
func (self *StatusCommands) RebaseMode() (enums.RebaseMode, error)
RebaseMode returns "" for non-rebase mode, "normal" for normal rebase and "interactive" for interactive rebase
func (*StatusCommands) WorkingTreeState ¶
func (self *StatusCommands) WorkingTreeState() enums.RebaseMode
type SubmoduleCommands ¶
type SubmoduleCommands struct {
*GitCommon
}
func NewSubmoduleCommands ¶
func NewSubmoduleCommands(gitCommon *GitCommon) *SubmoduleCommands
func (*SubmoduleCommands) Add ¶
func (self *SubmoduleCommands) Add(name string, path string, url string) error
func (*SubmoduleCommands) BulkDeinitCmdObj ¶
func (self *SubmoduleCommands) BulkDeinitCmdObj() oscommands.ICmdObj
func (*SubmoduleCommands) BulkInitCmdObj ¶
func (self *SubmoduleCommands) BulkInitCmdObj() oscommands.ICmdObj
func (*SubmoduleCommands) BulkUpdateCmdObj ¶
func (self *SubmoduleCommands) BulkUpdateCmdObj() oscommands.ICmdObj
func (*SubmoduleCommands) Delete ¶
func (self *SubmoduleCommands) Delete(submodule *models.SubmoduleConfig) error
func (*SubmoduleCommands) ForceBulkUpdateCmdObj ¶
func (self *SubmoduleCommands) ForceBulkUpdateCmdObj() oscommands.ICmdObj
func (*SubmoduleCommands) GetConfigs ¶
func (self *SubmoduleCommands) GetConfigs() ([]*models.SubmoduleConfig, error)
func (*SubmoduleCommands) Init ¶
func (self *SubmoduleCommands) Init(path string) error
func (*SubmoduleCommands) Reset ¶
func (self *SubmoduleCommands) Reset(submodule *models.SubmoduleConfig) error
func (*SubmoduleCommands) ResetSubmodules ¶
func (self *SubmoduleCommands) ResetSubmodules(submodules []*models.SubmoduleConfig) error
func (*SubmoduleCommands) Stash ¶
func (self *SubmoduleCommands) Stash(submodule *models.SubmoduleConfig) error
func (*SubmoduleCommands) Update ¶
func (self *SubmoduleCommands) Update(path string) error
func (*SubmoduleCommands) UpdateAll ¶
func (self *SubmoduleCommands) UpdateAll() error
type SyncCommands ¶
type SyncCommands struct {
*GitCommon
}
func NewSyncCommands ¶
func NewSyncCommands(gitCommon *GitCommon) *SyncCommands
func (*SyncCommands) FastForward ¶
func (self *SyncCommands) FastForward(branchName string, remoteName string, remoteBranchName string) error
func (*SyncCommands) Fetch ¶
func (self *SyncCommands) Fetch(opts FetchOptions) error
Fetch fetch git repo
func (*SyncCommands) FetchRemote ¶
func (self *SyncCommands) FetchRemote(remoteName string) error
func (*SyncCommands) Pull ¶
func (self *SyncCommands) Pull(opts PullOptions) error
func (*SyncCommands) Push ¶
func (self *SyncCommands) Push(opts PushOpts) error
func (*SyncCommands) PushCmdObj ¶
func (self *SyncCommands) PushCmdObj(opts PushOpts) (oscommands.ICmdObj, error)
type TagCommands ¶
type TagCommands struct {
*GitCommon
}
func NewTagCommands ¶
func NewTagCommands(gitCommon *GitCommon) *TagCommands
func (*TagCommands) CreateAnnotated ¶
func (self *TagCommands) CreateAnnotated(tagName, commitSha, msg string) error
func (*TagCommands) CreateLightweight ¶
func (self *TagCommands) CreateLightweight(tagName string, commitSha string) error
func (*TagCommands) Delete ¶
func (self *TagCommands) Delete(tagName string) error
type WorkingTreeCommands ¶
type WorkingTreeCommands struct { *GitCommon // contains filtered or unexported fields }
func NewWorkingTreeCommands ¶
func NewWorkingTreeCommands( gitCommon *GitCommon, submodule *SubmoduleCommands, fileLoader *loaders.FileLoader, ) *WorkingTreeCommands
func (*WorkingTreeCommands) ApplyPatch ¶
func (self *WorkingTreeCommands) ApplyPatch(patch string, flags ...string) error
func (*WorkingTreeCommands) ApplyPatchFile ¶ added in v0.35.0
func (self *WorkingTreeCommands) ApplyPatchFile(filepath string, flags ...string) error
func (*WorkingTreeCommands) BeforeAndAfterFileForRename ¶
func (*WorkingTreeCommands) CheckoutFile ¶
func (self *WorkingTreeCommands) CheckoutFile(commitSha, fileName string) error
CheckoutFile checks out the file for the given commit
func (*WorkingTreeCommands) DiscardAllDirChanges ¶
func (self *WorkingTreeCommands) DiscardAllDirChanges(node IFileNode) error
func (*WorkingTreeCommands) DiscardAllFileChanges ¶
func (self *WorkingTreeCommands) DiscardAllFileChanges(file *models.File) error
DiscardAllFileChanges directly
func (*WorkingTreeCommands) DiscardAnyUnstagedFileChanges ¶
func (self *WorkingTreeCommands) DiscardAnyUnstagedFileChanges() error
DiscardAnyUnstagedFileChanges discards any unstages file changes via `git checkout -- .`
func (*WorkingTreeCommands) DiscardUnstagedDirChanges ¶
func (self *WorkingTreeCommands) DiscardUnstagedDirChanges(node IFileNode) error
func (*WorkingTreeCommands) DiscardUnstagedFileChanges ¶
func (self *WorkingTreeCommands) DiscardUnstagedFileChanges(file *models.File) error
DiscardUnstagedFileChanges directly
func (*WorkingTreeCommands) Exclude ¶ added in v0.35.0
func (self *WorkingTreeCommands) Exclude(filename string) error
Exclude adds a file to the .git/info/exclude for the repo
func (*WorkingTreeCommands) Ignore ¶
func (self *WorkingTreeCommands) Ignore(filename string) error
Ignore adds a file to the gitignore for the repo
func (*WorkingTreeCommands) OpenMergeTool ¶
func (self *WorkingTreeCommands) OpenMergeTool() error
func (*WorkingTreeCommands) OpenMergeToolCmdObj ¶
func (self *WorkingTreeCommands) OpenMergeToolCmdObj() oscommands.ICmdObj
func (*WorkingTreeCommands) RemoveTrackedFiles ¶
func (self *WorkingTreeCommands) RemoveTrackedFiles(name string) error
RemoveTrackedFiles will delete the given file(s) even if they are currently tracked
func (*WorkingTreeCommands) RemoveUntrackedDirFiles ¶
func (self *WorkingTreeCommands) RemoveUntrackedDirFiles(node IFileNode) error
func (*WorkingTreeCommands) RemoveUntrackedFiles ¶
func (self *WorkingTreeCommands) RemoveUntrackedFiles() error
RemoveUntrackedFiles runs `git clean -fd`
func (*WorkingTreeCommands) ResetAndClean ¶
func (self *WorkingTreeCommands) ResetAndClean() error
ResetAndClean removes all unstaged changes and removes all untracked files
func (*WorkingTreeCommands) ResetHard ¶
func (self *WorkingTreeCommands) ResetHard(ref string) error
ResetHardHead runs `git reset --hard`
func (*WorkingTreeCommands) ResetMixed ¶
func (self *WorkingTreeCommands) ResetMixed(ref string) error
func (*WorkingTreeCommands) ResetSoft ¶
func (self *WorkingTreeCommands) ResetSoft(ref string) error
ResetSoft runs `git reset --soft HEAD`
func (*WorkingTreeCommands) SaveTemporaryPatch ¶ added in v0.35.0
func (self *WorkingTreeCommands) SaveTemporaryPatch(patch string) (string, error)
func (*WorkingTreeCommands) ShowFileDiff ¶
func (self *WorkingTreeCommands) ShowFileDiff(from string, to string, reverse bool, fileName string, plain bool) (string, error)
ShowFileDiff get the diff of specified from and to. Typically this will be used for a single commit so it'll be 123abc^..123abc but when we're in diff mode it could be any 'from' to any 'to'. The reverse flag is also here thanks to diff mode.
func (*WorkingTreeCommands) ShowFileDiffCmdObj ¶
func (self *WorkingTreeCommands) ShowFileDiffCmdObj(from string, to string, reverse bool, fileName string, plain bool) oscommands.ICmdObj
func (*WorkingTreeCommands) StageAll ¶
func (self *WorkingTreeCommands) StageAll() error
StageAll stages all files
func (*WorkingTreeCommands) StageFile ¶
func (self *WorkingTreeCommands) StageFile(path string) error
StageFile stages a file
func (*WorkingTreeCommands) StageFiles ¶ added in v0.35.0
func (self *WorkingTreeCommands) StageFiles(paths []string) error
func (*WorkingTreeCommands) UnStageFile ¶
func (self *WorkingTreeCommands) UnStageFile(fileNames []string, reset bool) error
UnStageFile unstages a file we accept an array of filenames for the cases where a file has been renamed i.e. we accept the current name and the previous name
func (*WorkingTreeCommands) UnstageAll ¶
func (self *WorkingTreeCommands) UnstageAll() error
UnstageAll unstages all files
func (*WorkingTreeCommands) WorktreeFileDiff ¶
func (self *WorkingTreeCommands) WorktreeFileDiff(file *models.File, plain bool, cached bool, ignoreWhitespace bool) string
WorktreeFileDiff returns the diff of a file
func (*WorkingTreeCommands) WorktreeFileDiffCmdObj ¶
func (self *WorkingTreeCommands) WorktreeFileDiffCmdObj(node models.IFile, plain bool, cached bool, ignoreWhitespace bool) oscommands.ICmdObj