Documentation ¶
Index ¶
- Variables
- func AddCoAuthorToDescription(description string, author string) string
- func AddCoAuthorToMessage(message string, author string) string
- func CheckedOutByOtherWorktree(branch *models.Branch, worktrees []*models.Worktree) bool
- func IsBareRepo(osCommand *oscommands.OSCommand) (bool, error)
- func WorktreeForBranch(branch *models.Branch, worktrees []*models.Worktree) (*models.Worktree, bool)
- type ApplyPatchOpts
- type Author
- type BisectCommands
- func (self *BisectCommands) GetInfo() *BisectInfo
- func (self *BisectCommands) GetInfoForGitDir(gitDir string) *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
- func (self *BisectCommands) StartWithTerms(oldTerm string, newTerm string) 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 BlameCommands
- type BranchCommands
- func (self *BranchCommands) AllBranchesLogCmdObj() oscommands.ICmdObj
- func (self *BranchCommands) Checkout(branch string, options CheckoutOptions) error
- func (self *BranchCommands) CreateWithUpstream(name string, upstream string) error
- func (self *BranchCommands) CurrentBranchInfo() (BranchInfo, error)
- func (self *BranchCommands) CurrentBranchName() (string, 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) GetUpstreamDifferenceCount(branchName string) (string, string)
- func (self *BranchCommands) IsHeadDetached() bool
- func (self *BranchCommands) LocalDelete(branch string, force bool) error
- 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 BranchInfo
- type BranchLoader
- type BranchLoaderConfigCommands
- type CheckoutOptions
- type CommitCommands
- func (self *CommitCommands) AddCoAuthor(sha string, author string) error
- func (self *CommitCommands) AmendHead() error
- func (self *CommitCommands) AmendHeadCmdObj() oscommands.ICmdObj
- func (self *CommitCommands) CommitCmdObj(summary string, description string) oscommands.ICmdObj
- func (self *CommitCommands) CommitEditorCmdObj() oscommands.ICmdObj
- func (self *CommitCommands) CommitInEditorWithMessageFileCmdObj(tmpMessageFile string) oscommands.ICmdObj
- func (self *CommitCommands) CreateAmendCommit(originalSubject, newSubject, newDescription string, includeFileChanges bool) error
- 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) GetCommitMessageFromHistory(value int) (string, error)
- func (self *CommitCommands) GetCommitMessagesFirstLine(shas []string) (string, error)
- func (self *CommitCommands) GetCommitSubject(commitSha string) (string, error)
- func (self *CommitCommands) GetCommitsOneline(shas []string) (string, error)
- func (self *CommitCommands) GetShasAndCommitMessagesFirstLine(shas []string) (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(summary string, description string) error
- func (self *CommitCommands) RewordLastCommitInEditorCmdObj() oscommands.ICmdObj
- func (self *CommitCommands) RewordLastCommitInEditorWithMessageFileCmdObj(tmpMessageFile string) oscommands.ICmdObj
- func (self *CommitCommands) SetAuthor(value string) error
- func (self *CommitCommands) ShowCmdObj(sha string, filterPath string) oscommands.ICmdObj
- type CommitFileLoader
- type CommitLoader
- type ConfigCommands
- func (self *ConfigCommands) Branches() (map[string]*config.Branch, error)
- func (self *ConfigCommands) ConfiguredPager() string
- func (self *ConfigCommands) GetCoreCommentChar() byte
- 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) GetRebaseUpdateRefs() bool
- func (self *ConfigCommands) GetRemoteURL() string
- func (self *ConfigCommands) GetShowUntrackedFiles() string
- func (self *ConfigCommands) UsingGpg() bool
- type CustomCommands
- type DiffCommands
- func (self *DiffCommands) DiffCmdObj(diffArgs []string) oscommands.ICmdObj
- func (self *DiffCommands) DiffIndexCmdObj(diffArgs ...string) oscommands.ICmdObj
- func (self *DiffCommands) GetAllDiff(staged bool) (string, error)
- func (self *DiffCommands) GetPathDiff(path string, staged bool) (string, error)
- func (self *DiffCommands) OpenDiffToolCmdObj(opts DiffToolCmdOptions) oscommands.ICmdObj
- type DiffToolCmdOptions
- type FileCommands
- func (self *FileCommands) Cat(fileName string) (string, error)
- func (self *FileCommands) GetEditAtLineAndWaitCmdStr(filename string, lineNumber int) string
- func (self *FileCommands) GetEditAtLineCmdStr(filename string, lineNumber int) (string, bool)
- func (self *FileCommands) GetEditCmdStr(filenames []string) (string, bool)
- func (self *FileCommands) GetEditCmdStrLegacy(filename string, lineNumber int) (string, error)
- func (self *FileCommands) GetOpenDirInEditorCmdStr(path string) (string, bool)
- type FileLoader
- type FileLoaderConfig
- type FileStatus
- type FlowCommands
- type GetCommitsOptions
- type GetStatusFileOptions
- type GitCommandBuilder
- func (self *GitCommandBuilder) Arg(args ...string) *GitCommandBuilder
- func (self *GitCommandBuilder) ArgIf(condition bool, ifTrue ...string) *GitCommandBuilder
- func (self *GitCommandBuilder) ArgIfElse(condition bool, ifTrue string, ifFalse string) *GitCommandBuilder
- func (self *GitCommandBuilder) Config(value string) *GitCommandBuilder
- func (self *GitCommandBuilder) ConfigIf(condition bool, ifTrue string) *GitCommandBuilder
- func (self *GitCommandBuilder) Dir(path string) *GitCommandBuilder
- func (self *GitCommandBuilder) DirIf(condition bool, path string) *GitCommandBuilder
- func (self *GitCommandBuilder) GitDir(path string) *GitCommandBuilder
- func (self *GitCommandBuilder) GitDirIf(condition bool, path string) *GitCommandBuilder
- func (self *GitCommandBuilder) ToArgv() []string
- func (self *GitCommandBuilder) ToString() string
- func (self *GitCommandBuilder) Worktree(path string) *GitCommandBuilder
- type GitCommon
- type GitStatusOptions
- type GitVersion
- type IFileNode
- type MergeOpts
- type NewWorktreeOpts
- type PatchCommands
- func (self *PatchCommands) ApplyCustomPatch(reverse bool) error
- func (self *PatchCommands) ApplyPatch(patch string, opts ApplyPatchOpts) error
- 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, commitSummary string, ...) error
- func (self *PatchCommands) SaveTemporaryPatch(patch string) (string, error)
- type PrepareInteractiveRebaseCommandOpts
- type PullOptions
- type PushOpts
- type RebaseCommands
- func (self *RebaseCommands) AbortRebase() error
- func (self *RebaseCommands) AddCommitCoAuthor(commits []*models.Commit, index int, value string) error
- func (self *RebaseCommands) AmendTo(commits []*models.Commit, commitIndex int) error
- func (self *RebaseCommands) BeginInteractiveRebaseForCommit(commits []*models.Commit, commitIndex int, keepCommitsThatBecomeEmpty bool) error
- func (self *RebaseCommands) CherryPickCommits(commits []*models.Commit) error
- func (self *RebaseCommands) CherryPickCommitsDuringRebase(commits []*models.Commit) error
- func (self *RebaseCommands) ContinueRebase() error
- func (self *RebaseCommands) DeleteUpdateRefTodos(commits []*models.Commit) error
- func (self *RebaseCommands) DiscardOldFileChanges(commits []*models.Commit, commitIndex int, filePaths []string) error
- func (self *RebaseCommands) EditRebase(branchRef string) error
- func (self *RebaseCommands) EditRebaseFromBaseCommit(targetBranchName string, baseCommit string) error
- func (self *RebaseCommands) EditRebaseTodo(commits []*models.Commit, action todo.TodoCommand) 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) GitRebaseEditTodo(todosFileContent []byte) error
- func (self *RebaseCommands) InteractiveRebase(commits []*models.Commit, startIdx int, endIdx int, action todo.TodoCommand) error
- func (self *RebaseCommands) MoveCommitsDown(commits []*models.Commit, startIdx int, endIdx int) error
- func (self *RebaseCommands) MoveCommitsUp(commits []*models.Commit, startIdx int, endIdx int) error
- func (self *RebaseCommands) MoveTodosDown(commits []*models.Commit) error
- func (self *RebaseCommands) MoveTodosUp(commits []*models.Commit) error
- func (self *RebaseCommands) PrepareInteractiveRebaseCommand(opts PrepareInteractiveRebaseCommandOpts) oscommands.ICmdObj
- func (self *RebaseCommands) RebaseBranch(branchName string) error
- func (self *RebaseCommands) RebaseBranchFromBaseCommit(targetBranchName string, baseCommit string) error
- func (self *RebaseCommands) ResetCommitAuthor(commits []*models.Commit, index int) error
- func (self *RebaseCommands) RewordCommit(commits []*models.Commit, index int, summary string, description 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(commit *models.Commit) error
- type ReflogCommitLoader
- type RemoteCommands
- func (self *RemoteCommands) AddRemote(name string, url string) error
- func (self *RemoteCommands) CheckRemoteBranchExists(branchName string) bool
- func (self *RemoteCommands) DeleteRemoteBranch(task gocui.Task, remoteName string, branchName string) error
- func (self *RemoteCommands) DeleteRemoteTag(task gocui.Task, remoteName string, tagName string) error
- func (self *RemoteCommands) GetRemoteURL(remoteName string) (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 RemoteLoader
- type RepoPaths
- 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) Push(message string) error
- func (self *StashCommands) Rename(index int, message string) error
- func (self *StashCommands) SaveStagedChanges(message string) error
- func (self *StashCommands) Sha(index int) (string, error)
- func (self *StashCommands) ShowStashEntryCmdObj(index int) oscommands.ICmdObj
- func (self *StashCommands) StashAndKeepIndex(message string) error
- func (self *StashCommands) StashIncludeUntrackedChanges(message string) error
- func (self *StashCommands) StashUnstagedChanges(message string) error
- func (self *StashCommands) Store(sha string, message string) error
- type StashLoader
- type StatusCommands
- func (self *StatusCommands) BranchBeingRebased() string
- func (self *StatusCommands) IsBareRepo() (bool, error)
- func (self *StatusCommands) IsInInteractiveRebase() (bool, error)
- func (self *StatusCommands) IsInMergeState() (bool, error)
- func (self *StatusCommands) IsInNormalRebase() (bool, error)
- func (self *StatusCommands) RebaseMode() (enums.RebaseMode, error)
- func (self *StatusCommands) WorkingTreeState() enums.RebaseMode
- 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(parentModule *models.SubmoduleConfig) ([]*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(submodule *models.SubmoduleConfig, newUrl string) error
- type SyncCommands
- func (self *SyncCommands) FastForward(task gocui.Task, branchName string, remoteName string, remoteBranchName string) error
- func (self *SyncCommands) Fetch(task gocui.Task) error
- func (self *SyncCommands) FetchBackground() error
- func (self *SyncCommands) FetchBackgroundCmdObj() oscommands.ICmdObj
- func (self *SyncCommands) FetchCmdObj(task gocui.Task) oscommands.ICmdObj
- func (self *SyncCommands) FetchRemote(task gocui.Task, remoteName string) error
- func (self *SyncCommands) Pull(task gocui.Task, opts PullOptions) error
- func (self *SyncCommands) Push(task gocui.Task, opts PushOpts) error
- func (self *SyncCommands) PushCmdObj(task gocui.Task, opts PushOpts) (oscommands.ICmdObj, error)
- type TagCommands
- func (self *TagCommands) CreateAnnotated(tagName, ref, msg string, force bool) error
- func (self *TagCommands) CreateLightweight(tagName string, ref string, force bool) error
- func (self *TagCommands) HasTag(tagName string) bool
- func (self *TagCommands) LocalDelete(tagName string) error
- func (self *TagCommands) Push(task gocui.Task, remoteName string, tagName string) error
- type TagLoader
- type WorkingTreeCommands
- 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) 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) 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(paths []string, tracked bool) error
- func (self *WorkingTreeCommands) UnstageAll() error
- func (self *WorkingTreeCommands) UnstageTrackedFiles(paths []string) error
- func (self *WorkingTreeCommands) UnstageUntrackedFiles(paths []string) error
- func (self *WorkingTreeCommands) WorktreeFileDiff(file *models.File, plain bool, cached bool) string
- func (self *WorkingTreeCommands) WorktreeFileDiffCmdObj(node models.IFile, plain bool, cached bool) oscommands.ICmdObj
- type WorktreeCommands
- type WorktreeLoader
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidCommitIndex = errors.New("invalid commit index")
Functions ¶
func AddCoAuthorToMessage ¶
func IsBareRepo ¶
func IsBareRepo(osCommand *oscommands.OSCommand) (bool, error)
Types ¶
type ApplyPatchOpts ¶
type BisectCommands ¶
type BisectCommands struct {
*GitCommon
}
func NewBisectCommands ¶
func NewBisectCommands(gitCommon *GitCommon) *BisectCommands
func (*BisectCommands) GetInfo ¶
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) GetInfoForGitDir ¶
func (self *BisectCommands) GetInfoForGitDir(gitDir string) *BisectInfo
func (*BisectCommands) IsDone ¶
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) ReachableFromStart ¶
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 ¶
func (self *BisectCommands) Reset() error
func (*BisectCommands) Skip ¶
func (self *BisectCommands) Skip(ref string) error
func (*BisectCommands) Start ¶
func (self *BisectCommands) Start() error
func (*BisectCommands) StartWithTerms ¶
func (self *BisectCommands) StartWithTerms(oldTerm string, newTerm string) error
type BisectInfo ¶
type BisectInfo struct {
// contains filtered or unexported fields
}
func (*BisectInfo) Bisecting ¶
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 ¶
func (self *BisectInfo) GetCurrentSha() string
func (*BisectInfo) GetNewSha ¶
func (self *BisectInfo) GetNewSha() string
func (*BisectInfo) GetStartSha ¶
func (self *BisectInfo) GetStartSha() string
func (*BisectInfo) NewTerm ¶
func (self *BisectInfo) NewTerm() string
func (*BisectInfo) OldTerm ¶
func (self *BisectInfo) OldTerm() string
func (*BisectInfo) Started ¶
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 ¶
func (self *BisectInfo) Status(commitSha string) (BisectStatus, bool)
type BisectStatus ¶
type BisectStatus int
const ( BisectStatusOld BisectStatus = iota BisectStatusNew BisectStatusSkipped )
type BlameCommands ¶
type BlameCommands struct {
*GitCommon
}
func NewBlameCommands ¶
func NewBlameCommands(gitCommon *GitCommon) *BlameCommands
func (*BlameCommands) BlameLineRange ¶
func (self *BlameCommands) BlameLineRange(filename string, commit string, firstLine int, numLines int) (string, error)
Blame a range of lines. For each line, output the hash of the commit where the line last changed, then a space, then a description of the commit (author and date), another space, and then the line. For example:
ac90ebac688fe8bc2ffd922157a9d2c54681d2aa (Stefan Haller 2023-08-01 14:54:56 +0200 11) func NewBlameCommands(gitCommon *GitCommon) *BlameCommands { ac90ebac688fe8bc2ffd922157a9d2c54681d2aa (Stefan Haller 2023-08-01 14:54:56 +0200 12) return &BlameCommands{ ac90ebac688fe8bc2ffd922157a9d2c54681d2aa (Stefan Haller 2023-08-01 14:54:56 +0200 13) GitCommon: gitCommon,
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) CreateWithUpstream ¶
func (self *BranchCommands) CreateWithUpstream(name string, upstream string) error
CreateWithUpstream creates a new branch with a given upstream, but without checking it out
func (*BranchCommands) CurrentBranchInfo ¶
func (self *BranchCommands) CurrentBranchInfo() (BranchInfo, error)
CurrentBranchInfo get the current branch information.
func (*BranchCommands) CurrentBranchName ¶
func (self *BranchCommands) CurrentBranchName() (string, error)
CurrentBranchName get name of current 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) GetUpstreamDifferenceCount ¶
func (self *BranchCommands) GetUpstreamDifferenceCount(branchName string) (string, string)
func (*BranchCommands) IsHeadDetached ¶
func (self *BranchCommands) IsHeadDetached() bool
func (*BranchCommands) LocalDelete ¶
func (self *BranchCommands) LocalDelete(branch string, force bool) error
LocalDelete delete branch locally
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 ¶
func (self *BranchCommands) UnsetUpstream(branchName string) error
type BranchInfo ¶
type BranchLoader ¶
BranchLoader returns a list of Branch objects for the current repo
func NewBranchLoader ¶
func NewBranchLoader( cmn *common.Common, cmd oscommands.ICmdObjBuilder, getCurrentBranchInfo func() (BranchInfo, error), config BranchLoaderConfigCommands, ) *BranchLoader
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) AddCoAuthor ¶
func (self *CommitCommands) AddCoAuthor(sha string, author string) error
Add a commit's coauthor using Github/Gitlab Co-authored-by metadata. Value is expected to be of the form 'Name <Email>'
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(summary string, description 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) CommitInEditorWithMessageFileCmdObj ¶
func (self *CommitCommands) CommitInEditorWithMessageFileCmdObj(tmpMessageFile string) oscommands.ICmdObj
func (*CommitCommands) CreateAmendCommit ¶
func (self *CommitCommands) CreateAmendCommit(originalSubject, newSubject, newDescription string, includeFileChanges bool) error
CreateAmendCommit creates a commit that changes the commit message of a previous commit
func (*CommitCommands) CreateFixupCommit ¶
func (self *CommitCommands) CreateFixupCommit(sha string) error
CreateFixupCommit creates a commit that fixes up a previous commit
func (*CommitCommands) GetCommitAuthor ¶
func (self *CommitCommands) GetCommitAuthor(commitSha string) (Author, error)
func (*CommitCommands) GetCommitDiff ¶
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) GetCommitMessageFromHistory ¶
func (self *CommitCommands) GetCommitMessageFromHistory(value int) (string, error)
a value of 0 means the head commit, 1 is the parent commit, etc
func (*CommitCommands) GetCommitMessagesFirstLine ¶
func (self *CommitCommands) GetCommitMessagesFirstLine(shas []string) (string, error)
func (*CommitCommands) GetCommitSubject ¶
func (self *CommitCommands) GetCommitSubject(commitSha string) (string, error)
func (*CommitCommands) GetCommitsOneline ¶
func (self *CommitCommands) GetCommitsOneline(shas []string) (string, error)
func (*CommitCommands) GetShasAndCommitMessagesFirstLine ¶
func (self *CommitCommands) GetShasAndCommitMessagesFirstLine(shas []string) (string, error)
Example output:
cd50c79ae Preserve the commit message correctly even if the description has blank lines 3ebba5f32 Add test demonstrating a bug with preserving the commit message 9a423c388 Remove unused function
func (*CommitCommands) ResetAuthor ¶
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(summary string, description string) error
RewordLastCommit rewords the topmost commit with the given message
func (*CommitCommands) RewordLastCommitInEditorCmdObj ¶
func (self *CommitCommands) RewordLastCommitInEditorCmdObj() oscommands.ICmdObj
func (*CommitCommands) RewordLastCommitInEditorWithMessageFileCmdObj ¶
func (self *CommitCommands) RewordLastCommitInEditorWithMessageFileCmdObj(tmpMessageFile string) oscommands.ICmdObj
func (*CommitCommands) SetAuthor ¶
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 CommitFileLoader ¶
func NewCommitFileLoader ¶
func NewCommitFileLoader(common *common.Common, cmd oscommands.ICmdObjBuilder) *CommitFileLoader
func (*CommitFileLoader) GetFilesInDiff ¶
func (self *CommitFileLoader) GetFilesInDiff(from string, to string, reverse bool) ([]*models.CommitFile, error)
GetFilesInDiff get the specified commit files
type CommitLoader ¶
CommitLoader returns a list of Commit objects for the current repo
func NewCommitLoader ¶
func NewCommitLoader( cmn *common.Common, cmd oscommands.ICmdObjBuilder, getRebaseMode func() (enums.RebaseMode, error), gitCommon *GitCommon, ) *CommitLoader
making our dependencies explicit for the sake of easier testing
func (*CommitLoader) GetCommits ¶
func (self *CommitLoader) GetCommits(opts GetCommitsOptions) ([]*models.Commit, error)
GetCommits obtains the commits of the current branch
func (*CommitLoader) MergeRebasingCommits ¶
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) GetCoreCommentChar ¶
func (self *ConfigCommands) GetCoreCommentChar() byte
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) GetRebaseUpdateRefs ¶
func (self *ConfigCommands) GetRebaseUpdateRefs() bool
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 DiffCommands ¶
type DiffCommands struct {
*GitCommon
}
func NewDiffCommands ¶
func NewDiffCommands(gitCommon *GitCommon) *DiffCommands
func (*DiffCommands) DiffCmdObj ¶
func (self *DiffCommands) DiffCmdObj(diffArgs []string) oscommands.ICmdObj
func (*DiffCommands) DiffIndexCmdObj ¶
func (self *DiffCommands) DiffIndexCmdObj(diffArgs ...string) oscommands.ICmdObj
func (*DiffCommands) GetAllDiff ¶
func (self *DiffCommands) GetAllDiff(staged bool) (string, error)
func (*DiffCommands) GetPathDiff ¶
func (self *DiffCommands) GetPathDiff(path string, staged bool) (string, error)
func (*DiffCommands) OpenDiffToolCmdObj ¶
func (self *DiffCommands) OpenDiffToolCmdObj(opts DiffToolCmdOptions) oscommands.ICmdObj
type DiffToolCmdOptions ¶
type DiffToolCmdOptions struct { // The path to show a diff for. Pass "." for the entire repo. Filepath string // The commit against which to show the diff. Leave empty to show a diff of // the working copy. FromCommit string // The commit to diff against FromCommit. Leave empty to diff the working // copy against FromCommit. Leave both FromCommit and ToCommit empty to show // the diff of the unstaged working copy changes against the index if Staged // is false, or the staged changes against HEAD if Staged is true. ToCommit string // Whether to reverse the left and right sides of the diff. Reverse bool // Whether the given Filepath is a directory. We'll pass --dir-diff to // git-difftool in that case. IsDirectory bool // Whether to show the staged or the unstaged changes. Must be false if both // FromCommit and ToCommit are non-empty. Staged bool }
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) GetEditAtLineAndWaitCmdStr ¶
func (self *FileCommands) GetEditAtLineAndWaitCmdStr(filename string, lineNumber int) string
func (*FileCommands) GetEditAtLineCmdStr ¶
func (self *FileCommands) GetEditAtLineCmdStr(filename string, lineNumber int) (string, bool)
func (*FileCommands) GetEditCmdStr ¶
func (self *FileCommands) GetEditCmdStr(filenames []string) (string, bool)
func (*FileCommands) GetEditCmdStrLegacy ¶
func (self *FileCommands) GetEditCmdStrLegacy(filename string, lineNumber int) (string, error)
func (*FileCommands) GetOpenDirInEditorCmdStr ¶
func (self *FileCommands) GetOpenDirInEditorCmdStr(path string) (string, bool)
type FileLoader ¶
type FileLoader struct { *GitCommon // contains filtered or unexported fields }
func NewFileLoader ¶
func NewFileLoader(gitCommon *GitCommon, cmd oscommands.ICmdObjBuilder, config FileLoaderConfig) *FileLoader
func (*FileLoader) GetStatusFiles ¶
func (self *FileLoader) GetStatusFiles(opts GetStatusFileOptions) []*models.File
type FileLoaderConfig ¶
type FileLoaderConfig interface {
GetShowUntrackedFiles() string
}
type FileStatus ¶
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 GetCommitsOptions ¶
type GetCommitsOptions struct { Limit bool FilterPath string FilterAuthor string IncludeRebaseCommits bool RefName string // e.g. "HEAD" or "my_branch" RefForPushedStatus string // the ref to use for determining pushed/unpushed status // determines if we show the whole git graph i.e. pass the '--all' flag All bool // If non-empty, show divergence from this ref (left-right log) RefToShowDivergenceFrom string }
type GetStatusFileOptions ¶
type GetStatusFileOptions struct {
NoRenames bool
}
type GitCommandBuilder ¶
type GitCommandBuilder struct {
// contains filtered or unexported fields
}
convenience struct for building git commands. Especially useful when including conditional args
func NewGitCmd ¶
func NewGitCmd(command string) *GitCommandBuilder
func (*GitCommandBuilder) Arg ¶
func (self *GitCommandBuilder) Arg(args ...string) *GitCommandBuilder
func (*GitCommandBuilder) ArgIf ¶
func (self *GitCommandBuilder) ArgIf(condition bool, ifTrue ...string) *GitCommandBuilder
func (*GitCommandBuilder) ArgIfElse ¶
func (self *GitCommandBuilder) ArgIfElse(condition bool, ifTrue string, ifFalse string) *GitCommandBuilder
func (*GitCommandBuilder) Config ¶
func (self *GitCommandBuilder) Config(value string) *GitCommandBuilder
func (*GitCommandBuilder) ConfigIf ¶
func (self *GitCommandBuilder) ConfigIf(condition bool, ifTrue string) *GitCommandBuilder
func (*GitCommandBuilder) Dir ¶
func (self *GitCommandBuilder) Dir(path string) *GitCommandBuilder
the -C arg will make git do a `cd` to the directory before doing anything else
func (*GitCommandBuilder) DirIf ¶
func (self *GitCommandBuilder) DirIf(condition bool, path string) *GitCommandBuilder
func (*GitCommandBuilder) GitDir ¶
func (self *GitCommandBuilder) GitDir(path string) *GitCommandBuilder
Note, you may prefer to use the Dir method instead of this one
func (*GitCommandBuilder) GitDirIf ¶
func (self *GitCommandBuilder) GitDirIf(condition bool, path string) *GitCommandBuilder
func (*GitCommandBuilder) ToArgv ¶
func (self *GitCommandBuilder) ToArgv() []string
func (*GitCommandBuilder) ToString ¶
func (self *GitCommandBuilder) ToString() string
func (*GitCommandBuilder) Worktree ¶
func (self *GitCommandBuilder) Worktree(path string) *GitCommandBuilder
Note, you may prefer to use the Dir method instead of this one
type GitCommon ¶
func NewGitCommon ¶
func NewGitCommon( cmn *common.Common, version *GitVersion, cmd oscommands.ICmdObjBuilder, osCommand *oscommands.OSCommand, repoPaths *RepoPaths, repo *gogit.Repository, config *ConfigCommands, ) *GitCommon
type GitStatusOptions ¶
GitStatus returns the file status of the repo
type GitVersion ¶
func GetGitVersion ¶
func GetGitVersion(osCommand *oscommands.OSCommand) (*GitVersion, error)
func ParseGitVersion ¶
func ParseGitVersion(versionStr string) (*GitVersion, error)
func (*GitVersion) IsAtLeast ¶
func (v *GitVersion) IsAtLeast(major, minor, patch int) bool
func (*GitVersion) IsAtLeastVersion ¶
func (v *GitVersion) IsAtLeastVersion(version *GitVersion) bool
func (*GitVersion) IsOlderThan ¶
func (v *GitVersion) IsOlderThan(major, minor, patch int) bool
func (*GitVersion) IsOlderThanVersion ¶
func (v *GitVersion) IsOlderThanVersion(version *GitVersion) bool
type NewWorktreeOpts ¶
type PatchCommands ¶
type PatchCommands struct { *GitCommon PatchBuilder *patch.PatchBuilder // contains filtered or unexported fields }
func NewPatchCommands ¶
func NewPatchCommands( gitCommon *GitCommon, rebase *RebaseCommands, commit *CommitCommands, status *StatusCommands, stash *StashCommands, patchBuilder *patch.PatchBuilder, ) *PatchCommands
func (*PatchCommands) ApplyCustomPatch ¶
func (self *PatchCommands) ApplyCustomPatch(reverse bool) error
func (*PatchCommands) ApplyPatch ¶
func (self *PatchCommands) ApplyPatch(patch string, opts ApplyPatchOpts) error
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 (*PatchCommands) SaveTemporaryPatch ¶
func (self *PatchCommands) SaveTemporaryPatch(patch string) (string, error)
type PrepareInteractiveRebaseCommandOpts ¶
type PrepareInteractiveRebaseCommandOpts struct {
// contains filtered or unexported fields
}
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) AddCommitCoAuthor ¶
func (*RebaseCommands) AmendTo ¶
func (self *RebaseCommands) AmendTo(commits []*models.Commit, commitIndex int) error
AmendTo amends the given commit with whatever files are staged
func (*RebaseCommands) BeginInteractiveRebaseForCommit ¶
func (self *RebaseCommands) BeginInteractiveRebaseForCommit( commits []*models.Commit, commitIndex int, keepCommitsThatBecomeEmpty bool, ) 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) 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) CherryPickCommitsDuringRebase ¶
func (self *RebaseCommands) CherryPickCommitsDuringRebase(commits []*models.Commit) error
CherryPickCommitsDuringRebase simply prepends the given commits to the existing git-rebase-todo file
func (*RebaseCommands) ContinueRebase ¶
func (self *RebaseCommands) ContinueRebase() error
func (*RebaseCommands) DeleteUpdateRefTodos ¶
func (self *RebaseCommands) DeleteUpdateRefTodos(commits []*models.Commit) error
func (*RebaseCommands) DiscardOldFileChanges ¶
func (self *RebaseCommands) DiscardOldFileChanges(commits []*models.Commit, commitIndex int, filePaths []string) error
DiscardOldFileChanges discards changes to a file from an old commit
func (*RebaseCommands) EditRebase ¶
func (self *RebaseCommands) EditRebase(branchRef string) error
func (*RebaseCommands) EditRebaseFromBaseCommit ¶
func (self *RebaseCommands) EditRebaseFromBaseCommit(targetBranchName string, baseCommit string) error
func (*RebaseCommands) EditRebaseTodo ¶
func (self *RebaseCommands) EditRebaseTodo(commits []*models.Commit, action todo.TodoCommand) error
Sets the action for the given commits in the git-rebase-todo file
func (*RebaseCommands) GenericAmend ¶
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) GitRebaseEditTodo ¶
func (self *RebaseCommands) GitRebaseEditTodo(todosFileContent []byte) error
GitRebaseEditTodo runs "git rebase --edit-todo", saving the given todosFileContent to the file
func (*RebaseCommands) InteractiveRebase ¶
func (self *RebaseCommands) InteractiveRebase(commits []*models.Commit, startIdx int, endIdx int, action todo.TodoCommand) error
func (*RebaseCommands) MoveCommitsDown ¶
func (*RebaseCommands) MoveCommitsUp ¶
func (*RebaseCommands) MoveTodosDown ¶
func (self *RebaseCommands) MoveTodosDown(commits []*models.Commit) error
func (*RebaseCommands) MoveTodosUp ¶
func (self *RebaseCommands) MoveTodosUp(commits []*models.Commit) error
func (*RebaseCommands) PrepareInteractiveRebaseCommand ¶
func (self *RebaseCommands) PrepareInteractiveRebaseCommand(opts PrepareInteractiveRebaseCommandOpts) 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 instructions what to do with the todo file
func (*RebaseCommands) RebaseBranch ¶
func (self *RebaseCommands) RebaseBranch(branchName string) error
RebaseBranch interactive rebases onto a branch
func (*RebaseCommands) RebaseBranchFromBaseCommit ¶
func (self *RebaseCommands) RebaseBranchFromBaseCommit(targetBranchName string, baseCommit string) error
func (*RebaseCommands) ResetCommitAuthor ¶
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 ¶
func (*RebaseCommands) SquashAllAboveFixupCommits ¶
func (self *RebaseCommands) SquashAllAboveFixupCommits(commit *models.Commit) error
SquashAllAboveFixupCommits squashes all fixup! commits above the given one
type ReflogCommitLoader ¶
func NewReflogCommitLoader ¶
func NewReflogCommitLoader(common *common.Common, cmd oscommands.ICmdObjBuilder) *ReflogCommitLoader
func (*ReflogCommitLoader) GetReflogCommits ¶
func (self *ReflogCommitLoader) GetReflogCommits(lastReflogCommit *models.Commit, filterPath string, filterAuthor string) ([]*models.Commit, bool, error)
GetReflogCommits only returns the new reflog commits since the given lastReflogCommit if none is passed (i.e. it's value is nil) then we get all the reflog commits
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 (*RemoteCommands) DeleteRemoteTag ¶
func (*RemoteCommands) GetRemoteURL ¶
func (self *RemoteCommands) GetRemoteURL(remoteName string) (string, error)
Resolve what might be a aliased URL into a full URL SEE: `man -P 'less +/--get-url +n' git-ls-remote`
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 RemoteLoader ¶
func NewRemoteLoader ¶
func NewRemoteLoader( common *common.Common, cmd oscommands.ICmdObjBuilder, getGoGitRemotes func() ([]*gogit.Remote, error), ) *RemoteLoader
func (*RemoteLoader) GetRemotes ¶
func (self *RemoteLoader) GetRemotes() ([]*models.Remote, error)
type RepoPaths ¶
type RepoPaths struct {
// contains filtered or unexported fields
}
func GetRepoPaths ¶
func GetRepoPaths( cmd oscommands.ICmdObjBuilder, version *GitVersion, ) (*RepoPaths, error)
func MockRepoPaths ¶
Returns the repo paths for a typical repo
func (*RepoPaths) RepoGitDirPath ¶
path of the git-dir for the repo. If this is a bare repo, it will be the location of the bare repo If this is a non-bare repo, it will be the location of the .git dir in the main worktree.
func (*RepoPaths) RepoPath ¶
Path of the repo. If we're in a the main worktree, this will be the same as WorktreePath() If we're in a bare repo, it will be the parent folder of the bare repo
func (*RepoPaths) WorktreeGitDirPath ¶
Path of the worktree's git dir. If we're in the main worktree, this will be the .git dir under the RepoPath(). If we're in a linked worktree, it will be the directory pointed at by the worktree's .git file
func (*RepoPaths) WorktreePath ¶
Path to the current worktree. If we're in the main worktree, this will be the same as RepoPath()
type StashCommands ¶
type StashCommands struct { *GitCommon // contains filtered or unexported fields }
func NewStashCommands ¶
func NewStashCommands( gitCommon *GitCommon, fileLoader *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 ¶
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 ¶
func (self *StashCommands) StashAndKeepIndex(message string) error
func (*StashCommands) StashIncludeUntrackedChanges ¶
func (self *StashCommands) StashIncludeUntrackedChanges(message string) error
func (*StashCommands) StashUnstagedChanges ¶
func (self *StashCommands) StashUnstagedChanges(message string) error
type StashLoader ¶
func NewStashLoader ¶
func NewStashLoader( common *common.Common, cmd oscommands.ICmdObjBuilder, ) *StashLoader
func (*StashLoader) GetStashEntries ¶
func (self *StashLoader) GetStashEntries(filterPath string) []*models.StashEntry
type StatusCommands ¶
type StatusCommands struct {
*GitCommon
}
func NewStatusCommands ¶
func NewStatusCommands( gitCommon *GitCommon, ) *StatusCommands
func (*StatusCommands) BranchBeingRebased ¶
func (self *StatusCommands) BranchBeingRebased() string
Full ref (e.g. "refs/heads/mybranch") of the branch that is currently being rebased, or empty string when we're not in a rebase
func (*StatusCommands) IsBareRepo ¶
func (self *StatusCommands) IsBareRepo() (bool, error)
func (*StatusCommands) IsInInteractiveRebase ¶
func (self *StatusCommands) IsInInteractiveRebase() (bool, error)
func (*StatusCommands) IsInMergeState ¶
func (self *StatusCommands) IsInMergeState() (bool, error)
IsInMergeState states whether we are still mid-merge
func (*StatusCommands) IsInNormalRebase ¶
func (self *StatusCommands) IsInNormalRebase() (bool, error)
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(parentModule *models.SubmoduleConfig) ([]*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
func (*SubmoduleCommands) UpdateUrl ¶
func (self *SubmoduleCommands) UpdateUrl(submodule *models.SubmoduleConfig, newUrl string) error
type SyncCommands ¶
type SyncCommands struct {
*GitCommon
}
func NewSyncCommands ¶
func NewSyncCommands(gitCommon *GitCommon) *SyncCommands
func (*SyncCommands) FastForward ¶
func (*SyncCommands) FetchBackground ¶
func (self *SyncCommands) FetchBackground() error
func (*SyncCommands) FetchBackgroundCmdObj ¶
func (self *SyncCommands) FetchBackgroundCmdObj() oscommands.ICmdObj
func (*SyncCommands) FetchCmdObj ¶
func (self *SyncCommands) FetchCmdObj(task gocui.Task) oscommands.ICmdObj
func (*SyncCommands) FetchRemote ¶
func (self *SyncCommands) FetchRemote(task gocui.Task, remoteName string) error
func (*SyncCommands) Pull ¶
func (self *SyncCommands) Pull(task gocui.Task, opts PullOptions) error
func (*SyncCommands) PushCmdObj ¶
func (self *SyncCommands) PushCmdObj(task gocui.Task, 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, ref, msg string, force bool) error
func (*TagCommands) CreateLightweight ¶
func (self *TagCommands) CreateLightweight(tagName string, ref string, force bool) error
func (*TagCommands) HasTag ¶
func (self *TagCommands) HasTag(tagName string) bool
func (*TagCommands) LocalDelete ¶
func (self *TagCommands) LocalDelete(tagName string) error
type TagLoader ¶
func NewTagLoader ¶
func NewTagLoader( common *common.Common, cmd oscommands.ICmdObjBuilder, ) *TagLoader
type WorkingTreeCommands ¶
type WorkingTreeCommands struct { *GitCommon // contains filtered or unexported fields }
func NewWorkingTreeCommands ¶
func NewWorkingTreeCommands( gitCommon *GitCommon, submodule *SubmoduleCommands, fileLoader *FileLoader, ) *WorkingTreeCommands
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 unstaged 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
func (*WorkingTreeCommands) Exclude ¶
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) 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) 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 ¶
func (self *WorkingTreeCommands) StageFiles(paths []string) error
func (*WorkingTreeCommands) UnStageFile ¶
func (self *WorkingTreeCommands) UnStageFile(paths []string, tracked 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) UnstageTrackedFiles ¶
func (self *WorkingTreeCommands) UnstageTrackedFiles(paths []string) error
func (*WorkingTreeCommands) UnstageUntrackedFiles ¶
func (self *WorkingTreeCommands) UnstageUntrackedFiles(paths []string) error
func (*WorkingTreeCommands) WorktreeFileDiff ¶
func (self *WorkingTreeCommands) WorktreeFileDiff(file *models.File, plain bool, cached bool) string
WorktreeFileDiff returns the diff of a file
func (*WorkingTreeCommands) WorktreeFileDiffCmdObj ¶
func (self *WorkingTreeCommands) WorktreeFileDiffCmdObj(node models.IFile, plain bool, cached bool) oscommands.ICmdObj
type WorktreeCommands ¶
type WorktreeCommands struct {
*GitCommon
}
func NewWorktreeCommands ¶
func NewWorktreeCommands(gitCommon *GitCommon) *WorktreeCommands
func (*WorktreeCommands) Delete ¶
func (self *WorktreeCommands) Delete(worktreePath string, force bool) error
func (*WorktreeCommands) Detach ¶
func (self *WorktreeCommands) Detach(worktreePath string) error
func (*WorktreeCommands) New ¶
func (self *WorktreeCommands) New(opts NewWorktreeOpts) error
type WorktreeLoader ¶
type WorktreeLoader struct {
*GitCommon
}
func NewWorktreeLoader ¶
func NewWorktreeLoader(gitCommon *GitCommon) *WorktreeLoader
func (*WorktreeLoader) GetWorktrees ¶
func (self *WorktreeLoader) GetWorktrees() ([]*models.Worktree, error)
Source Files ¶
- bisect.go
- bisect_info.go
- blame.go
- branch.go
- branch_loader.go
- commit.go
- commit_file_loader.go
- commit_loader.go
- common.go
- config.go
- custom.go
- diff.go
- file.go
- file_loader.go
- flow.go
- git_command_builder.go
- patch.go
- rebase.go
- reflog_commit_loader.go
- remote.go
- remote_loader.go
- repo_paths.go
- stash.go
- stash_loader.go
- status.go
- submodule.go
- sync.go
- tag.go
- tag_loader.go
- version.go
- working_tree.go
- worktree.go
- worktree_loader.go