Documentation
¶
Index ¶
- Constants
- 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 ForOtherRepo(cmdObj *oscommands.CmdObj) *oscommands.CmdObj
- func GenerateGithubPullRequestMap(prs []*models.GithubPullRequest, branches []*models.Branch, ...) map[string]*models.GithubPullRequest
- 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) GetCurrentHash() string
- func (self *BisectInfo) GetNewHash() string
- func (self *BisectInfo) GetStartHash() string
- func (self *BisectInfo) NewTerm() string
- func (self *BisectInfo) OldTerm() string
- func (self *BisectInfo) Started() bool
- func (self *BisectInfo) Status(commitHash string) (BisectStatus, bool)
- type BisectStatus
- type BlameCommands
- type BranchCommands
- func (self *BranchCommands) AllBranchesLogCmdObj() *oscommands.CmdObj
- 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) FastForwardMerge(refName string, worktreeGitDir string, worktreePath string) error
- func (self *BranchCommands) GetAllBranchesLogIdxAndCount() (int, int)
- 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.CmdObj
- func (self *BranchCommands) GetUpstreamDifferenceCount(branchName string) (string, string)
- func (self *BranchCommands) HasLocalOnlyCommits(branch *models.Branch) (bool, error)
- func (self *BranchCommands) IsAncestor(ancestorRefName string, refName string) bool
- func (self *BranchCommands) IsBranchMerged(branch *models.Branch, mainBranches *MainBranches) (bool, error)
- func (self *BranchCommands) IsHeadDetached() bool
- func (self *BranchCommands) LocalDelete(branches []string, force bool) error
- func (self *BranchCommands) Merge(branchName string, variant MergeVariant) error
- func (self *BranchCommands) New(name string, base string) error
- func (self *BranchCommands) NewWithoutCheckout(name string, base string) error
- func (self *BranchCommands) NewWithoutTracking(name string, base string) error
- func (self *BranchCommands) PreviousRef() (string, error)
- func (self *BranchCommands) Rename(oldName string, newName string) error
- func (self *BranchCommands) RotateAllBranchesLogIdx()
- func (self *BranchCommands) RotateAllBranchesLogIdxBackward()
- 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
- func (self *BranchCommands) UpdateBranchRefs(updateCommands string, reflogMessage string) error
- type BranchConfig
- type BranchInfo
- type BranchLoader
- func (self *BranchLoader) GetBaseBranch(branch *models.Branch, mainBranches *MainBranches) (string, error)
- func (self *BranchLoader) GetBehindBaseBranchValuesForAllBranches(branches []*models.Branch, mainBranches *MainBranches, renderFunc func()) error
- func (self *BranchLoader) Load(reflogCommits []*models.Commit, mainBranches *MainBranches, ...) ([]*models.Branch, error)
- type BranchLoaderConfigCommands
- type CheckoutOptions
- type CommitCommands
- func (self *CommitCommands) AddCoAuthor(hash string, author string) error
- func (self *CommitCommands) AmendHead() error
- func (self *CommitCommands) AmendHeadCmdObj() *oscommands.CmdObj
- func (self *CommitCommands) CommitCmdObj(summary string, description string, forceSkipHooks bool) *oscommands.CmdObj
- func (self *CommitCommands) CommitEditorCmdObj() *oscommands.CmdObj
- func (self *CommitCommands) CommitInEditorWithMessageFileCmdObj(tmpMessageFile string, forceSkipHooks bool) *oscommands.CmdObj
- func (self *CommitCommands) CreateAmendCommit(originalSubject, newSubject, newDescription string, includeFileChanges bool) error
- func (self *CommitCommands) CreateFixupCommit(hash string) error
- func (self *CommitCommands) GetCommitAuthor(commitHash string) (Author, error)
- func (self *CommitCommands) GetCommitDiff(commitHash string) (string, error)
- func (self *CommitCommands) GetCommitMessage(commitHash string) (string, error)
- func (self *CommitCommands) GetCommitMessageFirstLine(hash string) (string, error)
- func (self *CommitCommands) GetCommitMessageFromHistory(value int) (string, error)
- func (self *CommitCommands) GetCommitMessagesFirstLine(hashes []string) (string, error)
- func (self *CommitCommands) GetCommitSubject(commitHash string) (string, error)
- func (self *CommitCommands) GetCommitsOneline(hashes []string) (string, error)
- func (self *CommitCommands) ResetAuthor() error
- func (self *CommitCommands) ResetToCommit(hash string, strength string, envVars []string) error
- func (self *CommitCommands) Revert(hashes []string, isMerge bool) error
- func (self *CommitCommands) RewordLastCommit(summary string, description string) *oscommands.CmdObj
- func (self *CommitCommands) RewordLastCommitInEditorCmdObj() *oscommands.CmdObj
- func (self *CommitCommands) RewordLastCommitInEditorWithMessageFileCmdObj(tmpMessageFile string) *oscommands.CmdObj
- func (self *CommitCommands) SetAuthor(value string) error
- func (self *CommitCommands) ShowCmdObj(hash string, filterPaths []string, mode DiffMode) *oscommands.CmdObj
- func (self *CommitCommands) ShowFileContentCmdObj(hash string, filePath string) *oscommands.CmdObj
- type CommitFileLoader
- type CommitLoader
- type ConfigCommands
- func (self *ConfigCommands) Branches(cmd oscommands.ICmdObjBuilder) map[string]*BranchConfig
- func (self *ConfigCommands) DropConfigCache()
- func (self *ConfigCommands) GetCoreCommentChar() byte
- func (self *ConfigCommands) GetCoreEditor() string
- func (self *ConfigCommands) GetGitFlowPrefixMap() map[string]string
- func (self *ConfigCommands) GetGpgTagSign() bool
- func (self *ConfigCommands) GetMergeFF() string
- func (self *ConfigCommands) GetPushToCurrent() bool
- func (self *ConfigCommands) GetRebaseUpdateRefs() bool
- func (self *ConfigCommands) GetRemoteURL() string
- func (self *ConfigCommands) GetShowUntrackedFiles() string
- func (self *ConfigCommands) NeedsGpgSubprocess(key GpgConfigKey) bool
- func (self *ConfigCommands) NeedsGpgSubprocessForCommit() bool
- type CustomCommands
- type DiffCommands
- func (self *DiffCommands) CustomPatchDiffCmdObj(dir string, mode DiffMode) *oscommands.CmdObj
- func (self *DiffCommands) DiffCmdObj(diffArgs []string, mode DiffMode) *oscommands.CmdObj
- func (self *DiffCommands) DiffIndexCmdObj(diffArgs ...string) *oscommands.CmdObj
- func (self *DiffCommands) GetDiff(staged bool, additionalArgs ...string) (string, error)
- func (self *DiffCommands) OpenDiffToolCmdObj(opts DiffToolCmdOptions) *oscommands.CmdObj
- func (self *DiffCommands) ProbeDiffRendererEmitsMetadata() bool
- type DiffMode
- 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) GetOpenDirInEditorCmdStr(path string) (string, bool)
- type FileDiff
- type FileLoader
- type FileLoaderConfig
- type FileStatus
- type FlowCommands
- type GetCommitsOptions
- type GetStatusFileOptions
- type GitCommandBuilder
- func (self *GitCommandBuilder) AddCommonDiffArgs(diffRendererConfigManager *config.DiffRendererConfigManager, ...) *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) NoLineEndingConversion() *GitCommandBuilder
- func (self *GitCommandBuilder) ToArgv() []string
- func (self *GitCommandBuilder) ToString() string
- func (self *GitCommandBuilder) Worktree(path string) *GitCommandBuilder
- func (self *GitCommandBuilder) WorktreePathIf(condition bool, path string) *GitCommandBuilder
- type GitCommon
- type GitHubCommands
- func (self *GitHubCommands) ConfiguredBaseRemoteName() string
- func (self *GitHubCommands) FetchRecentPRs(branches []string, serviceInfo *hosting_service.ServiceInfo, token string) ([]*models.GithubPullRequest, error)
- func (self *GitHubCommands) GetAuthToken(host string) string
- func (self *GitHubCommands) SetConfiguredBaseRemoteName(remoteName string) error
- type GitStatusOptions
- type GitVersion
- type GithubGitObject
- type GithubRef
- type GithubRepositoryOwner
- type GithubStatusCheckRollup
- type GpgConfigKey
- type HostingService
- type IFileNode
- type MainBranches
- type MergeVariant
- type NewWorktreeOpts
- type PatchCommands
- func (self *PatchCommands) ApplyCustomPatch(reverse bool, turnAddedFilesIntoDiffAgainstEmptyFile bool) error
- func (self *PatchCommands) ApplyPatch(patch string, opts ApplyPatchOpts) error
- func (self *PatchCommands) DeletePatchesFromCommit(commits []*models.Commit, commitIndex int) error
- func (self *PatchCommands) EnsureCustomPatchDiffTrees() 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) PullPatchIntoNewCommitBefore(commits []*models.Commit, commitIdx int, commitSummary string, ...) error
- func (self *PatchCommands) SaveTemporaryPatch(patch string) (string, error)
- func (self *PatchCommands) WriteCustomPatchDiffTrees() error
- type PrepareInteractiveRebaseCommandOpts
- type PullOptions
- type PullRequest
- type PullRequestEdge
- type PullRequestNode
- type PushOpts
- type RebaseCommands
- func (self *RebaseCommands) AbortRebase() error
- func (self *RebaseCommands) AddCommitCoAuthor(commits []*models.Commit, start, end 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) BeginInteractiveRebaseForCommitRange(commits []*models.Commit, start, end int, keepCommitsThatBecomeEmpty bool) error
- func (self *RebaseCommands) CherryPickCommits(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) DropMergeCommit(commits []*models.Commit, commitIndex int) 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, flag string) error
- func (self *RebaseCommands) GenericAmend(commits []*models.Commit, start, end int, f func(commit *models.Commit) error) error
- func (self *RebaseCommands) GenericMergeOrRebaseAction(commandType string, command string) error
- func (self *RebaseCommands) GenericMergeOrRebaseActionCmdObj(commandType string, command string) *oscommands.CmdObj
- 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) MoveCommits(commits []*models.Commit, startIdx int, endIdx int, offset int) 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) MoveFixupCommitDown(commits []*models.Commit, targetCommitIndex int) error
- func (self *RebaseCommands) MoveTodos(commits []*models.Commit, offset 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.CmdObj
- func (self *RebaseCommands) RebaseBranch(branchName string) error
- func (self *RebaseCommands) RebaseBranchFromBaseCommit(targetBranchName string, baseCommit string) error
- func (self *RebaseCommands) ResetCommitAuthor(commits []*models.Commit, start, end 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.CmdObj, error)
- func (self *RebaseCommands) SetCommitAuthor(commits []*models.Commit, start, end 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, branchNames []string) error
- func (self *RemoteCommands) DeleteRemoteTag(task gocui.Task, remoteName string, tagNames []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
- func (self *RepoPaths) GitLocationEnvVars() []string
- func (self *RepoPaths) IsBareRepo() bool
- func (self *RepoPaths) RepoGitDirPath() string
- func (self *RepoPaths) RepoName() string
- func (self *RepoPaths) RepoPath() string
- func (self *RepoPaths) WorktreeGitDirPath() string
- func (self *RepoPaths) WorktreePath() string
- type RepositoryQuery
- type Response
- type StashCommands
- func (self *StashCommands) Apply(index int) error
- func (self *StashCommands) Drop(index int) error
- func (self *StashCommands) DropNewest() error
- func (self *StashCommands) Hash(index int) (string, 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) ShowStashEntryCmdObj(index int, mode DiffMode) *oscommands.CmdObj
- 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(hash string, message string) error
- type StashLoader
- type StatusCommands
- func (self *StatusCommands) BranchBeingRebased() string
- func (self *StatusCommands) IsBareRepo() bool
- func (self *StatusCommands) IsInCherryPick() (bool, error)
- func (self *StatusCommands) IsInMergeState() (bool, error)
- func (self *StatusCommands) IsInRebase() (bool, error)
- func (self *StatusCommands) IsInRevert() (bool, error)
- func (self *StatusCommands) RefsSnapshot() (string, error)
- func (self *StatusCommands) WorkingTreeState() models.WorkingTreeState
- type SubmoduleCommands
- func (self *SubmoduleCommands) Add(name string, path string, url string) error
- func (self *SubmoduleCommands) AnyHaveStageableChanges(paths []string) (bool, error)
- func (self *SubmoduleCommands) BulkDeinitCmdObj() *oscommands.CmdObj
- func (self *SubmoduleCommands) BulkInitCmdObj() *oscommands.CmdObj
- func (self *SubmoduleCommands) BulkUpdateCmdObj() *oscommands.CmdObj
- func (self *SubmoduleCommands) BulkUpdateRecursivelyCmdObj() *oscommands.CmdObj
- func (self *SubmoduleCommands) CheckoutConflictCommit(path string, sha string) error
- func (self *SubmoduleCommands) ConflictSideLog(path string, side string, otherSide string) (string, error)
- func (self *SubmoduleCommands) Delete(submodule *models.SubmoduleConfig) error
- func (self *SubmoduleCommands) ForceBulkUpdateCmdObj() *oscommands.CmdObj
- func (self *SubmoduleCommands) GetCommitSummary(path string, sha string) (string, error)
- func (self *SubmoduleCommands) GetConfigs(parentModule *models.SubmoduleConfig) ([]*models.SubmoduleConfig, error)
- func (self *SubmoduleCommands) GetConflictCommits(path string) (base string, ours string, theirs string, err 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) Fetch(task gocui.Task) error
- func (self *SyncCommands) FetchBackground() error
- func (self *SyncCommands) FetchBackgroundCmdObj() *oscommands.CmdObj
- func (self *SyncCommands) FetchCmdObj(task gocui.Task) *oscommands.CmdObj
- func (self *SyncCommands) FetchRemote(task gocui.Task, remoteName string) error
- func (self *SyncCommands) FetchRemoteBranches(task gocui.Task, remoteName string, remoteBranchNames []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.CmdObj, error)
- type TagCommands
- func (self *TagCommands) CreateAnnotatedObj(tagName, ref, msg string, force bool) *oscommands.CmdObj
- func (self *TagCommands) CreateLightweightObj(tagName string, ref string, force bool) *oscommands.CmdObj
- func (self *TagCommands) HasTag(tagName string) bool
- func (self *TagCommands) IsTagAnnotated(tagName string) (bool, error)
- func (self *TagCommands) LocalDelete(tagNames []string) error
- func (self *TagCommands) Push(task gocui.Task, remoteName string, tagNames []string) error
- func (self *TagCommands) ShowAnnotationInfo(tagName string) (string, error)
- type TagLoader
- type WorkingTreeCommands
- func (self *WorkingTreeCommands) AllRepoFiles() ([]string, error)
- func (self *WorkingTreeCommands) BeforeAndAfterFileForRename(file *models.File) (*models.File, *models.File, error)
- func (self *WorkingTreeCommands) CheckoutFile(commitHash, fileName string) error
- func (self *WorkingTreeCommands) DiscardAllDirChanges(nodes []IFileNode) error
- func (self *WorkingTreeCommands) DiscardAllFileChanges(file *models.File) error
- func (self *WorkingTreeCommands) DiscardAnyUnstagedFileChanges() error
- func (self *WorkingTreeCommands) DiscardUnstagedDirChanges(nodes []IFileNode) error
- func (self *WorkingTreeCommands) DiscardUnstagedFileChanges(file *models.File) error
- func (self *WorkingTreeCommands) Exclude(filename string) error
- func (self *WorkingTreeCommands) HasChangesToTrackedFiles(worktreeGitDir string, worktreePath string) (bool, error)
- func (self *WorkingTreeCommands) Ignore(filename string) error
- func (self *WorkingTreeCommands) MergeFileForFiles(strategy string, oursFilepath string, baseFilepath string, ...) (string, error)
- func (self *WorkingTreeCommands) MergeFileForObjectIDs(strategy string, oursID string, baseID string, theirsID string) (string, error)
- func (self *WorkingTreeCommands) ObjectIDAtStage(path string, stage int) (string, error)
- func (self *WorkingTreeCommands) OpenMergeToolCmdObj() *oscommands.CmdObj
- func (self *WorkingTreeCommands) RemoveConflictedFile(name string) error
- 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) ResetKeep(ref string, worktreeGitDir string, worktreePath string) error
- func (self *WorkingTreeCommands) ResetMixed(ref string) error
- func (self *WorkingTreeCommands) ResetSoft(ref string) error
- func (self *WorkingTreeCommands) ShowFileAtStage(path string, stage int) (string, error)
- func (self *WorkingTreeCommands) ShowFileDiff(from string, to string, reverse bool, fileName string, previousPath string, ...) (string, error)
- func (self *WorkingTreeCommands) ShowFileDiffCmdObj(from string, to string, reverse bool, fileNames []string, mode DiffMode) *oscommands.CmdObj
- func (self *WorkingTreeCommands) StageAll(onlyTrackedFiles bool) error
- func (self *WorkingTreeCommands) StageFile(path string) error
- func (self *WorkingTreeCommands) StageFiles(paths []string, extraArgs []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, mode DiffMode, cached bool) string
- func (self *WorkingTreeCommands) WorktreeFileDiffCmdObj(node models.IFile, mode DiffMode, cached bool, paths []string) *oscommands.CmdObj
- type WorktreeCommands
- type WorktreeLoader
Constants ¶
const OptionalLocksEnvVar = "GIT_OPTIONAL_LOCKS"
OptionalLocksEnvVar is the name of the environment variable that tells git whether it may take "optional" locks — chiefly the index.lock that `git status` grabs to write back a refreshed stat-cache. We set it to 0 on every git command by default (see NewGitCmdObjBuilder) so our invocations never contend for index.lock, neither with each other (e.g. a main-view `git diff --submodule`, which runs `git status` inside submodules, racing a submodule action) nor with git commands the user runs in a terminal. The one command that opts back in is the foreground files refresh; see FileLoader.gitStatus.
Variables ¶
var ErrInvalidCommitIndex = errors.New("invalid commit index")
Functions ¶
func AddCoAuthorToDescription ¶ added in v0.41.0
func AddCoAuthorToMessage ¶ added in v0.41.0
func CheckedOutByOtherWorktree ¶ added in v0.40.0
func ForOtherRepo ¶ added in v0.66.0
func ForOtherRepo(cmdObj *oscommands.CmdObj) *oscommands.CmdObj
ForOtherRepo prepares a command that operates on a repo other than the one we have open — a submodule, or another worktree. GIT_DIR and GIT_WORK_TREE say where our repo is, and every command we run inherits them, so a command pointed at a different repo would be resolved against ours instead: `git -C <submodule> log` would silently log the superproject's commits.
func GenerateGithubPullRequestMap ¶ added in v0.61.0
func GenerateGithubPullRequestMap( prs []*models.GithubPullRequest, branches []*models.Branch, remotes []*models.Remote, ) map[string]*models.GithubPullRequest
returns a map from branch name to pull request
Types ¶
type ApplyPatchOpts ¶ added in v0.39.0
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) GetInfoForGitDir ¶ added in v0.40.0
func (self *BisectCommands) GetInfoForGitDir(gitDir string) *BisectInfo
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 hashes 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
func (*BisectCommands) StartWithTerms ¶ added in v0.40.0
func (self *BisectCommands) StartWithTerms(oldTerm string, newTerm string) 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) GetCurrentHash ¶ added in v0.42.0
func (self *BisectInfo) GetCurrentHash() string
func (*BisectInfo) GetNewHash ¶ added in v0.42.0
func (self *BisectInfo) GetNewHash() string
func (*BisectInfo) GetStartHash ¶ added in v0.42.0
func (self *BisectInfo) GetStartHash() 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(commitHash string) (BisectStatus, bool)
type BisectStatus ¶ added in v0.35.0
type BisectStatus int
const ( BisectStatusOld BisectStatus = iota BisectStatusNew BisectStatusSkipped )
type BlameCommands ¶ added in v0.41.0
type BlameCommands struct {
*GitCommon
}
func NewBlameCommands ¶ added in v0.41.0
func NewBlameCommands(gitCommon *GitCommon) *BlameCommands
func (*BlameCommands) BlameLineRange ¶ added in v0.41.0
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
// contains filtered or unexported fields
}
func NewBranchCommands ¶
func NewBranchCommands(gitCommon *GitCommon) *BranchCommands
func (*BranchCommands) AllBranchesLogCmdObj ¶
func (self *BranchCommands) AllBranchesLogCmdObj() *oscommands.CmdObj
func (*BranchCommands) Checkout ¶
func (self *BranchCommands) Checkout(branch string, options CheckoutOptions) error
func (*BranchCommands) CreateWithUpstream ¶ added in v0.41.0
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 ¶ added in v0.36.0
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. Returns empty string if HEAD is detached.
func (*BranchCommands) FastForwardMerge ¶ added in v0.66.0
func (self *BranchCommands) FastForwardMerge(refName string, worktreeGitDir string, worktreePath string) error
Fast-forwards the branch that is checked out in the given worktree to the given ref. Fails if that can't be done without a merge commit. Pass empty strings for the worktree to use the current one.
func (*BranchCommands) GetAllBranchesLogIdxAndCount ¶ added in v0.56.0
func (self *BranchCommands) GetAllBranchesLogIdxAndCount() (int, int)
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.CmdObj
func (*BranchCommands) GetUpstreamDifferenceCount ¶
func (self *BranchCommands) GetUpstreamDifferenceCount(branchName string) (string, string)
func (*BranchCommands) HasLocalOnlyCommits ¶ added in v0.66.0
func (self *BranchCommands) HasLocalOnlyCommits(branch *models.Branch) (bool, error)
Returns whether the given branch has commits of its own, meaning commits that its remote branch never contained. Those are the commits that would be lost if we reset the branch to its upstream.
A branch that has diverged from its upstream doesn't necessarily have any commits of its own. If somebody else rewrote the remote branch and force-pushed it, our branch is still at the commits it had before, and all of those were on the remote branch at some point. The reflog of the remote-tracking branch records the values it had before it was rewritten, so a commit that was ever on the remote branch is contained in one of them.
func (*BranchCommands) IsAncestor ¶ added in v0.66.0
func (self *BranchCommands) IsAncestor(ancestorRefName string, refName string) bool
Returns whether the first ref is an ancestor of the second one, which also means that the second one can be fast-forward merged into the first one
func (*BranchCommands) IsBranchMerged ¶ added in v0.45.0
func (self *BranchCommands) IsBranchMerged(branch *models.Branch, mainBranches *MainBranches) (bool, error)
func (*BranchCommands) IsHeadDetached ¶
func (self *BranchCommands) IsHeadDetached() bool
func (*BranchCommands) LocalDelete ¶ added in v0.41.0
func (self *BranchCommands) LocalDelete(branches []string, force bool) error
LocalDelete delete branch locally
func (*BranchCommands) Merge ¶
func (self *BranchCommands) Merge(branchName string, variant MergeVariant) error
func (*BranchCommands) New ¶
func (self *BranchCommands) New(name string, base string) error
New creates a new branch
func (*BranchCommands) NewWithoutCheckout ¶ added in v0.50.0
func (self *BranchCommands) NewWithoutCheckout(name string, base string) error
NewWithoutCheckout creates a new branch without checking it out
func (*BranchCommands) NewWithoutTracking ¶ added in v0.43.0
func (self *BranchCommands) NewWithoutTracking(name string, base string) error
func (*BranchCommands) PreviousRef ¶ added in v0.56.0
func (self *BranchCommands) PreviousRef() (string, error)
Gets the full ref name of the previously checked out branch. Can return an empty string (but no error) e.g. when the previously checked out thing was a detached head.
func (*BranchCommands) Rename ¶
func (self *BranchCommands) Rename(oldName string, newName string) error
func (*BranchCommands) RotateAllBranchesLogIdx ¶ added in v0.51.0
func (self *BranchCommands) RotateAllBranchesLogIdx()
func (*BranchCommands) RotateAllBranchesLogIdxBackward ¶ added in v0.60.0
func (self *BranchCommands) RotateAllBranchesLogIdxBackward()
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
func (*BranchCommands) UpdateBranchRefs ¶ added in v0.50.0
func (self *BranchCommands) UpdateBranchRefs(updateCommands string, reflogMessage string) error
Moves branches by writing refs directly. The reflog message is what `git reflog <branch>` shows for the update; it is the only hint about who moved the branch, as no git command shows up in the reflog for this.
type BranchConfig ¶ added in v0.61.0
BranchConfig holds the tracking configuration for a branch.
type BranchInfo ¶ added in v0.36.0
type BranchLoader ¶ added in v0.36.0
BranchLoader returns a list of Branch objects for the current repo
func NewBranchLoader ¶ added in v0.36.0
func NewBranchLoader( cmn *common.Common, gitCommon *GitCommon, cmd oscommands.ICmdObjBuilder, getCurrentBranchInfo func() (BranchInfo, error), hasLocalOnlyCommits func(*models.Branch) (bool, error), config BranchLoaderConfigCommands, ) *BranchLoader
func (*BranchLoader) GetBaseBranch ¶ added in v0.43.0
func (self *BranchLoader) GetBaseBranch(branch *models.Branch, mainBranches *MainBranches) (string, error)
Find the base branch for the given branch (i.e. the main branch that the given branch was forked off of)
Note that this function may return an empty string even if the returned error is nil, e.g. when none of the configured main branches exist. This is not considered an error condition, so callers need to check both the returned error and whether the returned base branch is empty (and possibly react differently in both cases).
func (*BranchLoader) GetBehindBaseBranchValuesForAllBranches ¶ added in v0.43.0
func (self *BranchLoader) GetBehindBaseBranchValuesForAllBranches( branches []*models.Branch, mainBranches *MainBranches, renderFunc func(), ) error
func (*BranchLoader) Load ¶ added in v0.36.0
func (self *BranchLoader) Load(reflogCommits []*models.Commit, mainBranches *MainBranches, oldBranches []*models.Branch, loadExtraInfo bool, onWorker func(func() error), renderFunc func(), ) ([]*models.Branch, error)
Load the list of branches for the current repo
type BranchLoaderConfigCommands ¶ added in v0.36.0
type BranchLoaderConfigCommands interface {
Branches(cmd oscommands.ICmdObjBuilder) map[string]*BranchConfig
}
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 ¶ added in v0.41.0
func (self *CommitCommands) AddCoAuthor(hash 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.CmdObj
func (*CommitCommands) CommitCmdObj ¶
func (self *CommitCommands) CommitCmdObj(summary string, description string, forceSkipHooks bool) *oscommands.CmdObj
func (*CommitCommands) CommitEditorCmdObj ¶
func (self *CommitCommands) CommitEditorCmdObj() *oscommands.CmdObj
runs git commit without the -m argument meaning it will invoke the user's editor
func (*CommitCommands) CommitInEditorWithMessageFileCmdObj ¶ added in v0.41.0
func (self *CommitCommands) CommitInEditorWithMessageFileCmdObj(tmpMessageFile string, forceSkipHooks bool) *oscommands.CmdObj
func (*CommitCommands) CreateAmendCommit ¶ added in v0.41.0
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(hash string) error
CreateFixupCommit creates a commit that fixes up a previous commit
func (*CommitCommands) GetCommitAuthor ¶ added in v0.35.0
func (self *CommitCommands) GetCommitAuthor(commitHash string) (Author, error)
func (*CommitCommands) GetCommitDiff ¶ added in v0.35.0
func (self *CommitCommands) GetCommitDiff(commitHash string) (string, error)
func (*CommitCommands) GetCommitMessage ¶
func (self *CommitCommands) GetCommitMessage(commitHash string) (string, error)
func (*CommitCommands) GetCommitMessageFirstLine ¶
func (self *CommitCommands) GetCommitMessageFirstLine(hash string) (string, error)
func (*CommitCommands) GetCommitMessageFromHistory ¶ added in v0.38.0
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 ¶ added in v0.35.0
func (self *CommitCommands) GetCommitMessagesFirstLine(hashes []string) (string, error)
func (*CommitCommands) GetCommitSubject ¶ added in v0.41.0
func (self *CommitCommands) GetCommitSubject(commitHash string) (string, error)
func (*CommitCommands) GetCommitsOneline ¶ added in v0.35.0
func (self *CommitCommands) GetCommitsOneline(hashes []string) (string, error)
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(hash string, strength string, envVars []string) error
ResetToCommit reset to commit
func (*CommitCommands) Revert ¶
func (self *CommitCommands) Revert(hashes []string, isMerge bool) error
Revert reverts the selected commits by hash. If isMerge is true, we'll pass -m 1 to say we want to revert the first parent of the merge commit, which is the one people want in 99.9% of cases. In current git versions we could unconditionally pass -m 1 even for non-merge commits, but older versions of git choke on it.
func (*CommitCommands) RewordLastCommit ¶
func (self *CommitCommands) RewordLastCommit(summary string, description string) *oscommands.CmdObj
RewordLastCommit rewords the topmost commit with the given message
func (*CommitCommands) RewordLastCommitInEditorCmdObj ¶ added in v0.39.0
func (self *CommitCommands) RewordLastCommitInEditorCmdObj() *oscommands.CmdObj
func (*CommitCommands) RewordLastCommitInEditorWithMessageFileCmdObj ¶ added in v0.41.0
func (self *CommitCommands) RewordLastCommitInEditorWithMessageFileCmdObj(tmpMessageFile string) *oscommands.CmdObj
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(hash string, filterPaths []string, mode DiffMode) *oscommands.CmdObj
func (*CommitCommands) ShowFileContentCmdObj ¶ added in v0.49.0
func (self *CommitCommands) ShowFileContentCmdObj(hash string, filePath string) *oscommands.CmdObj
type CommitFileLoader ¶ added in v0.36.0
func NewCommitFileLoader ¶ added in v0.36.0
func NewCommitFileLoader(common *common.Common, cmd oscommands.ICmdObjBuilder) *CommitFileLoader
func (*CommitFileLoader) GetFilesInDiff ¶ added in v0.36.0
func (self *CommitFileLoader) GetFilesInDiff(from string, to string, reverse bool) ([]*models.CommitFile, error)
GetFilesInDiff get the specified commit files
type CommitLoader ¶ added in v0.36.0
CommitLoader returns a list of Commit objects for the current repo
func NewCommitLoader ¶ added in v0.36.0
func NewCommitLoader( cmn *common.Common, cmd oscommands.ICmdObjBuilder, getWorkingTreeState func() models.WorkingTreeState, gitCommon *GitCommon, ) *CommitLoader
making our dependencies explicit for the sake of easier testing
func (*CommitLoader) GetCommits ¶ added in v0.36.0
func (self *CommitLoader) GetCommits(opts GetCommitsOptions) ([]*models.Commit, error)
GetCommits obtains the commits of the current branch
func (*CommitLoader) MergeRebasingCommits ¶ added in v0.36.0
func (self *CommitLoader) MergeRebasingCommits(hashPool *utils.StringPool, commits []*models.Commit) ([]*models.Commit, error)
type ConfigCommands ¶
func NewConfigCommands ¶
func NewConfigCommands( common *common.Common, gitConfig git_config.IGitConfig, ) *ConfigCommands
func (*ConfigCommands) Branches ¶
func (self *ConfigCommands) Branches(cmd oscommands.ICmdObjBuilder) map[string]*BranchConfig
returns the repo's branches as specified in the git config
func (*ConfigCommands) DropConfigCache ¶ added in v0.49.0
func (self *ConfigCommands) DropConfigCache()
func (*ConfigCommands) GetCoreCommentChar ¶ added in v0.39.0
func (self *ConfigCommands) GetCoreCommentChar() byte
func (*ConfigCommands) GetCoreEditor ¶
func (self *ConfigCommands) GetCoreEditor() string
func (*ConfigCommands) GetGitFlowPrefixMap ¶ added in v0.62.0
func (self *ConfigCommands) GetGitFlowPrefixMap() map[string]string
func (*ConfigCommands) GetGpgTagSign ¶ added in v0.49.0
func (self *ConfigCommands) GetGpgTagSign() bool
func (*ConfigCommands) GetMergeFF ¶ added in v0.56.0
func (self *ConfigCommands) GetMergeFF() 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 ¶ added in v0.40.0
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) NeedsGpgSubprocess ¶ added in v0.49.0
func (self *ConfigCommands) NeedsGpgSubprocess(key GpgConfigKey) bool
NeedsGpgSubprocess tells us whether the user has gpg enabled for the specified action type and needs a subprocess because they have a process where they manually enter their password every time a GPG action is taken
func (*ConfigCommands) NeedsGpgSubprocessForCommit ¶ added in v0.49.0
func (self *ConfigCommands) NeedsGpgSubprocessForCommit() bool
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.
func (*CustomCommands) TemplateFunctionRunCommand ¶ added in v0.49.0
func (self *CustomCommands) TemplateFunctionRunCommand(cmdStr string) (string, error)
A function that can be used as a "runCommand" entry in the template.FuncMap of templates.
type DiffCommands ¶ added in v0.39.0
type DiffCommands struct {
*GitCommon
}
func NewDiffCommands ¶ added in v0.39.0
func NewDiffCommands(gitCommon *GitCommon) *DiffCommands
func (*DiffCommands) CustomPatchDiffCmdObj ¶ added in v0.66.0
func (self *DiffCommands) CustomPatchDiffCmdObj(dir string, mode DiffMode) *oscommands.CmdObj
CustomPatchDiffCmdObj is the command that renders the custom patch being built: a diff of the two trees the patch was materialized into (PatchCommands.WriteCustomPatchDiffTrees), under the directory holding them. It goes through the same wiring as any other diff we show, so the patch is rendered by whatever renders the rest of them, and git works out how much context to give it.
git's own path prefixes are suppressed because the trees are named a and b themselves, which leaves the paths reading like an ordinary diff's over the repo's own paths.
func (*DiffCommands) DiffCmdObj ¶ added in v0.39.0
func (self *DiffCommands) DiffCmdObj(diffArgs []string, mode DiffMode) *oscommands.CmdObj
This is for generating diffs to be shown in the UI (e.g. rendering a range diff to the main view). It uses a custom diff renderer if one is configured.
func (*DiffCommands) DiffIndexCmdObj ¶ added in v0.41.0
func (self *DiffCommands) DiffIndexCmdObj(diffArgs ...string) *oscommands.CmdObj
func (*DiffCommands) GetDiff ¶ added in v0.45.0
func (self *DiffCommands) GetDiff(staged bool, additionalArgs ...string) (string, error)
This is a basic generic diff command that can be used for any diff operation (e.g. copying a diff to the clipboard). It will not use a custom diff renderer, and does not use user configs such as ignore whitespace. If you want to diff specific refs (one or two), you need to add them yourself in additionalArgs; it is recommended to also pass `--` after that. If you want to restrict the diff to specific paths, pass them in additionalArgs after the `--`.
func (*DiffCommands) OpenDiffToolCmdObj ¶ added in v0.41.0
func (self *DiffCommands) OpenDiffToolCmdObj(opts DiffToolCmdOptions) *oscommands.CmdObj
func (*DiffCommands) ProbeDiffRendererEmitsMetadata ¶ added in v0.66.0
func (self *DiffCommands) ProbeDiffRendererEmitsMetadata() bool
ProbeDiffRendererEmitsMetadata reports whether the configured diff renderer states which line of which file it is rendering, by running it on empty input and looking for the handshake. The answer decides whether a diff the renderer produced can be acted on at all, or has to be replaced by git's own when the user wants to act on it (see DiffLineHelper.MainViewDiffMode).
Asking rather than watching a real render: the handshake is the renderer's first output whatever the diff, so the answer is a property of the renderer, known before we render anything — where watching would have to see a diff go by first, and would be fooled by a diff with no lines to describe.
No terminal is needed. git only invokes a stdin filter when it thinks it is talking to one, but the renderer itself doesn't care: it announces itself whenever OSC1717 is set, so it can be run directly with empty input.
type DiffMode ¶ added in v0.66.0
type DiffMode int
DiffMode says what a diff command's output is for. This decides whether the configured diff renderer produces it, and whether it is coloured.
const ( // DiffModeRendered is the diff as the user has arranged for it to look: through the // diff renderer, with the renderer's own arguments and its preference about colour. DiffModeRendered DiffMode = iota // DiffModeRaw is git's own coloured diff, for showing a diff whose rendered form // couldn't be acted on. DiffModeRaw // DiffModePlain is git's own uncoloured diff, for building patches from and copying // text out of rather than for looking at. DiffModePlain )
type DiffToolCmdOptions ¶ added in v0.41.0
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 ¶ added in v0.38.0
func (self *FileCommands) GetEditAtLineAndWaitCmdStr(filename string, lineNumber int) string
func (*FileCommands) GetEditAtLineCmdStr ¶ added in v0.38.0
func (self *FileCommands) GetEditAtLineCmdStr(filename string, lineNumber int) (string, bool)
func (*FileCommands) GetEditCmdStr ¶
func (self *FileCommands) GetEditCmdStr(filenames []string) (string, bool)
func (*FileCommands) GetOpenDirInEditorCmdStr ¶ added in v0.40.0
func (self *FileCommands) GetOpenDirInEditorCmdStr(path string) (string, bool)
type FileLoader ¶ added in v0.36.0
type FileLoader struct {
*GitCommon
// contains filtered or unexported fields
}
func NewFileLoader ¶ added in v0.36.0
func NewFileLoader(gitCommon *GitCommon, cmd oscommands.ICmdObjBuilder, config FileLoaderConfig) *FileLoader
func (*FileLoader) GetStatusFiles ¶ added in v0.36.0
func (self *FileLoader) GetStatusFiles(opts GetStatusFileOptions) []*models.File
type FileLoaderConfig ¶ added in v0.36.0
type FileLoaderConfig interface {
GetShowUntrackedFiles() string
}
type FileStatus ¶ added in v0.36.0
type FlowCommands ¶
type FlowCommands struct {
*GitCommon
}
func NewFlowCommands ¶
func NewFlowCommands( gitCommon *GitCommon, ) *FlowCommands
func (*FlowCommands) FinishCmdObj ¶
func (self *FlowCommands) FinishCmdObj(branchName string) (*oscommands.CmdObj, error)
func (*FlowCommands) GitFlowEnabled ¶
func (self *FlowCommands) GitFlowEnabled() bool
func (*FlowCommands) StartCmdObj ¶
func (self *FlowCommands) StartCmdObj(branchType string, name string) *oscommands.CmdObj
type GetCommitsOptions ¶ added in v0.36.0
type GetCommitsOptions struct {
Limit bool
FilterPath string
FilterAuthor string
IncludeRebaseCommits bool
RefName string // e.g. "HEAD" or "my_branch"
RefForPushedStatus models.Ref // 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
MainBranches *MainBranches
HashPool *utils.StringPool
}
type GetStatusFileOptions ¶ added in v0.36.0
type GetStatusFileOptions struct {
NoRenames bool
// If true, we'll show untracked files even if the user has set the config to hide them.
// This is useful for users with bare repos for dotfiles who default to hiding untracked files,
// but want to occasionally see them to `git add` a new file.
ForceShowUntracked bool
// When true, this status is part of an unattended background refresh, so it
// keeps the default suppression of optional locks (avoiding index.lock
// contention with git commands the user runs in a terminal, at the cost of
// not persisting git's refreshed stat-cache). A foreground status opts back
// in; see gitStatus.
Background bool
}
type GitCommandBuilder ¶ added in v0.39.0
type GitCommandBuilder struct {
// contains filtered or unexported fields
}
convenience struct for building git commands. Especially useful when including conditional args
func NewGitCmd ¶ added in v0.39.0
func NewGitCmd(command string) *GitCommandBuilder
func (*GitCommandBuilder) AddCommonDiffArgs ¶ added in v0.64.0
func (self *GitCommandBuilder) AddCommonDiffArgs(diffRendererConfigManager *config.DiffRendererConfigManager, userConfig *config.UserConfig, mode DiffMode) *GitCommandBuilder
func (*GitCommandBuilder) Arg ¶ added in v0.39.0
func (self *GitCommandBuilder) Arg(args ...string) *GitCommandBuilder
func (*GitCommandBuilder) ArgIf ¶ added in v0.39.0
func (self *GitCommandBuilder) ArgIf(condition bool, ifTrue ...string) *GitCommandBuilder
func (*GitCommandBuilder) ArgIfElse ¶ added in v0.39.0
func (self *GitCommandBuilder) ArgIfElse(condition bool, ifTrue string, ifFalse string) *GitCommandBuilder
func (*GitCommandBuilder) Config ¶ added in v0.39.0
func (self *GitCommandBuilder) Config(value string) *GitCommandBuilder
func (*GitCommandBuilder) ConfigIf ¶ added in v0.41.0
func (self *GitCommandBuilder) ConfigIf(condition bool, ifTrue string) *GitCommandBuilder
func (*GitCommandBuilder) Dir ¶ added in v0.40.0
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 ¶ added in v0.41.0
func (self *GitCommandBuilder) DirIf(condition bool, path string) *GitCommandBuilder
func (*GitCommandBuilder) GitDir ¶ added in v0.40.0
func (self *GitCommandBuilder) GitDir(path string) *GitCommandBuilder
Note, you may prefer to use the Dir method instead of this one
func (*GitCommandBuilder) GitDirIf ¶ added in v0.40.0
func (self *GitCommandBuilder) GitDirIf(condition bool, path string) *GitCommandBuilder
func (*GitCommandBuilder) NoLineEndingConversion ¶ added in v0.66.0
func (self *GitCommandBuilder) NoLineEndingConversion() *GitCommandBuilder
NoLineEndingConversion keeps git's line-ending machinery away from files that are not a working tree's. The trees the custom patch is materialized into hold the bytes git states the patch in, so a command over them has to read and write those bytes as they are. On a machine that checks files out with CRLF, `git apply` writes the after tree in that form while the before tree keeps the LF it was written with. git's own diff converts both back, but it warns about a round trip through a working tree these files never belong to, and an external diff renderer is handed the two files as they stand, one line ending apart in every line.
func (*GitCommandBuilder) ToArgv ¶ added in v0.39.0
func (self *GitCommandBuilder) ToArgv() []string
func (*GitCommandBuilder) ToString ¶ added in v0.39.0
func (self *GitCommandBuilder) ToString() string
func (*GitCommandBuilder) Worktree ¶ added in v0.40.0
func (self *GitCommandBuilder) Worktree(path string) *GitCommandBuilder
Note, you may prefer to use the Dir method instead of this one
func (*GitCommandBuilder) WorktreePathIf ¶ added in v0.45.0
func (self *GitCommandBuilder) WorktreePathIf(condition bool, path string) *GitCommandBuilder
type GitCommon ¶ added in v0.35.0
func NewGitCommon ¶ added in v0.35.0
func NewGitCommon( cmn *common.Common, version *GitVersion, cmd oscommands.ICmdObjBuilder, osCommand *oscommands.OSCommand, repoPaths *RepoPaths, config *ConfigCommands, diffRendererConfigManager *config.DiffRendererConfigManager, ) *GitCommon
type GitHubCommands ¶ added in v0.61.0
type GitHubCommands struct {
*GitCommon
}
func NewGitHubCommands ¶ added in v0.61.0
func NewGitHubCommands(gitCommon *GitCommon) *GitHubCommands
func (*GitHubCommands) ConfiguredBaseRemoteName ¶ added in v0.61.0
func (self *GitHubCommands) ConfiguredBaseRemoteName() string
func (*GitHubCommands) FetchRecentPRs ¶ added in v0.61.0
func (self *GitHubCommands) FetchRecentPRs(branches []string, serviceInfo *hosting_service.ServiceInfo, token string) ([]*models.GithubPullRequest, error)
FetchRecentPRs fetches recent pull requests using GraphQL. serviceInfo identifies the GitHub instance (github.com or a GitHub Enterprise Server) and the owner/repo to query against.
func (*GitHubCommands) GetAuthToken ¶ added in v0.61.0
func (self *GitHubCommands) GetAuthToken(host string) string
GetAuthToken returns the token to authenticate against the given host with, or an empty string if there is none.
The token has to come from gh itself rather than from an in-process lookup with go-gh: that reads gh's config file once per process and answers from that snapshot ever after, whereas gh rewrites the file whenever the active account changes, and keeps the active account's token either there or in the system keyring. Under a long-running lazygit the snapshot therefore drifts out of date, leaving us with a token for an account that is no longer active, or with no token at all.
func (*GitHubCommands) SetConfiguredBaseRemoteName ¶ added in v0.61.0
func (self *GitHubCommands) SetConfiguredBaseRemoteName(remoteName string) error
type GitStatusOptions ¶ added in v0.36.0
GitStatus returns the file status of the repo
type GitVersion ¶ added in v0.37.0
func GetGitVersion ¶ added in v0.37.0
func GetGitVersion(osCommand *oscommands.OSCommand) (*GitVersion, error)
func ParseGitVersion ¶ added in v0.37.0
func ParseGitVersion(versionStr string) (*GitVersion, error)
func (*GitVersion) IsAtLeast ¶ added in v0.41.0
func (v *GitVersion) IsAtLeast(major, minor, patch int) bool
func (*GitVersion) IsAtLeastVersion ¶ added in v0.41.0
func (v *GitVersion) IsAtLeastVersion(version *GitVersion) bool
func (*GitVersion) IsOlderThan ¶ added in v0.37.0
func (v *GitVersion) IsOlderThan(major, minor, patch int) bool
func (*GitVersion) IsOlderThanVersion ¶ added in v0.38.0
func (v *GitVersion) IsOlderThanVersion(version *GitVersion) bool
type GithubGitObject ¶ added in v0.64.0
type GithubGitObject struct {
StatusCheckRollup GithubStatusCheckRollup `json:"statusCheckRollup"`
}
type GithubRef ¶ added in v0.64.0
type GithubRef struct {
Target GithubGitObject `json:"target"`
}
type GithubRepositoryOwner ¶ added in v0.61.0
type GithubRepositoryOwner struct {
Login string `json:"login"`
}
type GithubStatusCheckRollup ¶ added in v0.64.0
type GithubStatusCheckRollup struct {
State string `json:"state"`
}
type GpgConfigKey ¶ added in v0.49.0
type GpgConfigKey string
const ( CommitGpgSign GpgConfigKey = "commit.gpgSign" TagGpgSign GpgConfigKey = "tag.gpgSign" )
type HostingService ¶ added in v0.61.0
type HostingService struct {
*GitCommon
}
a hosting service is something like github, gitlab, bitbucket etc
func NewHostingServiceCommand ¶ added in v0.61.0
func NewHostingServiceCommand(gitCommon *GitCommon) *HostingService
func (*HostingService) GetCommitURL ¶ added in v0.61.0
func (self *HostingService) GetCommitURL(commitSha string) (string, error)
func (*HostingService) GetPullRequestURL ¶ added in v0.61.0
func (self *HostingService) GetPullRequestURL(from string, to string) (string, error)
func (*HostingService) GetServiceInfo ¶ added in v0.62.0
func (self *HostingService) GetServiceInfo(remoteURL string) (hosting_service.ServiceInfo, error)
type MainBranches ¶ added in v0.43.0
type MainBranches struct {
// contains filtered or unexported fields
}
func NewMainBranches ¶ added in v0.43.0
func NewMainBranches( cmn *common.Common, cmd oscommands.ICmdObjBuilder, ) *MainBranches
func (*MainBranches) Get ¶ added in v0.43.0
func (self *MainBranches) Get() []string
Get the list of main branches that exist in the repository. This is a list of full ref names.
func (*MainBranches) GetMergeBase ¶ added in v0.43.0
func (self *MainBranches) GetMergeBase(refName string) string
Return the merge base of the given refName with the closest main branch.
type MergeVariant ¶ added in v0.56.0
type MergeVariant int
const ( MERGE_VARIANT_REGULAR MergeVariant = iota MERGE_VARIANT_FAST_FORWARD MERGE_VARIANT_NON_FAST_FORWARD MERGE_VARIANT_SQUASH )
type NewWorktreeOpts ¶ added in v0.40.0
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 ¶ added in v0.39.0
func (self *PatchCommands) ApplyCustomPatch(reverse bool, turnAddedFilesIntoDiffAgainstEmptyFile bool) error
func (*PatchCommands) ApplyPatch ¶ added in v0.39.0
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) EnsureCustomPatchDiffTrees ¶ added in v0.66.0
func (self *PatchCommands) EnsureCustomPatchDiffTrees() error
EnsureCustomPatchDiffTrees writes the custom patch's diff trees if what is there no longer describes the patch. Call it before rendering the patch, which is often — every time the panel showing it re-renders — while the patch itself changes rarely.
func (*PatchCommands) MovePatchIntoIndex ¶
func (*PatchCommands) MovePatchToSelectedCommit ¶
func (*PatchCommands) PullPatchIntoNewCommit ¶
func (*PatchCommands) PullPatchIntoNewCommitBefore ¶ added in v0.51.0
func (*PatchCommands) SaveTemporaryPatch ¶ added in v0.39.0
func (self *PatchCommands) SaveTemporaryPatch(patch string) (string, error)
func (*PatchCommands) WriteCustomPatchDiffTrees ¶ added in v0.66.0
func (self *PatchCommands) WriteCustomPatchDiffTrees() error
WriteCustomPatchDiffTrees materializes the custom patch as two file trees under the directory the patch builder keeps for it: `a` holds each of the patch's files as it is before the patch, `b` as it is after. Diffing those two trees against each other (DiffCommands.CustomPatchDiffCmdObj) turns the patch into a diff of real files, which can then be rendered exactly as any other diff is — through a diff renderer of any kind, and with git's own idea of how much context to show.
The trees are named a and b so that the diff's paths, with git's own prefixes suppressed, come out reading like the a/ and b/ of an ordinary diff, over the real repo-relative paths.
type PrepareInteractiveRebaseCommandOpts ¶ added in v0.38.0
type PrepareInteractiveRebaseCommandOpts struct {
// contains filtered or unexported fields
}
type PullOptions ¶
type PullRequest ¶ added in v0.61.0
type PullRequest struct {
Edges []PullRequestEdge `json:"edges"`
}
type PullRequestEdge ¶ added in v0.61.0
type PullRequestEdge struct {
Node PullRequestNode `json:"node"`
}
type PullRequestNode ¶ added in v0.61.0
type PullRequestNode struct {
Title string `json:"title"`
HeadRefName string `json:"headRefName"`
Number int `json:"number"`
Url string `json:"url"`
HeadRepositoryOwner GithubRepositoryOwner `json:"headRepositoryOwner"`
State string `json:"state"`
IsDraft bool `json:"isDraft"`
HeadRef GithubRef `json:"headRef"`
}
type PushOpts ¶
type PushOpts struct {
Force bool
ForceWithLease bool
SetUpstream bool
// The remote to push to. If empty, git picks it from its configuration,
// and Refspecs must be empty too.
Remote string
// What to push, each in the form "refs/heads/<local branch>:<remote ref>".
// If empty, git decides what to push based on push.default and
// remote.<name>.push.
Refspecs []string
}
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 ¶ added in v0.41.0
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) BeginInteractiveRebaseForCommitRange ¶ added in v0.43.0
func (*RebaseCommands) CherryPickCommits ¶
func (self *RebaseCommands) CherryPickCommits(commits []*models.Commit) error
CherryPickCommits begins an interactive rebase with the given hashes being cherry picked onto HEAD
func (*RebaseCommands) ContinueRebase ¶
func (self *RebaseCommands) ContinueRebase() error
func (*RebaseCommands) DeleteUpdateRefTodos ¶ added in v0.41.0
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) DropMergeCommit ¶ added in v0.45.0
func (self *RebaseCommands) DropMergeCommit(commits []*models.Commit, commitIndex int) error
func (*RebaseCommands) EditRebase ¶ added in v0.38.0
func (self *RebaseCommands) EditRebase(branchRef string) error
func (*RebaseCommands) EditRebaseFromBaseCommit ¶ added in v0.40.0
func (self *RebaseCommands) EditRebaseFromBaseCommit(targetBranchName string, baseCommit string) error
func (*RebaseCommands) EditRebaseTodo ¶
func (self *RebaseCommands) EditRebaseTodo(commits []*models.Commit, action todo.TodoCommand, flag string) error
Sets the action for the given commits 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.CmdObj
func (*RebaseCommands) GitRebaseEditTodo ¶ added in v0.42.0
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, flag string) error
func (*RebaseCommands) MoveCommits ¶ added in v0.64.0
func (*RebaseCommands) MoveCommitsDown ¶ added in v0.41.0
func (*RebaseCommands) MoveCommitsUp ¶ added in v0.41.0
func (*RebaseCommands) MoveFixupCommitDown ¶ added in v0.44.1
func (self *RebaseCommands) MoveFixupCommitDown(commits []*models.Commit, targetCommitIndex int) error
func (*RebaseCommands) MoveTodos ¶ added in v0.64.0
func (self *RebaseCommands) MoveTodos(commits []*models.Commit, offset int) error
func (*RebaseCommands) MoveTodosDown ¶ added in v0.41.0
func (self *RebaseCommands) MoveTodosDown(commits []*models.Commit) error
func (*RebaseCommands) MoveTodosUp ¶ added in v0.41.0
func (self *RebaseCommands) MoveTodosUp(commits []*models.Commit) error
func (*RebaseCommands) PrepareInteractiveRebaseCommand ¶
func (self *RebaseCommands) PrepareInteractiveRebaseCommand(opts PrepareInteractiveRebaseCommandOpts) *oscommands.CmdObj
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 ¶ added in v0.40.0
func (self *RebaseCommands) RebaseBranchFromBaseCommit(targetBranchName string, baseCommit string) error
func (*RebaseCommands) ResetCommitAuthor ¶ added in v0.35.0
func (self *RebaseCommands) ResetCommitAuthor(commits []*models.Commit, start, end int) error
func (*RebaseCommands) RewordCommit ¶
func (*RebaseCommands) RewordCommitInEditor ¶
func (self *RebaseCommands) RewordCommitInEditor(commits []*models.Commit, index int) (*oscommands.CmdObj, error)
func (*RebaseCommands) SetCommitAuthor ¶ added in v0.35.0
func (*RebaseCommands) SquashAllAboveFixupCommits ¶
func (self *RebaseCommands) SquashAllAboveFixupCommits(commit *models.Commit) error
SquashAllAboveFixupCommits squashes all fixup! commits above the given one
type ReflogCommitLoader ¶ added in v0.36.0
func NewReflogCommitLoader ¶ added in v0.36.0
func NewReflogCommitLoader(common *common.Common, cmd oscommands.ICmdObjBuilder) *ReflogCommitLoader
func (*ReflogCommitLoader) GetReflogCommits ¶ added in v0.36.0
func (self *ReflogCommitLoader) GetReflogCommits(hashPool *utils.StringPool, 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 ¶ added in v0.41.0
func (*RemoteCommands) GetRemoteURL ¶ added in v0.41.0
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 ¶ added in v0.36.0
type RemoteLoader struct {
*GitCommon
}
func NewRemoteLoader ¶ added in v0.36.0
func NewRemoteLoader(gitCommon *GitCommon) *RemoteLoader
func (*RemoteLoader) GetRemoteBranchesByRemoteName ¶ added in v0.66.0
func (self *RemoteLoader) GetRemoteBranchesByRemoteName() (map[string][]*models.RemoteBranch, error)
GetRemoteBranchesByRemoteName returns all remote branches, keyed by the name of the remote they belong to.
func (*RemoteLoader) GetRemotes ¶ added in v0.36.0
func (self *RemoteLoader) GetRemotes() []*models.Remote
GetRemotes returns the repo's remotes, without their branches; those are loaded separately with GetRemoteBranchesByRemoteName, which takes a lot longer in a repo with many remote branches.
type RepoPaths ¶ added in v0.40.0
type RepoPaths struct {
// contains filtered or unexported fields
}
func GetRepoPaths ¶ added in v0.40.0
func GetRepoPaths( cmd oscommands.ICmdObjBuilder, version *GitVersion, ) (*RepoPaths, error)
func GetRepoPathsForDir ¶ added in v0.43.0
func GetRepoPathsForDir( dir string, cmd oscommands.ICmdObjBuilder, ) (*RepoPaths, error)
func MockRepoPaths ¶ added in v0.40.0
Returns the repo paths for a typical repo
func (*RepoPaths) GitLocationEnvVars ¶ added in v0.64.1
The environment that tells git where this repo is, as "NAME=value" entries. It is empty for the vast majority of repos, which git finds for itself by looking for a .git in the directory a command runs in. It is only non-empty when that doesn't work — when the git dir lives somewhere else entirely, because of core.worktree or --work-tree — and then every command addressing the repo has to carry it.
func (*RepoPaths) IsBareRepo ¶ added in v0.43.0
Whether we found no worktree, so that there is nothing for lazygit to show. Note that this isn't quite git's core.bare: a repo that calls itself non-bare but whose worktree we couldn't find counts as bare for us too. Concretely, this is true when we're in
- a genuinely bare repo;
- the git dir of a linked worktree (.git/worktrees/x), whose worktree is recorded but not somewhere we look;
- a repo that keeps its worktree somewhere only GIT_WORK_TREE knows, such as a vcsh-style dotfiles repo that hasn't been given core.worktree.
The .git dir of an ordinary repo is not one of them: GetRepoPathsForDir notices the worktree holding it and hands back that repo instead.
func (*RepoPaths) RepoGitDirPath ¶ added in v0.40.0
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) RepoName ¶ added in v0.40.0
Name of the repo. Basename of the folder containing the repo.
func (*RepoPaths) RepoPath ¶ added in v0.40.0
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 ¶ added in v0.40.0
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 ¶ added in v0.40.0
Path to the current worktree. If we're in the main worktree, this will be the same as RepoPath(). It is empty for a bare repo, which has no worktree at all.
type RepositoryQuery ¶ added in v0.61.0
type RepositoryQuery struct {
Repository map[string]PullRequest `json:"repository"`
}
type Response ¶ added in v0.61.0
type Response struct {
Data RepositoryQuery `json:"data"`
}
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 ¶ added in v0.35.0
func (self *StashCommands) DropNewest() error
func (*StashCommands) Hash ¶ added in v0.42.0
func (self *StashCommands) Hash(index int) (string, error)
func (*StashCommands) Pop ¶
func (self *StashCommands) Pop(index int) error
func (*StashCommands) Push ¶ added in v0.39.0
func (self *StashCommands) Push(message string) error
Push push stash
func (*StashCommands) Rename ¶ added in v0.36.0
func (self *StashCommands) Rename(index int, message string) error
func (*StashCommands) SaveStagedChanges ¶
func (self *StashCommands) SaveStagedChanges(message string) error
SaveStagedChanges stashes only the currently staged changes.
func (*StashCommands) ShowStashEntryCmdObj ¶
func (self *StashCommands) ShowStashEntryCmdObj(index int, mode DiffMode) *oscommands.CmdObj
func (*StashCommands) StashAndKeepIndex ¶ added in v0.35.0
func (self *StashCommands) StashAndKeepIndex(message string) error
func (*StashCommands) StashIncludeUntrackedChanges ¶ added in v0.36.0
func (self *StashCommands) StashIncludeUntrackedChanges(message string) error
func (*StashCommands) StashUnstagedChanges ¶ added in v0.35.0
func (self *StashCommands) StashUnstagedChanges(message string) error
type StashLoader ¶ added in v0.36.0
func NewStashLoader ¶ added in v0.36.0
func NewStashLoader( common *common.Common, cmd oscommands.ICmdObjBuilder, ) *StashLoader
func (*StashLoader) GetStashEntries ¶ added in v0.36.0
func (self *StashLoader) GetStashEntries(filterPath string) []*models.StashEntry
type StatusCommands ¶
type StatusCommands struct {
*GitCommon
}
func NewStatusCommands ¶
func NewStatusCommands( gitCommon *GitCommon, ) *StatusCommands
func (*StatusCommands) BranchBeingRebased ¶ added in v0.40.0
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
func (*StatusCommands) IsInCherryPick ¶ added in v0.50.0
func (self *StatusCommands) IsInCherryPick() (bool, error)
func (*StatusCommands) IsInMergeState ¶
func (self *StatusCommands) IsInMergeState() (bool, error)
IsInMergeState states whether we are still mid-merge
func (*StatusCommands) IsInRebase ¶ added in v0.50.0
func (self *StatusCommands) IsInRebase() (bool, error)
func (*StatusCommands) IsInRevert ¶ added in v0.50.0
func (self *StatusCommands) IsInRevert() (bool, error)
func (*StatusCommands) RefsSnapshot ¶ added in v0.63.0
func (self *StatusCommands) RefsSnapshot() (string, error)
RefsSnapshot returns a string fingerprint of the current state of local branches and HEAD. Comparing two snapshots byte-for-byte tells us whether any local ref or HEAD has moved since the last snapshot.
func (*StatusCommands) WorkingTreeState ¶
func (self *StatusCommands) WorkingTreeState() models.WorkingTreeState
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) AnyHaveStageableChanges ¶ added in v0.63.0
func (self *SubmoduleCommands) AnyHaveStageableChanges(paths []string) (bool, error)
AnyHaveStageableChanges reports whether any of the given submodule paths has a checked-out commit that differs from the one recorded in the superproject's index, i.e. a change that `git add <path>` would actually stage. A submodule that only has dirty or untracked content (with no new commit) can't be staged from the superproject, so it won't be reported here.
func (*SubmoduleCommands) BulkDeinitCmdObj ¶
func (self *SubmoduleCommands) BulkDeinitCmdObj() *oscommands.CmdObj
func (*SubmoduleCommands) BulkInitCmdObj ¶
func (self *SubmoduleCommands) BulkInitCmdObj() *oscommands.CmdObj
func (*SubmoduleCommands) BulkUpdateCmdObj ¶
func (self *SubmoduleCommands) BulkUpdateCmdObj() *oscommands.CmdObj
func (*SubmoduleCommands) BulkUpdateRecursivelyCmdObj ¶ added in v0.49.0
func (self *SubmoduleCommands) BulkUpdateRecursivelyCmdObj() *oscommands.CmdObj
func (*SubmoduleCommands) CheckoutConflictCommit ¶ added in v0.63.0
func (self *SubmoduleCommands) CheckoutConflictCommit(path string, sha string) error
CheckoutConflictCommit resolves a submodule conflict by checking the submodule out at the given commit. `git checkout --ours/--theirs` is a no-op on gitlinks, so we check out the chosen commit in the submodule itself; the caller then stages the submodule to record the resolution.
func (*SubmoduleCommands) ConflictSideLog ¶ added in v0.63.0
func (self *SubmoduleCommands) ConflictSideLog(path string, side string, otherSide string) (string, error)
ConflictSideLog returns a oneline log, run inside the submodule, of the commits that `side` has but `otherSide` does not (i.e. `otherSide..side`) — the commits unique to one side of a commit conflict, relative to their common ancestor. It is empty if `side` is an ancestor of `otherSide` (e.g. that side was rewound).
func (*SubmoduleCommands) Delete ¶
func (self *SubmoduleCommands) Delete(submodule *models.SubmoduleConfig) error
func (*SubmoduleCommands) ForceBulkUpdateCmdObj ¶
func (self *SubmoduleCommands) ForceBulkUpdateCmdObj() *oscommands.CmdObj
func (*SubmoduleCommands) GetCommitSummary ¶ added in v0.63.0
func (self *SubmoduleCommands) GetCommitSummary(path string, sha string) (string, error)
GetCommitSummary returns "<short-sha> <subject>" for a commit inside the submodule at the given path, for display in the conflict menu.
func (*SubmoduleCommands) GetConfigs ¶
func (self *SubmoduleCommands) GetConfigs(parentModule *models.SubmoduleConfig) ([]*models.SubmoduleConfig, error)
func (*SubmoduleCommands) GetConflictCommits ¶ added in v0.63.0
func (self *SubmoduleCommands) GetConflictCommits(path string) (base string, ours string, theirs string, err error)
GetConflictCommits returns the three gitlink commits of a conflicted submodule from the index: the merge base, our (current) commit, and their (incoming) commit. Any of them can be empty if that stage is absent (e.g. a submodule that was added on only one side). The path is relative to the repo root.
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) FetchBackground ¶ added in v0.39.0
func (self *SyncCommands) FetchBackground() error
func (*SyncCommands) FetchBackgroundCmdObj ¶ added in v0.39.0
func (self *SyncCommands) FetchBackgroundCmdObj() *oscommands.CmdObj
func (*SyncCommands) FetchCmdObj ¶ added in v0.39.0
func (self *SyncCommands) FetchCmdObj(task gocui.Task) *oscommands.CmdObj
func (*SyncCommands) FetchRemote ¶
func (self *SyncCommands) FetchRemote(task gocui.Task, remoteName string) error
func (*SyncCommands) FetchRemoteBranches ¶ added in v0.66.0
func (self *SyncCommands) FetchRemoteBranches( task gocui.Task, remoteName string, remoteBranchNames []string, ) error
Fetches the given branches of the given remote, updating their remote-tracking branches. Local branches are left alone, including the ones that track them.
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.CmdObj, error)
type TagCommands ¶
type TagCommands struct {
*GitCommon
}
func NewTagCommands ¶
func NewTagCommands(gitCommon *GitCommon) *TagCommands
func (*TagCommands) CreateAnnotatedObj ¶ added in v0.49.0
func (self *TagCommands) CreateAnnotatedObj(tagName, ref, msg string, force bool) *oscommands.CmdObj
func (*TagCommands) CreateLightweightObj ¶ added in v0.49.0
func (self *TagCommands) CreateLightweightObj(tagName string, ref string, force bool) *oscommands.CmdObj
func (*TagCommands) HasTag ¶ added in v0.40.0
func (self *TagCommands) HasTag(tagName string) bool
func (*TagCommands) IsTagAnnotated ¶ added in v0.54.0
func (self *TagCommands) IsTagAnnotated(tagName string) (bool, error)
func (*TagCommands) LocalDelete ¶ added in v0.41.0
func (self *TagCommands) LocalDelete(tagNames []string) error
func (*TagCommands) ShowAnnotationInfo ¶ added in v0.53.0
func (self *TagCommands) ShowAnnotationInfo(tagName string) (string, error)
Return info about an annotated tag in the format:
Tagger: tagger name <tagger email> TaggerDate: tagger date Tag message
Should only be called for annotated tags.
type TagLoader ¶ added in v0.36.0
func NewTagLoader ¶ added in v0.36.0
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) AllRepoFiles ¶ added in v0.57.0
func (self *WorkingTreeCommands) AllRepoFiles() ([]string, error)
Returns all tracked files in the repo (not in the working tree). The returned entries are relative paths to the repo root, using '/' as the path separator on all platforms. Does not really belong in WorkingTreeCommands, but it's close enough, and we don't seem to have a better place for it right now.
func (*WorkingTreeCommands) BeforeAndAfterFileForRename ¶
func (*WorkingTreeCommands) CheckoutFile ¶
func (self *WorkingTreeCommands) CheckoutFile(commitHash, fileName string) error
CheckoutFile checks out the file for the given commit
func (*WorkingTreeCommands) DiscardAllDirChanges ¶
func (self *WorkingTreeCommands) DiscardAllDirChanges(nodes []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(nodes []IFileNode) error
func (*WorkingTreeCommands) DiscardUnstagedFileChanges ¶
func (self *WorkingTreeCommands) DiscardUnstagedFileChanges(file *models.File) error
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) HasChangesToTrackedFiles ¶ added in v0.66.0
func (self *WorkingTreeCommands) HasChangesToTrackedFiles(worktreeGitDir string, worktreePath string) (bool, error)
Returns whether the given worktree has changes to tracked files, either in its working tree or in its index. Untracked files don't count, and neither do submodules. A submodule that is checked out at a different commit than the one recorded, or that has changes of its own, doesn't get in the way of moving the branch, because moving it leaves the submodules alone. Pass empty strings for the worktree to use the current one.
func (*WorkingTreeCommands) Ignore ¶
func (self *WorkingTreeCommands) Ignore(filename string) error
Ignore adds a file to the gitignore for the repo
func (*WorkingTreeCommands) MergeFileForFiles ¶ added in v0.56.0
func (*WorkingTreeCommands) MergeFileForObjectIDs ¶ added in v0.56.0
func (self *WorkingTreeCommands) MergeFileForObjectIDs(strategy string, oursID string, baseID string, theirsID string) (string, error)
OIDs mode (Git 2.43+)
func (*WorkingTreeCommands) ObjectIDAtStage ¶ added in v0.56.0
func (self *WorkingTreeCommands) ObjectIDAtStage(path string, stage int) (string, error)
func (*WorkingTreeCommands) OpenMergeToolCmdObj ¶
func (self *WorkingTreeCommands) OpenMergeToolCmdObj() *oscommands.CmdObj
func (*WorkingTreeCommands) RemoveConflictedFile ¶ added in v0.49.0
func (self *WorkingTreeCommands) RemoveConflictedFile(name string) error
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
ResetHard runs `git reset --hard`
func (*WorkingTreeCommands) ResetKeep ¶ added in v0.66.0
func (self *WorkingTreeCommands) ResetKeep(ref string, worktreeGitDir string, worktreePath string) error
ResetKeep runs `git reset --keep` in the given worktree, which moves the checked out branch to the given ref while keeping local modifications. It fails rather than overwriting a file that differs between the two commits. Pass empty strings for the worktree to use the current one.
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) ShowFileAtStage ¶ added in v0.56.0
func (self *WorkingTreeCommands) ShowFileAtStage(path string, stage int) (string, error)
func (*WorkingTreeCommands) ShowFileDiff ¶
func (self *WorkingTreeCommands) ShowFileDiff(from string, to string, reverse bool, fileName string, previousPath string, mode DiffMode) (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. For a renamed file, previousPath is the path it was renamed from (empty otherwise); both paths must be passed to git for the rename to be detected.
func (*WorkingTreeCommands) ShowFileDiffCmdObj ¶
func (self *WorkingTreeCommands) ShowFileDiffCmdObj(from string, to string, reverse bool, fileNames []string, mode DiffMode) *oscommands.CmdObj
func (*WorkingTreeCommands) StageAll ¶
func (self *WorkingTreeCommands) StageAll(onlyTrackedFiles bool) 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, extraArgs []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 ¶ added in v0.41.0
func (self *WorkingTreeCommands) UnstageTrackedFiles(paths []string) error
func (*WorkingTreeCommands) UnstageUntrackedFiles ¶ added in v0.41.0
func (self *WorkingTreeCommands) UnstageUntrackedFiles(paths []string) error
func (*WorkingTreeCommands) WorktreeFileDiff ¶
func (self *WorkingTreeCommands) WorktreeFileDiff(file *models.File, mode DiffMode, cached bool) string
WorktreeFileDiff returns the diff of a file
func (*WorkingTreeCommands) WorktreeFileDiffCmdObj ¶
func (self *WorkingTreeCommands) WorktreeFileDiffCmdObj(node models.IFile, mode DiffMode, cached bool, paths []string) *oscommands.CmdObj
WorktreeFileDiffCmdObj returns a command object for diffing the given paths in the working tree. node is the item they belong to; all it decides is whether git has to compare against /dev/null, which is the case for a file that isn't in the index yet.
type WorktreeCommands ¶ added in v0.40.0
type WorktreeCommands struct {
*GitCommon
}
func NewWorktreeCommands ¶ added in v0.40.0
func NewWorktreeCommands(gitCommon *GitCommon) *WorktreeCommands
func (*WorktreeCommands) Delete ¶ added in v0.40.0
func (self *WorktreeCommands) Delete(worktreePath string, force bool) error
func (*WorktreeCommands) Detach ¶ added in v0.40.0
func (self *WorktreeCommands) Detach(worktreePath string) error
func (*WorktreeCommands) New ¶ added in v0.40.0
func (self *WorktreeCommands) New(opts NewWorktreeOpts) error
type WorktreeLoader ¶ added in v0.40.0
type WorktreeLoader struct {
*GitCommon
}
func NewWorktreeLoader ¶ added in v0.40.0
func NewWorktreeLoader(gitCommon *GitCommon) *WorktreeLoader
func (*WorktreeLoader) GetWorktrees ¶ added in v0.40.0
func (self *WorktreeLoader) GetWorktrees() ([]*models.Worktree, error)
Source Files
¶
- ahead_behind.go
- bisect.go
- bisect_info.go
- blame.go
- branch.go
- branch_loader.go
- commit.go
- commit_file_loader.go
- commit_loader.go
- commit_loading_shared.go
- common.go
- config.go
- custom.go
- diff.go
- diff_mode.go
- file.go
- file_loader.go
- flow.go
- git_command_builder.go
- github.go
- hosting_service.go
- main_branches.go
- patch.go
- rebase.go
- ref_ancestry.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