helpers

package
v0.66.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 57 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REBASE_OPTION_CONTINUE string = "continue"
	REBASE_OPTION_ABORT    string = "abort"
	REBASE_OPTION_SKIP     string = "skip"
)
View Source
const DiffStatLinkScheme = "lazygit-diff-file://"

DiffStatLinkScheme names a link to a file of the diff the pane is showing, as lazygit-edit names one that opens a file in the editor. The link is never handed to the terminal — gocui takes the escape sequence out of the content and gives the URL back when the cell it covers is clicked — so the path in it needs no escaping.

Variables

This section is empty.

Functions

func AnyStagedFiles added in v0.50.0

func AnyStagedFiles(files []*models.File) bool

func AnyStagedFilesExceptSubmodules added in v0.56.0

func AnyStagedFilesExceptSubmodules(files []*models.File, submoduleConfigs []*models.SubmoduleConfig) bool

func AnyTrackedFiles added in v0.50.0

func AnyTrackedFiles(files []*models.File) bool

func AnyTrackedFilesExceptSubmodules added in v0.56.0

func AnyTrackedFilesExceptSubmodules(files []*models.File, submoduleConfigs []*models.SubmoduleConfig) bool

func AnyTrackedFilesInPathExceptSubmodules added in v0.58.0

func AnyTrackedFilesInPathExceptSubmodules(path string, files []*models.File, submoduleConfigs []*models.SubmoduleConfig) bool

func BranchesBelowInStack added in v0.66.0

func BranchesBelowInStack(
	commits []*models.Commit,
	branches []*models.Branch,
	branch *models.Branch,
	mainBranches []string,
) []*models.Branch

Returns the branches stacked below the given branch: those whose tip is one of the given commits of the branch that hasn't been merged into a main branch yet. The branch itself and the main branches are left out. The result is in the order in which the tips appear in commits, so the branch closest to the given one comes first.

Only the commits passed in are looked at, so a branch whose tip is further down the history than the loaded commits is not found.

func FilterFunc added in v0.41.0

func FilterFunc(options []string, useFuzzySearch bool) func(string) []*types.Suggestion

func GetUnstagedFilesExceptSubmodules added in v0.61.0

func GetUnstagedFilesExceptSubmodules(files []*models.File, submoduleConfigs []*models.SubmoduleConfig) []string

func GetWindowDimensions added in v0.41.0

func GetWindowDimensions(args WindowArrangementArgs) map[string]boxlayout.Dimensions

func IsFixupCommit added in v0.59.0

func IsFixupCommit(subject string) (string, bool)

Check whether the given subject line is the subject of a fixup commit, and returns (trimmedSubject, true) if so (where trimmedSubject is the subject with all fixup prefixes removed), or (subject, false) if not.

func IsSwitchBranchUncommittedChangesError added in v0.45.0

func IsSwitchBranchUncommittedChangesError(err error) bool

func IsWorkingTreeDirtyExceptSubmodules added in v0.56.0

func IsWorkingTreeDirtyExceptSubmodules(files []*models.File, submoduleConfigs []*models.SubmoduleConfig) bool

func MergeMaps added in v0.39.0

func MergeMaps[K comparable, V any](maps ...map[K]V) map[K]V

func SanitizedBranchName added in v0.41.0

func SanitizedBranchName(input string) string

SanitizedBranchName will remove all spaces in favor of a dash "-" to meet git's branch naming requirement.

func ScopesToRefreshWhenFilteringModeChanges added in v0.54.0

func ScopesToRefreshWhenFilteringModeChanges() []types.RefreshableView

Stashes really only need to be refreshed when filtering by path, not by author, but it's too much work to distinguish this, and refreshing stashes is fast, so we don't bother

func ShortBranchName added in v0.43.0

func ShortBranchName(fullBranchName string) string

func TryRemoveHardLineBreaks added in v0.41.0

func TryRemoveHardLineBreaks(message string, autoWrapWidth int) string

func WithInlineStatusOnItems added in v0.66.0

func WithInlineStatusOnItems[T types.HasUrn](c *HelperCommon, items []T, operation types.ItemOperation, contextKey types.ContextKey, f func(gocui.Task) error) error

Runs f on a worker with all the given items shown as being in the given operation while it runs

Types

type AmendHelper added in v0.38.0

type AmendHelper struct {
	// contains filtered or unexported fields
}

func NewAmendHelper added in v0.38.0

func NewAmendHelper(
	c *HelperCommon,
	gpg *GpgHelper,
) *AmendHelper

func (*AmendHelper) AmendHead added in v0.38.0

func (self *AmendHelper) AmendHead() error

type AppStatusHelper added in v0.39.0

type AppStatusHelper struct {
	// contains filtered or unexported fields
}

func NewAppStatusHelper added in v0.39.0

func NewAppStatusHelper(c *HelperCommon, statusMgr func() *status.StatusManager, modeHelper *ModeHelper) *AppStatusHelper

func (*AppStatusHelper) GetStatusString added in v0.39.0

func (self *AppStatusHelper) GetStatusString() string

func (*AppStatusHelper) HasStatus added in v0.39.0

func (self *AppStatusHelper) HasStatus() bool

func (*AppStatusHelper) Toast added in v0.39.0

func (self *AppStatusHelper) Toast(message string, kind types.ToastKind)

func (*AppStatusHelper) WithWaitingStatus added in v0.39.0

func (self *AppStatusHelper) WithWaitingStatus(message string, f func(gocui.Task) error)

WithWaitingStatus wraps a function and shows a waiting status while the function is still executing

func (*AppStatusHelper) WithWaitingStatusBlockingInput added in v0.64.0

func (self *AppStatusHelper) WithWaitingStatusBlockingInput(opts types.WaitingStatusOpts, f func(gocui.Task) error)

WithWaitingStatusBlockingInput is like WithWaitingStatus, but it also blocks keyboard input for the whole duration of the operation: keys the user presses while it runs are buffered and replayed against the post-operation state (see gocui.BeginBlockingEvents). Use it for operations whose following keypress depends on the state they produce, e.g. ones that manipulate an in-progress rebase or otherwise rewrite commits, where a racing keypress would target the wrong commit or todo.

Must be called on the UI thread: the block is begun synchronously here, before the operation is dispatched to a worker, so no keypress can slip through in between.

func (*AppStatusHelper) WithWaitingStatusImpl added in v0.46.0

func (self *AppStatusHelper) WithWaitingStatusImpl(message string, f func(gocui.Task) error, task gocui.Task) error

WithWaitingStatusImpl is WithWaitingStatus for callers that already run on a goroutine of their own (e.g. the auto-fetch poller) rather than wanting the work dispatched to a worker. task is used to hide the status while the task is paused; it may be nil for callers whose f ignores its task.

type BisectHelper

type BisectHelper struct {
	// contains filtered or unexported fields
}

func NewBisectHelper

func NewBisectHelper(c *HelperCommon) *BisectHelper

func (*BisectHelper) PostBisectCommandRefresh

func (self *BisectHelper) PostBisectCommandRefresh()

func (*BisectHelper) Reset

func (self *BisectHelper) Reset() error

type BranchesHelper added in v0.41.0

type BranchesHelper struct {
	// contains filtered or unexported fields
}

func NewBranchesHelper added in v0.41.0

func NewBranchesHelper(c *HelperCommon, worktreeHelper *WorktreeHelper) *BranchesHelper

func (*BranchesHelper) AutoForwardBranches added in v0.50.0

func (self *BranchesHelper) AutoForwardBranches(background bool)

Reads the branches from the model, so it must be called on the UI thread; the git work happens on a worker.

func (*BranchesHelper) ConfirmDeleteRemote added in v0.41.0

func (self *BranchesHelper) ConfirmDeleteRemote(remoteBranches []*models.RemoteBranch, resetRemoteBranchesSelection bool) error

func (*BranchesHelper) ConfirmLocalAndRemoteDelete added in v0.45.0

func (self *BranchesHelper) ConfirmLocalAndRemoteDelete(branches []*models.Branch) error

func (*BranchesHelper) ConfirmLocalDelete added in v0.45.0

func (self *BranchesHelper) ConfirmLocalDelete(branches []*models.Branch) error

func (*BranchesHelper) FastForwardBranches added in v0.66.0

func (self *BranchesHelper) FastForwardBranches(branches []*models.Branch) error

Updates the given branches to their upstream branches, fetching those first. A branch that is behind its upstream is moved forward to it; one that has diverged from it is reset to it, as long as it has no commits of its own. If any of the branches can't be updated, none of them is.

func (*BranchesHelper) PostFetchRefresh added in v0.62.0

func (self *BranchesHelper) PostFetchRefresh(fetchErr error, background bool, fetchGeneration int) error

fetchGeneration must be the repo generation from when the fetch started, captured by the caller before running the fetch: the background fetch doesn't block repo switching and is a network call, so the window in which the user can switch repos spans the whole fetch, not just this refresh.

func (*BranchesHelper) PrepareFastForward added in v0.66.0

func (self *BranchesHelper) PrepareFastForward(branches []*models.Branch) (func(gocui.Task) error, error)

Does the part of FastForwardBranches that looks at the model, and so has to run on the UI thread. Returns the rest, which is to be run on a worker; this lets other operations include the fast-forward in their own task.

func (*BranchesHelper) RemoveWorktreeAndDeleteBothBranches added in v0.63.0

func (self *BranchesHelper) RemoveWorktreeAndDeleteBothBranches(
	worktree *models.Worktree, branch *models.Branch,
) error

RemoveWorktreeAndDeleteBothBranches is like RemoveWorktreeAndDeleteBranch but also deletes the branch's upstream.

func (*BranchesHelper) RemoveWorktreeAndDeleteBranch added in v0.63.0

func (self *BranchesHelper) RemoveWorktreeAndDeleteBranch(
	worktree *models.Worktree, branch *models.Branch,
) error

RemoveWorktreeAndDeleteBranch removes the worktree and deletes the local branch it has checked out, force-warning first if the branch isn't fully merged. It's the worktrees-panel counterpart to deleting a worktree-checked-out branch from the branches panel.

func (*BranchesHelper) WithInlineStatusOnBranches added in v0.66.0

func (self *BranchesHelper) WithInlineStatusOnBranches(branches []*models.Branch, operation types.ItemOperation, f func(gocui.Task) error) error

Runs f on a worker with all the given branches shown as being in the given operation while it runs

type CherryPickHelper

type CherryPickHelper struct {
	// contains filtered or unexported fields
}

func NewCherryPickHelper

func NewCherryPickHelper(
	c *HelperCommon,
	rebaseHelper *MergeAndRebaseHelper,
) *CherryPickHelper

func (*CherryPickHelper) CanPaste added in v0.41.0

func (self *CherryPickHelper) CanPaste() bool

func (*CherryPickHelper) CopyRange

func (self *CherryPickHelper) CopyRange(commitsList []*models.Commit, context types.IListContext) error

func (*CherryPickHelper) Paste

func (self *CherryPickHelper) Paste() error

HandlePasteCommits begins a cherry-pick rebase with the commits the user has copied. Only to be called from the branch commits controller

func (*CherryPickHelper) Reset

func (self *CherryPickHelper) Reset() error

type CommitsHelper added in v0.38.0

type CommitsHelper struct {
	// contains filtered or unexported fields
}

func NewCommitsHelper added in v0.38.0

func NewCommitsHelper(
	c *HelperCommon,
	getCommitSummary func() string,
	setCommitSummary func(string),
	getCommitDescription func() string,
	getUnwrappedCommitDescription func() string,
	setCommitDescription func(string),
) *CommitsHelper

func (*CommitsHelper) ClearPreservedCommitMessage added in v0.51.0

func (self *CommitsHelper) ClearPreservedCommitMessage()

func (*CommitsHelper) CloseCommitMessagePanel added in v0.38.0

func (self *CommitsHelper) CloseCommitMessagePanel()

func (*CommitsHelper) HandleCommitConfirm added in v0.38.0

func (self *CommitsHelper) HandleCommitConfirm() error

func (*CommitsHelper) JoinCommitMessageAndUnwrappedDescription added in v0.41.0

func (self *CommitsHelper) JoinCommitMessageAndUnwrappedDescription() string

func (*CommitsHelper) OpenCommitMenu added in v0.41.0

func (self *CommitsHelper) OpenCommitMenu(suggestionFunc func(string) []*types.Suggestion) error

func (*CommitsHelper) OpenCommitMessagePanel added in v0.38.0

func (self *CommitsHelper) OpenCommitMessagePanel(opts *OpenCommitMessagePanelOpts)

func (*CommitsHelper) PreserveCommitMessage added in v0.62.0

func (self *CommitsHelper) PreserveCommitMessage()

func (*CommitsHelper) SetMessageAndDescriptionInView added in v0.38.0

func (self *CommitsHelper) SetMessageAndDescriptionInView(message string)

func (*CommitsHelper) SetPreservedMessageInView added in v0.62.0

func (self *CommitsHelper) SetPreservedMessageInView(message string)

func (*CommitsHelper) SplitCommitMessageAndDescription added in v0.38.0

func (self *CommitsHelper) SplitCommitMessageAndDescription(message string) (string, string)

SplitCommitMessageAndDescription splits a message in git's canonical format (summary and body separated by a blank line) into summary and description.

func (*CommitsHelper) SplitPreservedCommitMessage added in v0.62.0

func (self *CommitsHelper) SplitPreservedCommitMessage(message string) (string, string)

SplitPreservedCommitMessage splits a message in our preservation format (summary and description joined by a single "\n") into summary and description. It is lossless: round-tripping through JoinCommitMessageAndUnwrappedDescription preserves the exact content.

func (*CommitsHelper) SwitchToEditor added in v0.41.0

func (self *CommitsHelper) SwitchToEditor() error

type ConfirmationHelper added in v0.39.0

type ConfirmationHelper struct {
	// contains filtered or unexported fields
}

func NewConfirmationHelper added in v0.39.0

func NewConfirmationHelper(c *HelperCommon) *ConfirmationHelper

func (*ConfirmationHelper) CreatePopupPanel added in v0.39.0

func (self *ConfirmationHelper) CreatePopupPanel(ctx goContext.Context, opts types.CreatePopupPanelOpts)

func (*ConfirmationHelper) DeactivateConfirmation added in v0.55.0

func (self *ConfirmationHelper) DeactivateConfirmation()

func (*ConfirmationHelper) DeactivatePrompt added in v0.55.0

func (self *ConfirmationHelper) DeactivatePrompt()

func (*ConfirmationHelper) IsPopupPanel added in v0.39.0

func (self *ConfirmationHelper) IsPopupPanel(context types.Context) bool

func (*ConfirmationHelper) IsPopupPanelFocused added in v0.39.0

func (self *ConfirmationHelper) IsPopupPanelFocused() bool

func (*ConfirmationHelper) ResizeCommitMessagePanels added in v0.39.0

func (self *ConfirmationHelper) ResizeCommitMessagePanels(parentPopupContext types.Context)

func (*ConfirmationHelper) ResizeCurrentPopupPanels added in v0.43.0

func (self *ConfirmationHelper) ResizeCurrentPopupPanels()

func (*ConfirmationHelper) TooltipForMenuItem added in v0.41.0

func (self *ConfirmationHelper) TooltipForMenuItem(menuItem *types.MenuItem) string

type CredentialsHelper

type CredentialsHelper struct {
	// contains filtered or unexported fields
}

func NewCredentialsHelper

func NewCredentialsHelper(
	c *HelperCommon,
) *CredentialsHelper

func (*CredentialsHelper) PromptUserForCredential

func (self *CredentialsHelper) PromptUserForCredential(passOrUname oscommands.CredentialType) <-chan string

PromptUserForCredential wait for a username, password or passphrase input from the credentials popup We return a channel rather than returning the string directly so that the calling function knows when the prompt has been created (before the user has entered anything) so that it can note that we're now waiting on user input and lazygit isn't processing anything.

type CustomPatchHelper added in v0.66.0

type CustomPatchHelper struct {
	// contains filtered or unexported fields
}

func NewCustomPatchHelper added in v0.66.0

func NewCustomPatchHelper(c *HelperCommon) *CustomPatchHelper

func (*CustomPatchHelper) Reset added in v0.66.0

func (self *CustomPatchHelper) Reset() error

type DiffHelper added in v0.39.0

type DiffHelper struct {
	// contains filtered or unexported fields
}

func NewDiffHelper added in v0.39.0

func NewDiffHelper(c *HelperCommon, diffLineHelper *DiffLineHelper) *DiffHelper

func (*DiffHelper) AdjustLineNumber added in v0.45.0

func (self *DiffHelper) AdjustLineNumber(path string, linenumber int, viewname string) int

AdjustLineNumber is used to adjust a line number in the diff that's currently being viewed, so that it corresponds to the line number in the actual working copy state of the file. It is used when clicking on a delta hyperlink in a diff, or when pressing `e` in a focused diff. It works by getting a diff of what's being viewed in the main view against the working copy, and then using that diff to adjust the line number. path is the file path of the file being viewed linenumber is the line number to adjust (one-based) viewname is the name of the view that shows the diff. We need to pass it because the diff adjustment is slightly different depending on which view is showing the diff.

func (*DiffHelper) CurrentDiffTerminals added in v0.39.0

func (self *DiffHelper) CurrentDiffTerminals() []string

CurrentDiffTerminals returns the current diff terminals of the currently selected item. in the case of a branch it returns both the branch and it's upstream name, which becomes an option when you bring up the diff menu, but when you're just flicking through branches it will be using the local branch name.

func (*DiffHelper) DiffArgs added in v0.39.0

func (self *DiffHelper) DiffArgs() []string

func (*DiffHelper) ExitDiffMode added in v0.39.0

func (self *DiffHelper) ExitDiffMode() error

func (*DiffHelper) FilterPathsForCommit added in v0.54.0

func (self *DiffHelper) FilterPathsForCommit(commit *models.Commit) []string

func (*DiffHelper) GetUpdateTaskForRenderingCommitsDiff added in v0.44.0

func (self *DiffHelper) GetUpdateTaskForRenderingCommitsDiff(commit *models.Commit, refRange *types.RefRange) types.UpdateTask

Returns an update task that can be passed to RenderToMainViews to render a diff for the selected commit(s). We need to pass both the selected commit and the refRange for a range selection. If the refRange is nil (meaning that either there's no range, or it can't be diffed for some reason), then we want to fall back to rendering the diff for the single commit.

func (*DiffHelper) IgnoringWhitespaceSubTitle added in v0.39.0

func (self *DiffHelper) IgnoringWhitespaceSubTitle() string

func (*DiffHelper) OpenDiffToolForRef added in v0.43.0

func (self *DiffHelper) OpenDiffToolForRef(selectedRef models.Ref) error

func (*DiffHelper) PlainDiffBetweenRefs added in v0.66.0

func (self *DiffHelper) PlainDiffBetweenRefs(from string, to string, paths []string) string

PlainDiffBetweenRefs returns the diff of the given files between two refs as git writes it, without colour or a diff renderer's involvement — what a panel showing a commit's diff hands out as the diff behind its rendering (see types.FocusedMainViewDiffSource). It honours diffing mode, so that the diff is of the same two ends the main view is showing.

func (*DiffHelper) RenderDiff added in v0.39.0

func (self *DiffHelper) RenderDiff()

func (*DiffHelper) RenderToMainAgain added in v0.66.0

func (self *DiffHelper) RenderToMainAgain()

RenderToMainAgain renders the current side panel into the main view again, if that is what the main view shows. This is for when something that the rendering depends on has changed, such as the diff renderer.

func (*DiffHelper) WithDiffModeCheck added in v0.39.0

func (self *DiffHelper) WithDiffModeCheck(f func())

type DiffLineHelper added in v0.66.0

type DiffLineHelper struct {
	// contains filtered or unexported fields
}

func NewDiffLineHelper added in v0.66.0

func NewDiffLineHelper(c *HelperCommon) *DiffLineHelper

func (*DiffLineHelper) AdjacentChangeBlock added in v0.66.0

func (self *DiffLineHelper) AdjacentChangeBlock(view *gocui.View, anchorViewLine int, forward bool) (int, bool)

AdjacentChangeBlock returns the view line to move to for next/previous change-block navigation in view's rendered diff, starting from anchorViewLine. A change block is lazygit's notion of a hunk (see ChangeBlockBounds). forward=true targets the start of the next block, forward=false the start of the previous one — from mid-block that means the previous block, rather than the one we are in. ok is false when there's no further block, so the caller leaves the view where it is.

func (*DiffLineHelper) AdjacentFile added in v0.66.0

func (self *DiffLineHelper) AdjacentFile(view *gocui.View, anchorViewLine int, forward bool) (int, bool)

AdjacentFile returns the view line to move to for next/previous file navigation in view's (possibly multi-file) rendered diff, starting from anchorViewLine: the first located row of the neighbouring file, found where the rows' file changes. ok is false at the first or last file.

func (*DiffLineHelper) ChangeBlockBounds added in v0.66.0

func (self *DiffLineHelper) ChangeBlockBounds(view *gocui.View, anchorViewLine int) (int, int, bool)

ChangeBlockBounds returns the inclusive view-line range of the change block to select in hunk mode around anchorViewLine. A change block is lazygit's notion of a hunk — a run of consecutive added or deleted lines bounded by context, of which a single git @@ hunk may hold several. When the anchor is context, the block used is the first at or below it, or — with nothing below, the cursor sitting past the last change — the nearest above, so that hunk mode always has a block to select. ok is false only when the diff holds no change line at all.

func (*DiffLineHelper) ChangeLineOrdinal added in v0.66.0

func (self *DiffLineHelper) ChangeLineOrdinal(view *gocui.View, bufferLine int) int

ChangeLineOrdinal returns how many change lines of view's rendered diff come before the given buffer line — that line's place in the sequence of changes.

It is how a place in a diff is remembered across acting on it: an action consumes the lines it acted on, so the identity of the line the user was on is gone, but the place it left behind is the same one that identity used to have.

func (*DiffLineHelper) ChangeLineOrdinals added in v0.66.0

func (self *DiffLineHelper) ChangeLineOrdinals(
	diff string, infos []types.DiffLineInfo,
) map[string][]int

ChangeLineOrdinals says, for each of the given change lines, which of its file's changes it is in the given diff — its place among them, counted from the top of the file — keyed by file. Lines the diff doesn't have are left out.

It is how a line is named in something built out of a diff rather than being that diff: the custom patch holds the lines it was given in the order the file has them, so a place among a file's changes is a line of the patch.

func (*DiffLineHelper) ChangeLinesInBufferRange added in v0.66.0

func (self *DiffLineHelper) ChangeLinesInBufferRange(view *gocui.View, first int, last int) []types.DiffLineInfo

ChangeLinesInBufferRange returns the change lines — the additions and deletions — among the diff lines shown by the rows in the inclusive buffer-line range. Those are the lines a patch is built from: a patch carries whatever context it needs around them by itself, so a selection contributes only its changes.

func (*DiffLineHelper) CollapseNonStickyRange added in v0.66.0

func (self *DiffLineHelper) CollapseNonStickyRange(pane types.DiffPaneContext)

CollapseNonStickyRange drops a range that only grows while shift is held back to a single line at the cursor.

func (*DiffLineHelper) DiffLinesInBufferRange added in v0.66.0

func (self *DiffLineHelper) DiffLinesInBufferRange(view *gocui.View, first int, last int) []types.DiffLineInfo

DiffLinesInBufferRange returns the identity of every diff line shown by the rows in the inclusive buffer-line range [first, last] of view's rendered diff, in display order. Rows whose identity can't be recovered are left out.

The range is what a selection covers (see View.SelectedBufferLineRange). It is given in buffer lines because a buffer line stays on its line of the content however the view wraps it, so the selection can be read when a key is pressed and acted on after the view has changed.

A row can show more than one diff line — a side-by-side rendering puts a deletion beside the addition replacing it — and all of them are reported: what the user pointed at is the row, so everything on it is selected.

func (*DiffLineHelper) DiffRowsCanBePlaced added in v0.66.0

func (self *DiffLineHelper) DiffRowsCanBePlaced() bool

DiffRowsCanBePlaced reports whether the rows of the diff the main view is about to be given can be placed in the file they show. git's own diff describes itself, whether it is what the user configured or what MainViewDiffMode is about to substitute for a rendering that can't be acted on; any other rendering says where its rows belong only if it states records for them.

It is what anything that means to go from a row back to the file it shows has to ask first: with neither records nor a diff that describes itself, there is nothing to go on, and offering the user the way there would be offering nothing.

func (*DiffLineHelper) EstablishSelection added in v0.66.0

func (self *DiffLineHelper) EstablishSelection(mainContext *context.MainContext, clickedViewLine int)

EstablishSelection turns on the focused main view's selection once the view has been focused. clickedViewLine is the view line a click pointed at, or -1 for keyboard focus, which points at no particular line and so starts at the first change line on screen.

Focusing never moves the view: you focus the diff you are reading in order to point at something in it, so the selection goes where you are looking rather than the view going where the selection would like to be. With no change line on screen at all — a long stretch of context — it lands on the middle visible line, the likeliest one to be the one being read.

With hunk mode configured as the default the selection widens to the whole change block: keyboard focus lands on the first block on screen, and a click on a change line selects that line's block, ready to act on. A click on context still selects just that line — the click points at it precisely, so it stays editable.

func (*DiffLineHelper) FilesInDiff added in v0.66.0

func (self *DiffLineHelper) FilesInDiff(view *gocui.View) []string

FilesInDiff lists the files of view's (possibly multi-file) rendered diff, in the order it shows them, by the paths of the repo's files. It is what a menu offering to jump between them is built from; jumping to one of them goes to StartOfFileInDiff.

func (*DiffLineHelper) FirstChangeBlockInView added in v0.66.0

func (self *DiffLineHelper) FirstChangeBlockInView(view *gocui.View) (int, bool)

FirstChangeBlockInView returns the view line of the first change block on screen: the first one that *begins* in the viewport, and failing that the one that reaches into the viewport from above, whose start is off screen. Hunk mode wants that order for the block it offers up on focus: preferably a block whose beginning the user can see, rather than the tail of one they have scrolled past the start of. The block bleeding in from above is kept as the answer for a change too long to fit on screen, where there is no other. ok is false when the viewport shows no change line.

func (*DiffLineHelper) FirstChangeLineInView added in v0.66.0

func (self *DiffLineHelper) FirstChangeLineInView(view *gocui.View) (int, bool)

FirstChangeLineInView returns the view line of the first change line on screen. It is where the selection goes when the main view is focused by keyboard: focusing a diff you are reading points at something in it without moving it, so the search stops at the bottom of the viewport rather than going after a change further down. ok is false when the viewport holds no change line — scrolled into a long stretch of context, or past the last change.

func (*DiffLineHelper) GetDiffLineInfo added in v0.66.0

func (self *DiffLineHelper) GetDiffLineInfo(view *gocui.View, viewLineIdx int) (types.DiffLineInfo, bool)

GetDiffLineInfo recovers the identity — file, kind, and old/new line number — of the diff row at the given (wrapped) view line of the given view. It is the seam every consumer of a diff row goes through, so that how we recover that identity can change without them noticing.

There are two ways, and which one is used is settled for the rendering as a whole (see renderingStatesDiffLines). A diff renderer that speaks the OSC 1717 protocol states the identity of each line it renders. That is the only way to recover it from a rendering that doesn't look like a diff any more (columns, or +/- markers replaced by colour), and a row such a renderer says nothing about has no identity. Otherwise we parse the view's contents as a unified diff; this works for the renderings that keep a diff's structure (no renderer, `git diff --color`, a renderer that only colorizes) and fails for the rest.

ok is false when the row's identity can't be recovered, in which case the caller must not act on the line at all.

func (*DiffLineHelper) IsChangeLine added in v0.66.0

func (self *DiffLineHelper) IsChangeLine(view *gocui.View, viewLineIdx int) bool

IsChangeLine reports whether the given view line of view's rendered diff is a change line rather than context, a header, or an unresolvable row — i.e. whether pointing at it points at something a patch could be built from.

func (*DiffLineHelper) IsSingleHunkForWholeFile added in v0.66.0

func (self *DiffLineHelper) IsSingleHunkForWholeFile(view *gocui.View, changeViewLine int) bool

IsSingleHunkForWholeFile reports whether the file the given change line belongs to is shown as one solid block of changes — every row of its diff a change of the same kind, no context — which is what a newly added or deleted file looks like. That is the case where widening the selection to the change block would select the file entire, so hunk mode drops to a single line there instead.

It says false while the diff is still being read in, since the rows that would answer otherwise — a context line, a change of the other kind — may not have arrived yet. That errs towards hunk mode, which is what the user asked for.

func (*DiffLineHelper) JumpToFileNamedInDiffStat added in v0.66.0

func (self *DiffLineHelper) JumpToFileNamedInDiffStat(pane types.DiffPaneContext, entry string)

JumpToFileNamedInDiffStat goes to the file of the pane's diff that the given diffstat entry names, for a click on the link made for that entry. It lands the way picking the file from the menu of the diff's files does.

The diff is read to the end first, as it is for that menu. The diffstat is on screen only while the view is at the top of the diff, so the file clicked is nearly always below the part of it that has been read.

func (*DiffLineHelper) MainViewDiffMode added in v0.66.0

func (self *DiffLineHelper) MainViewDiffMode() git_commands.DiffMode

MainViewDiffMode says how a side panel should produce the diff it renders into the main view: as the user configured it, or as git's own — while the main view holds focus and what the renderer would produce couldn't be acted on.

Every panel that renders a diff into the main view asks, so that a re-render while focused — after staging a hunk, say — stays with git's own diff rather than flipping back to the renderer's.

func (*DiffLineHelper) OpenJumpToFileMenu added in v0.66.0

func (self *DiffLineHelper) OpenJumpToFileMenu(pane types.DiffPaneContext, title string) error

OpenJumpToFileMenu offers the files of the diff the given pane is showing in a menu, so that one of them can be gone to directly rather than by stepping through the diff a file at a time. Picking one goes to where that file's diff begins, the way stepping to it with next-file does: the selection moves there in a focused pane, and an unfocused one scrolls the file to the top.

The diff is read to the end before the menu is built: a file below the part of it that has been read so far is in neither the list nor the view, and reaching the far end of a long diff is what the menu is for.

func (*DiffLineHelper) PlaceNavigationTarget added in v0.66.0

func (self *DiffLineHelper) PlaceNavigationTarget(
	pane types.DiffPaneContext, target int, alignTop bool,
)

PlaceNavigationTarget moves the pane's selection to the row a jump found, bringing it on screen if it isn't already. With no selection to move — a pane that isn't focused, or one showing a diff with nothing selectable in it — the row goes to the top of the view instead, that being all a jump can do there.

alignTop asks for the target to become the view's top line, so that everything that begins there is on screen. It only applies to a target the view has to scroll to: a jump to something already on screen leaves the view alone, there being nothing to gain from moving what the user is looking at. In hunk mode what ends up selected is the first change block at or below the target, which a large context size can put further down than a screenful; the selection is then scrolled into view as any other jump's is, and the alignment gives way to that.

func (*DiffLineHelper) PlainDiffOfSelection added in v0.66.0

func (self *DiffLineHelper) PlainDiffOfSelection(
	view *gocui.View, first int, last int, plainDiff func(paths []string) string,
) (aboveDiff string, fromDiff string)

PlainDiffOfSelection returns the text of the rows a selection covers in view, the inclusive buffer-line range [first, last] (see DiffLinesInBufferRange), in two parts.

aboveDiff is what the selection covers above the diff, as it reads on screen; see textAboveDiff. fromDiff is the diff behind the rest: per file the selection touches, the run of diff lines from the first of its selected lines to the last, with the files in the order the selection meets them.

A run, rather than the matched lines alone, so that what comes out reads as a diff: the lines between two selected ones come along even when the rendering didn't show them (difftastic leaves out whitespace-only changes) or showed them in another order (a side-by-side rendering groups the deletions of a hunk before its additions).

Headers are selected lines like any other. A hunk header names the first line of its hunk, in the rendering as in the diff, so it is looked for the way a line of the file is; a file header names no line at all and a rendering may spread it over as many rows as it likes, so a selection touching one of them takes the whole header.

plainDiff fetches the diff of the given repo-relative files, and is asked only for the files the selection touches, so that copying three lines of a commit's diff doesn't fetch the whole of it. fromDiff is "" when no selected row could be found in the diff, e.g. because the selection covers nothing but a renderer's decoration.

func (*DiffLineHelper) PreserveDiffPositionOnRerender added in v0.66.0

func (self *DiffLineHelper) PreserveDiffPositionOnRerender(view *gocui.View)

PreserveDiffPositionOnRerender remembers where a diff view is and puts it back there as it next re-renders, instead of leaving the user at the top of a new rendering of the diff they were already reading. Call it on the view about to be re-rendered, right before triggering the re-render — on both panes of the main window where both are being rendered again, since either of them may hold the diff being read; a pane that isn't showing is left alone.

The line to keep is the end of the selection that is on screen, and the middle visible line when there is no selection or the whole of it has been scrolled out of sight — what the user is looking at, rather than the view's top edge or a selection they have long since left behind. It may not survive the re-render: a context line goes when the context size shrinks, and a whole hunk or file goes when whitespace stops counting. So the lines around it come along as fallbacks and the view lands on the nearest one that is still there, put back on the screen row it was on. With none of them left — and with a renderer that says nothing about its rows there is nothing to look for in the first place — the view keeps the scroll offset it had, which is still nearer to what was being read than the top of the diff.

An off-screen selection is still put back on the diff line it was on, wherever the new rendering has that; it is only the view that stays where it is.

A range or hunk selection has a second end, which is remembered the same way, so that it still covers the same lines of the diff afterwards.

func (*DiffLineHelper) RefreshInclusionGutter added in v0.66.0

func (self *DiffLineHelper) RefreshInclusionGutter()

RefreshInclusionGutter updates the marks drawn over the diff in the main pane, which say which of its lines are in the custom patch being built from it.

They are shown whenever the pane shows a diff the patch is being built from, whether or not it has the focus. The pane beside it previews the patch all the while, and the marks show the same lines from the side of the diff. A diff of some other commit gets none, since a patch built from another commit says nothing about the lines of this one.

Call it whenever either of those can have changed: as a pane's content settles, and when the patch itself changes.

func (*DiffLineHelper) RenderFocusedMainViewAgain added in v0.66.0

func (self *DiffLineHelper) RenderFocusedMainViewAgain(view *gocui.View, sidePanel types.Context, place func())

RenderFocusedMainViewAgain has the panel beneath the focused main view render its diff again — which, the main view now holding focus, is git's own diff rather than the renderer's — and calls place once that is on screen.

The whole diff is read before it is shown, rather than the first screenful: place looks at what is there to decide where to put the selection, and a change line further down would otherwise be missed.

It is the same diff of the same files, so the view keeps the scroll position it has rather than starting from the top: git lays the changes out its own way and the line the user was on is somewhere else now, but the offset still puts them among the same part of the file — and the selection is then established from what that leaves on screen.

func (*DiffLineHelper) RevealChangeLineAtOrdinal added in v0.66.0

func (self *DiffLineHelper) RevealChangeLineAtOrdinal(
	view *gocui.View, ordinal int, place func(viewLine int), done func(),
)

RevealChangeLineAtOrdinal arranges for view's next re-render to be shown with the change line at the given ordinal placed by place — the diff having changed under the user, this is where what they were doing carries on. When the new diff has fewer changes than that, because the ones acted on were its last, it lands on the last change left.

done is called once the selection is where it belongs, or once it turns out that no render is coming to put it there, for a caller that must not let the user act again in between.

func (*DiffLineHelper) RevealSelectionAfterAction added in v0.66.0

func (self *DiffLineHelper) RevealSelectionAfterAction(
	source types.DiffPaneContext, target types.DiffPaneContext, firstBufferLine int, advanceBy int, done func(),
)

RevealSelectionAfterAction moves a diff pane's selection to the change that takes the place of the one just acted on, once the changed diff has re-rendered. Call it with the pane acted in, the pane the work carries on in, and the buffer line the selection starts on, before triggering the re-render.

The line acted on is gone from the diff, so what is remembered is its place among the diff's changes: the next change moves up into it, which is where you want to be to carry on. A range collapses to a single line at its start, and hunk mode selects the whole block it lands in, so that pressing the key again acts on the next hunk. The target pane inherits that select mode, this being the same piece of work continuing in another pane — and shows no selection until the restore places one, so that what it was left showing the last time it was used doesn't appear for a frame.

advanceBy moves on by that many changes past the place remembered, for an action that leaves the diff as it was: lines taken into a custom patch are still in the commit's diff, so the place remembered is still the line acted on, and carrying on means going past the lines just dealt with rather than staying on them.

done, which may be nil, is called once the selection is where it belongs, or once it turns out that no render is coming to put it there — for a caller that must not let the user act again in between.

func (*DiffLineHelper) SelectChangeBlock added in v0.66.0

func (self *DiffLineHelper) SelectChangeBlock(
	pane types.DiffPaneContext, changeViewLine int, scrollIntoView bool,
)

SelectChangeBlock selects the whole change block around the given change line, for hunk mode: the cursor goes to the block's first line and the range anchor to its last, so the native range highlight spans the block. With no block to be found — a diff with no changes in it — it falls back to a single-line selection.

scrollIntoView brings the block's first line on screen, for the commands that mean to go there; a click leaves it false, so that the view doesn't move under the mouse when the block the click landed in starts above the viewport.

func (*DiffLineHelper) SelectedHunkBounds added in v0.66.0

func (self *DiffLineHelper) SelectedHunkBounds(view *gocui.View) (int, int, bool)

SelectedHunkBounds returns the change block selected in hunk mode. The range anchor stays on the block's far end when a click moves the cursor before its handler runs, so it still identifies the selected block.

func (*DiffLineHelper) ShowSelectionAtLine added in v0.66.0

func (self *DiffLineHelper) ShowSelectionAtLine(view *gocui.View, lineIdx int, scrollIntoView bool)

ShowSelectionAtLine moves the focused main view's selection to the given view line, clamped to the content. scrollIntoView scrolls the line into view when it's off-screen, for navigating to it; a click leaves it false, the clicked line being on screen already.

func (*DiffLineHelper) ShowsCustomPatch added in v0.66.0

func (self *DiffLineHelper) ShowsCustomPatch(view *gocui.View) bool

ShowsCustomPatch reports whether the given view is the one previewing the custom patch being built, which is the lower pane while a patch is being built from the diff in the upper one.

func (*DiffLineHelper) ShowsInclusionGutter added in v0.66.0

func (self *DiffLineHelper) ShowsInclusionGutter(view *gocui.View) bool

ShowsInclusionGutter reports whether the custom patch's marks are drawn over what the given view is being given to show: the upper main pane, while it shows the diff of a panel the patch is being built from.

It goes by what is known before the content arrives, so that a render can be laid out to the width the gutter leaves it. Whether the diff turns out to have any change lines to mark doesn't come into it.

func (*DiffLineHelper) StartOfFileInDiff added in v0.66.0

func (self *DiffLineHelper) StartOfFileInDiff(view *gocui.View, path string) (int, bool)

StartOfFileInDiff returns the view line the given file's section of view's rendered diff begins at. That is the row file navigation lands on, so jumping to a file from a menu and stepping to it with next-file land in the same place. ok is false for a file the diff doesn't show, e.g. because it was re-rendered since the file was listed.

func (*DiffLineHelper) ViewHasChangeLines added in v0.66.0

func (self *DiffLineHelper) ViewHasChangeLines(view *gocui.View) bool

ViewHasChangeLines reports whether view's rendered diff holds any change line at all, i.e. whether there is anything to select. It is false over a non-diff placeholder, and over a diff with nothing in it — an empty commit, a binary file — which are the cases where the focused main view shows no selection.

type DiffStatLinkWriter added in v0.66.0

type DiffStatLinkWriter struct {
	// contains filtered or unexported fields
}

DiffStatLinkWriter hands a pane's content on to it, turning the file names in the diffstat the content opens with into links (see DiffStatLinkScheme).

func NewDiffStatLinkWriter added in v0.66.0

func NewDiffStatLinkWriter(writer io.Writer) *DiffStatLinkWriter

func (*DiffStatLinkWriter) BeginRender added in v0.66.0

func (self *DiffStatLinkWriter) BeginRender(linkFiles bool)

BeginRender starts a fresh render, whose own diffstat is the one to look for. It is called as the render is asked for, before any of it is written.

linkFiles says whether this render is one whose file names lead anywhere: the pane's own diff, whose rows can be placed in the files they show. Either is passed through untouched without it. Content that is no diff of the panel's — a commit log, a message — has no diffstat in it, and a line of one that happens to read like an entry of a diffstat names no file to go to. A rendering whose rows nothing can place does have the files in it, but nothing to find the one a name stands for with.

func (*DiffStatLinkWriter) Write added in v0.66.0

func (self *DiffStatLinkWriter) Write(p []byte) (int, error)

type DragAutoscroller added in v0.64.0

type DragAutoscroller struct {
	// contains filtered or unexported fields
}

All state is UI-thread-owned. Timer goroutines only enqueue tick back onto the UI thread, where generation changes and scroll callbacks are serialized with mouse handlers and focus changes.

func NewDragAutoscroller added in v0.64.0

func NewDragAutoscroller(
	c *HelperCommon,
	context types.Context,
	canScroll func(direction int) bool,
	onScroll func(viewIndex int) bool,
) *DragAutoscroller

func (*DragAutoscroller) Cancel added in v0.64.0

func (self *DragAutoscroller) Cancel()

func (*DragAutoscroller) Direction added in v0.64.0

func (self *DragAutoscroller) Direction() int

func (*DragAutoscroller) Update added in v0.64.0

func (self *DragAutoscroller) Update(pointerViewportY int)

Update is called with the pointer position of every drag event. Entering a scroll zone arms a timer (with an initial delay, so that merely passing through the zone doesn't scroll); once armed, scrolling continues on its own until the pointer leaves the zone, the drag ends, or a callback stops it.

type FilesHelper

type FilesHelper struct {
	// contains filtered or unexported fields
}

func NewFilesHelper

func NewFilesHelper(c *HelperCommon) *FilesHelper

func (*FilesHelper) EditFileAtLine

func (self *FilesHelper) EditFileAtLine(filename string, lineNumber int) error

func (*FilesHelper) EditFileAtLineAndWait added in v0.38.0

func (self *FilesHelper) EditFileAtLineAndWait(filename string, lineNumber int) error

func (*FilesHelper) EditFiles added in v0.41.0

func (self *FilesHelper) EditFiles(filenames []string) error

func (*FilesHelper) OpenDirInEditor added in v0.40.0

func (self *FilesHelper) OpenDirInEditor(path string) error

func (*FilesHelper) OpenFile

func (self *FilesHelper) OpenFile(filename string) error

type FixupHelper added in v0.41.0

type FixupHelper struct {
	// contains filtered or unexported fields
}

func NewFixupHelper added in v0.41.0

func NewFixupHelper(
	c *HelperCommon,
) *FixupHelper

func (*FixupHelper) HandleFindBaseCommitForFixupPress added in v0.41.0

func (self *FixupHelper) HandleFindBaseCommitForFixupPress() error

type GpgHelper

type GpgHelper struct {
	// contains filtered or unexported fields
}

func NewGpgHelper

func NewGpgHelper(c *HelperCommon) *GpgHelper

func (*GpgHelper) WithGpgHandling

func (self *GpgHelper) WithGpgHandling(
	cmdObj *oscommands.CmdObj,
	configKey git_commands.GpgConfigKey,
	waitingStatus string,
	onSuccess func() error,
	refreshScope []types.RefreshableView,
) error

func (*GpgHelper) WithGpgHandlingAndSelectHeadCommit added in v0.63.0

func (self *GpgHelper) WithGpgHandlingAndSelectHeadCommit(
	cmdObj *oscommands.CmdObj,
	configKey git_commands.GpgConfigKey,
	waitingStatus string,
	onSuccess func() error,
) error

WithGpgHandlingAndSelectHeadCommit is like WithGpgHandling, but on success it selects the new HEAD commit rather than restoring the previous selection. For committing, where the commit we just created is the one we want selected.

type HelperCommon added in v0.39.0

type HelperCommon struct {
	*common.Common
	types.IGuiCommon
	IGetContexts
}

type Helpers

type Helpers struct {
	Refs           *RefsHelper
	Bisect         *BisectHelper
	Suggestions    *SuggestionsHelper
	Files          *FilesHelper
	WorkingTree    *WorkingTreeHelper
	BranchesHelper *BranchesHelper
	Tags           *TagsHelper
	MergeAndRebase *MergeAndRebaseHelper
	MergeConflicts *MergeConflictsHelper
	CherryPick     *CherryPickHelper
	Host           *HostHelper
	CustomPatch    *CustomPatchHelper
	GPG            *GpgHelper
	Upstream       *UpstreamHelper
	AmendHelper    *AmendHelper
	FixupHelper    *FixupHelper
	Commits        *CommitsHelper
	SuspendResume  *SuspendResumeHelper
	Snake          *SnakeHelper
	// lives in context package because our contexts need it to render to main
	Diff              *DiffHelper
	DiffLine          *DiffLineHelper
	Repos             *ReposHelper
	RecordDirectory   *RecordDirectoryHelper
	Update            *UpdateHelper
	Window            *WindowHelper
	View              *ViewHelper
	Refresh           *RefreshHelper
	Confirmation      *ConfirmationHelper
	Mode              *ModeHelper
	AppStatus         *AppStatusHelper
	InlineStatus      *InlineStatusHelper
	WindowArrangement *WindowArrangementHelper
	Search            *SearchHelper
	Worktree          *WorktreeHelper
	SubCommits        *SubCommitsHelper
}

func NewStubHelpers

func NewStubHelpers() *Helpers

type HostHelper

type HostHelper struct {
	// contains filtered or unexported fields
}

func NewHostHelper

func NewHostHelper(
	c *HelperCommon,
) *HostHelper

func (*HostHelper) GetCommitURL

func (self *HostHelper) GetCommitURL(commitHash string) (string, error)

func (*HostHelper) GetPullRequestURL

func (self *HostHelper) GetPullRequestURL(from string, to string) (string, error)

func (*HostHelper) NoPullRequestDisabledReason added in v0.66.0

func (self *HostHelper) NoPullRequestDisabledReason(branchName string) *types.DisabledReason

NoPullRequestDisabledReason disables a command that acts on a branch's pull request while that branch has none.

func (*HostHelper) PullRequestForBranch added in v0.66.0

func (self *HostHelper) PullRequestForBranch(branchName string) (*models.GithubPullRequest, bool)

PullRequestForBranch returns the pull request the given local branch is the head of, and false where it has none. That covers knowing of no pull requests at all: the repo may not be on GitHub, or the answer may not have arrived yet.

type IGetContexts added in v0.39.0

type IGetContexts interface {
	Contexts() *context.ContextTree
}

type InlineStatusHelper added in v0.41.0

type InlineStatusHelper struct {
	// contains filtered or unexported fields
}

func NewInlineStatusHelper added in v0.41.0

func NewInlineStatusHelper(c *HelperCommon, windowHelper *WindowHelper) *InlineStatusHelper

func (*InlineStatusHelper) WithInlineStatus added in v0.41.0

func (self *InlineStatusHelper) WithInlineStatus(opts InlineStatusOpts, f func(gocui.Task) error)

type InlineStatusOpts added in v0.41.0

type InlineStatusOpts struct {
	Item       types.HasUrn
	Operation  types.ItemOperation
	ContextKey types.ContextKey
}

type MergeAndRebaseHelper

type MergeAndRebaseHelper struct {
	// contains filtered or unexported fields
}

func NewMergeAndRebaseHelper

func NewMergeAndRebaseHelper(
	c *HelperCommon,
) *MergeAndRebaseHelper

func (*MergeAndRebaseHelper) AbortMergeOrRebaseWithConfirm

func (self *MergeAndRebaseHelper) AbortMergeOrRebaseWithConfirm() error

func (*MergeAndRebaseHelper) CheckForConflicts added in v0.39.0

func (self *MergeAndRebaseHelper) CheckForConflicts(result error) error

func (*MergeAndRebaseHelper) CheckMergeOrRebase

func (self *MergeAndRebaseHelper) CheckMergeOrRebase(result error) error

func (*MergeAndRebaseHelper) CheckMergeOrRebaseAndSelectHeadCommit added in v0.63.0

func (self *MergeAndRebaseHelper) CheckMergeOrRebaseAndSelectHeadCommit(result error) error

Like CheckMergeOrRebase, but for operations that create a new commit at HEAD (a merge, or a pull that merges): on success it selects that new commit, which the keep-selection-by-hash logic can't do since the commit didn't exist before the refresh.

func (*MergeAndRebaseHelper) CheckMergeOrRebaseWithRefreshOptions added in v0.41.0

func (self *MergeAndRebaseHelper) CheckMergeOrRebaseWithRefreshOptions(result error, refreshOptions types.RefreshOptions) error

CheckMergeOrRebaseWithRefreshOptions handles the result of a merge/rebase step and refreshes. It always runs on a worker (the WithWaitingStatus / WithWaitingStatusBlockingInput / WithInlineStatus handlers).

func (*MergeAndRebaseHelper) ContinueRebase added in v0.46.0

func (self *MergeAndRebaseHelper) ContinueRebase() error

func (*MergeAndRebaseHelper) CreateRebaseOptionsMenu

func (self *MergeAndRebaseHelper) CreateRebaseOptionsMenu() error

func (*MergeAndRebaseHelper) DismissContinueRebasePromptIfShowing added in v0.63.0

func (self *MergeAndRebaseHelper) DismissContinueRebasePromptIfShowing()

DismissContinueRebasePromptIfShowing closes the "continue the rebase/merge?" prompt if it's currently on screen. It's called when the operation is no longer in the state the prompt is offering to act on (e.g. it was continued or aborted outside lazygit, or new conflicts have appeared), so that the user isn't left with a prompt whose "continue" would now be wrong or fail. Must be called on the UI thread.

func (*MergeAndRebaseHelper) MergeRefIntoCheckedOutBranch

func (self *MergeAndRebaseHelper) MergeRefIntoCheckedOutBranch(refName string) error

func (*MergeAndRebaseHelper) PromptForConflictHandling added in v0.39.0

func (self *MergeAndRebaseHelper) PromptForConflictHandling() error

func (*MergeAndRebaseHelper) PromptToContinueRebase

func (self *MergeAndRebaseHelper) PromptToContinueRebase()

PromptToContinueRebase asks the user if they want to continue the rebase/merge that's in progress

func (*MergeAndRebaseHelper) RebaseOntoRef

func (self *MergeAndRebaseHelper) RebaseOntoRef(ref string) error

func (*MergeAndRebaseHelper) RecordWhetherMergeOrRebaseStartedInLazygit added in v0.63.0

func (self *MergeAndRebaseHelper) RecordWhetherMergeOrRebaseStartedInLazygit()

RecordWhetherMergeOrRebaseStartedInLazygit is called right after we run a merge/rebase/cherry-pick/revert step. If it left an operation in progress, that operation is one we started, which is what later lets us auto-prompt to continue it once its conflicts are resolved. If nothing is in progress anymore (the step completed or aborted the operation), we clear the flag.

func (*MergeAndRebaseHelper) RegularMerge added in v0.43.0

func (self *MergeAndRebaseHelper) RegularMerge(refName string, variant git_commands.MergeVariant) func() error

func (*MergeAndRebaseHelper) ResetMarkedBaseCommit added in v0.40.0

func (self *MergeAndRebaseHelper) ResetMarkedBaseCommit() error

func (*MergeAndRebaseHelper) SquashMergeCommitted added in v0.43.0

func (self *MergeAndRebaseHelper) SquashMergeCommitted(refName, checkedOutBranchName string) func() error

func (*MergeAndRebaseHelper) SquashMergeUncommitted added in v0.43.0

func (self *MergeAndRebaseHelper) SquashMergeUncommitted(refName string) func() error

type MergeConflictsHelper added in v0.36.0

type MergeConflictsHelper struct {
	// contains filtered or unexported fields
}

func NewMergeConflictsHelper added in v0.36.0

func NewMergeConflictsHelper(
	c *HelperCommon,
) *MergeConflictsHelper

func (*MergeConflictsHelper) EscapeMerge added in v0.36.0

func (self *MergeConflictsHelper) EscapeMerge()

EscapeMerge returns from the merge conflicts view to the files context. It must be called on the UI thread, without the merge-conflicts mutex held: pushing the files context renders the newly focused file to the main view, which can take the mutex again (via SetMergeState).

func (*MergeConflictsHelper) RefreshMergeState added in v0.39.0

func (self *MergeConflictsHelper) RefreshMergeState() error

func (*MergeConflictsHelper) Render added in v0.39.0

func (self *MergeConflictsHelper) Render()

func (*MergeConflictsHelper) ResetMergeState added in v0.36.0

func (self *MergeConflictsHelper) ResetMergeState()

func (*MergeConflictsHelper) SetConflictsAndRender added in v0.36.0

func (self *MergeConflictsHelper) SetConflictsAndRender() (bool, error)

SetConflictsAndRender re-reads the file being merged and re-renders the merge conflicts view. Returns whether the file still has conflicts.

func (*MergeConflictsHelper) SetMergeState added in v0.36.0

func (self *MergeConflictsHelper) SetMergeState(file *models.File) (bool, error)

func (*MergeConflictsHelper) SwitchToMerge added in v0.36.0

func (self *MergeConflictsHelper) SwitchToMerge(file *models.File) error

type ModeHelper added in v0.39.0

type ModeHelper struct {
	// contains filtered or unexported fields
}

func NewModeHelper added in v0.39.0

func NewModeHelper(
	c *HelperCommon,
	diffHelper *DiffHelper,
	customPatchHelper *CustomPatchHelper,
	cherryPickHelper *CherryPickHelper,
	mergeAndRebaseHelper *MergeAndRebaseHelper,
	bisectHelper *BisectHelper,
) *ModeHelper

func (*ModeHelper) ClearFiltering added in v0.39.0

func (self *ModeHelper) ClearFiltering() error

func (*ModeHelper) ExitFilterMode added in v0.39.0

func (self *ModeHelper) ExitFilterMode() error

func (*ModeHelper) GetActiveMode added in v0.39.0

func (self *ModeHelper) GetActiveMode() (ModeStatus, bool)

func (*ModeHelper) IsAnyModeActive added in v0.39.0

func (self *ModeHelper) IsAnyModeActive() bool

func (*ModeHelper) SetFilteringAuthor added in v0.64.1

func (self *ModeHelper) SetFilteringAuthor(author string) error

func (*ModeHelper) SetFilteringPath added in v0.64.1

func (self *ModeHelper) SetFilteringPath(path string) error

func (*ModeHelper) SetSuppressWorkingTreeStateMode added in v0.64.1

func (self *ModeHelper) SetSuppressWorkingTreeStateMode(value bool)

func (*ModeHelper) Statuses added in v0.39.0

func (self *ModeHelper) Statuses() []ModeStatus

type ModeStatus added in v0.39.0

type ModeStatus struct {
	IsActive    func() bool
	InfoLabel   func() string
	CancelLabel func() string
	Reset       func() error
}

type OpenCommitMessagePanelOpts added in v0.38.0

type OpenCommitMessagePanelOpts struct {
	CommitIndex      int
	SummaryTitle     string
	DescriptionTitle string
	PreserveMessage  bool
	OnConfirm        func(summary string, description string) error
	OnSwitchToEditor func(string) error
	InitialMessage   string

	// The following two fields are only for the display of the "(hooks
	// disabled)" display in the commit message panel. They have no effect on
	// the actual behavior; make sure what you are passing in matches that.
	// Leave unassigned if the concept of skipping hooks doesn't make sense for
	// what you are doing, e.g. when creating a tag.
	ForceSkipHooks  bool
	SkipHooksPrefix string
}

type RebaseOption

type RebaseOption string

type RecordDirectoryHelper added in v0.39.0

type RecordDirectoryHelper struct {
	// contains filtered or unexported fields
}

func NewRecordDirectoryHelper added in v0.39.0

func NewRecordDirectoryHelper(c *HelperCommon) *RecordDirectoryHelper

func (*RecordDirectoryHelper) RecordCurrentDirectory added in v0.39.0

func (self *RecordDirectoryHelper) RecordCurrentDirectory() error

when a user runs lazygit with the LAZYGIT_NEW_DIR_FILE env variable defined we will write the current directory to that file on exit so that their shell can then change to that directory. That means you don't get kicked back to the directory that you started with.

func (*RecordDirectoryHelper) RecordDirectory added in v0.39.0

func (self *RecordDirectoryHelper) RecordDirectory(dirName string) error

type RefreshHelper added in v0.39.0

type RefreshHelper struct {
	// contains filtered or unexported fields
}

func NewRefreshHelper added in v0.39.0

func NewRefreshHelper(
	c *HelperCommon,
	refsHelper *RefsHelper,
	mergeAndRebaseHelper *MergeAndRebaseHelper,
	mergeConflictsHelper *MergeConflictsHelper,
	worktreeHelper *WorktreeHelper,
	searchHelper *SearchHelper,
) *RefreshHelper

func (*RefreshHelper) Refresh added in v0.39.0

func (self *RefreshHelper) Refresh(options types.RefreshOptions)

func (*RefreshHelper) RefreshAuthors added in v0.39.3

func (self *RefreshHelper) RefreshAuthors(commits []*models.Commit)

func (*RefreshHelper) RefreshBlockingInput added in v0.64.0

func (self *RefreshHelper) RefreshBlockingInput(options types.RefreshOptions)

RefreshBlockingInput is Refresh for handlers whose next keypress may depend on the state the refresh produces. See IGuiCommon.RefreshBlockingInput.

func (*RefreshHelper) RefreshFromWorker added in v0.64.0

func (self *RefreshHelper) RefreshFromWorker(options types.RefreshOptions)

RefreshFromWorker is Refresh for callers already running on a worker goroutine (e.g. inside a WithWaitingStatus handler) rather than the UI thread. See IGuiCommon.RefreshFromWorker.

func (*RefreshHelper) RefsSnapshotChangedSince added in v0.63.0

func (self *RefreshHelper) RefsSnapshotChangedSince(snapshot string) bool

RefsSnapshotChangedSince reports whether the given snapshot differs from the last observed one. Pure read; does not update internal state.

func (*RefreshHelper) SetRefsSnapshot added in v0.63.0

func (self *RefreshHelper) SetRefsSnapshot(snapshot string)

SetRefsSnapshot stores the given snapshot as the last observed refs state. Called externally by the background poller at startup to seed the snapshot, and internally by Refresh at the end of a refs-touching refresh.

type RefsHelper

type RefsHelper struct {
	// contains filtered or unexported fields
}

func NewRefsHelper

func NewRefsHelper(
	c *HelperCommon,
	rebaseHelper *MergeAndRebaseHelper,
) *RefsHelper

func (*RefsHelper) CanMoveCommitsToNewBranch added in v0.50.0

func (self *RefsHelper) CanMoveCommitsToNewBranch() *types.DisabledReason

func (*RefsHelper) CheckoutPreviousRef added in v0.56.0

func (self *RefsHelper) CheckoutPreviousRef() error

func (*RefsHelper) CheckoutRef

func (self *RefsHelper) CheckoutRef(ref string, options types.CheckoutRefOptions) error

func (*RefsHelper) CheckoutRemoteBranch added in v0.41.0

func (self *RefsHelper) CheckoutRemoteBranch(fullBranchName string, localBranchName string) error

Shows a prompt to choose between creating a new branch or checking out a detached head

func (*RefsHelper) CreateCheckoutMenu added in v0.45.0

func (self *RefsHelper) CreateCheckoutMenu(commit *models.Commit) error

func (*RefsHelper) CreateGitResetMenu

func (self *RefsHelper) CreateGitResetMenu(name string, ref string) error

func (*RefsHelper) CreateSortOrderMenu added in v0.41.0

func (self *RefsHelper) CreateSortOrderMenu(sortOptionsOrder []string, menuPrompt string, onSelected func(sortOrder string) error, currentValue string) error

func (*RefsHelper) GetCheckedOutRef

func (self *RefsHelper) GetCheckedOutRef() *models.Branch

func (*RefsHelper) MoveCommitsToNewBranch added in v0.50.0

func (self *RefsHelper) MoveCommitsToNewBranch() error

func (*RefsHelper) NewBranch

func (self *RefsHelper) NewBranch(from string, fromFormattedName string, suggestedBranchName string) error

func (*RefsHelper) ParseRemoteBranchName added in v0.41.0

func (self *RefsHelper) ParseRemoteBranchName(fullBranchName string) (string, string, bool)

Checks if the given branch name is a remote branch, and returns the name of the remote and the bare branch name if it is.

func (*RefsHelper) ResetToRef

func (self *RefsHelper) ResetToRef(ref string, strength string, envVars []string) error

type ReposHelper added in v0.39.0

type ReposHelper struct {
	// contains filtered or unexported fields
}

helps switch back and forth between repos

func NewRecentReposHelper added in v0.39.0

func NewRecentReposHelper(
	c *HelperCommon,
	recordDirectoryHelper *RecordDirectoryHelper,
	onNewRepo onNewRepoFn,
) *ReposHelper

func (*ReposHelper) CreateRecentReposMenu added in v0.39.0

func (self *ReposHelper) CreateRecentReposMenu() error

func (*ReposHelper) DispatchSwitchTo added in v0.40.0

func (self *ReposHelper) DispatchSwitchTo(path string, errMsg string, contextKey types.ContextKey) error

func (*ReposHelper) EnterSubmodule added in v0.39.0

func (self *ReposHelper) EnterSubmodule(submodule *models.SubmoduleConfig) error

func (*ReposHelper) SwitchToParentRepo added in v0.64.0

func (self *ReposHelper) SwitchToParentRepo() error

SwitchToParentRepo switches back to the repo the current submodule was entered from (the top of the repo-path stack). Like the other callers that do work before switching, it checks for an in-flight operation *before* popping the stack, so a refused switch leaves the stack intact — otherwise the entry would be consumed and escape would no longer return to the parent once the operation finished. The caller must only call this when the stack is non-empty.

type SearchHelper added in v0.39.0

type SearchHelper struct {
	// contains filtered or unexported fields
}

func NewSearchHelper added in v0.39.0

func NewSearchHelper(
	c *HelperCommon,
) *SearchHelper

func (*SearchHelper) ApplyFilter added in v0.65.0

func (self *SearchHelper) ApplyFilter(context types.IFilterableContext, filter string)

func (*SearchHelper) Cancel added in v0.39.0

func (self *SearchHelper) Cancel()

func (*SearchHelper) CancelPrompt added in v0.39.0

func (self *SearchHelper) CancelPrompt()

func (*SearchHelper) CancelSearchIfSearching added in v0.39.0

func (self *SearchHelper) CancelSearchIfSearching(c types.Context)

func (*SearchHelper) Confirm added in v0.39.0

func (self *SearchHelper) Confirm()

func (*SearchHelper) ConfirmFilter added in v0.39.0

func (self *SearchHelper) ConfirmFilter()

func (*SearchHelper) ConfirmSearch added in v0.39.0

func (self *SearchHelper) ConfirmSearch()

func (*SearchHelper) DisplayFilterStatus added in v0.39.0

func (self *SearchHelper) DisplayFilterStatus(context types.IFilterableContext)

func (*SearchHelper) DisplaySearchStatus added in v0.39.0

func (self *SearchHelper) DisplaySearchStatus(context types.ISearchableContext)

func (*SearchHelper) HidePrompt added in v0.39.0

func (self *SearchHelper) HidePrompt()

func (*SearchHelper) OnPromptContentChanged added in v0.39.0

func (self *SearchHelper) OnPromptContentChanged(searchString string)

func (*SearchHelper) OpenFilterPrompt added in v0.39.0

func (self *SearchHelper) OpenFilterPrompt(context types.IFilterableContext)

func (*SearchHelper) OpenSearchPrompt added in v0.39.0

func (self *SearchHelper) OpenSearchPrompt(context types.ISearchableContext)

func (*SearchHelper) ReApplyFilter added in v0.41.0

func (self *SearchHelper) ReApplyFilter(context types.Context)

func (*SearchHelper) ReApplySearch added in v0.43.0

func (self *SearchHelper) ReApplySearch(ctx types.Context)

func (*SearchHelper) RenderSearchStatus added in v0.39.0

func (self *SearchHelper) RenderSearchStatus(c types.Context)

func (*SearchHelper) ScrollHistory added in v0.41.0

func (self *SearchHelper) ScrollHistory(scrollIncrement int)

type SnakeHelper added in v0.39.0

type SnakeHelper struct {
	// contains filtered or unexported fields
}

func NewSnakeHelper added in v0.39.0

func NewSnakeHelper(c *HelperCommon) *SnakeHelper

func (*SnakeHelper) ExitGame added in v0.39.0

func (self *SnakeHelper) ExitGame()

func (*SnakeHelper) SetDirection added in v0.39.0

func (self *SnakeHelper) SetDirection(direction snake.Direction)

func (*SnakeHelper) StartGame added in v0.39.0

func (self *SnakeHelper) StartGame()

type SubCommitsHelper added in v0.41.0

type SubCommitsHelper struct {
	// contains filtered or unexported fields
}

func NewSubCommitsHelper added in v0.41.0

func NewSubCommitsHelper(
	c *HelperCommon,
	refreshHelper *RefreshHelper,
) *SubCommitsHelper

func (*SubCommitsHelper) ViewSubCommits added in v0.41.0

func (self *SubCommitsHelper) ViewSubCommits(opts ViewSubCommitsOpts) error

type SuggestionsHelper

type SuggestionsHelper struct {
	// contains filtered or unexported fields
}

func NewSuggestionsHelper

func NewSuggestionsHelper(
	c *HelperCommon,
) *SuggestionsHelper

func (*SuggestionsHelper) GetAuthorsSuggestionsFunc

func (self *SuggestionsHelper) GetAuthorsSuggestionsFunc() func(string) []*types.Suggestion

func (*SuggestionsHelper) GetBranchNameSuggestionsFunc

func (self *SuggestionsHelper) GetBranchNameSuggestionsFunc() func(string) []*types.Suggestion

func (*SuggestionsHelper) GetFilePathSuggestionsFunc

func (self *SuggestionsHelper) GetFilePathSuggestionsFunc() func(string) []*types.Suggestion

here we asynchronously fetch the latest set of paths in the repo and store in self.c.Model().FilesTrie. On the main thread we'll be doing a fuzzy search via self.c.Model().FilesTrie. So if we've looked for a file previously, we'll start with the old trie and eventually it'll be swapped out for the new one.

func (*SuggestionsHelper) GetRefsSuggestionsFunc

func (self *SuggestionsHelper) GetRefsSuggestionsFunc() func(string) []*types.Suggestion

func (*SuggestionsHelper) GetRemoteBranchesForRemoteSuggestionsFunc added in v0.45.0

func (self *SuggestionsHelper) GetRemoteBranchesForRemoteSuggestionsFunc(remoteName string) func(string) []*types.Suggestion

func (*SuggestionsHelper) GetRemoteBranchesSuggestionsFunc

func (self *SuggestionsHelper) GetRemoteBranchesSuggestionsFunc(separator string) func(string) []*types.Suggestion

func (*SuggestionsHelper) GetRemoteSuggestionsFunc

func (self *SuggestionsHelper) GetRemoteSuggestionsFunc() func(string) []*types.Suggestion

func (*SuggestionsHelper) GetTagsSuggestionsFunc added in v0.39.0

func (self *SuggestionsHelper) GetTagsSuggestionsFunc() func(string) []*types.Suggestion

func (*SuggestionsHelper) GetWorktreeBranchNameSuggestionsFunc added in v0.63.0

func (self *SuggestionsHelper) GetWorktreeBranchNameSuggestionsFunc() func(string) []*types.Suggestion

GetWorktreeBranchNameSuggestionsFunc suggests branches you can base a new worktree on: local branches that aren't checked out in any worktree (you can't make a second worktree for them), plus remote branches that don't yet have a local branch of the same name. Picking a remote branch creates a new local tracking branch, which would fail if that local branch already existed (whether or not it's checked out), so we leave those out and you reach the branch via its local entry instead.

type SuspendResumeHelper added in v0.55.0

type SuspendResumeHelper struct {
	// contains filtered or unexported fields
}

func NewSuspendResumeHelper added in v0.55.0

func NewSuspendResumeHelper(c *HelperCommon) *SuspendResumeHelper

func (*SuspendResumeHelper) CanSuspendApp added in v0.55.0

func (s *SuspendResumeHelper) CanSuspendApp() bool

func (*SuspendResumeHelper) InstallResumeSignalHandler added in v0.55.0

func (s *SuspendResumeHelper) InstallResumeSignalHandler()

func (*SuspendResumeHelper) SuspendApp added in v0.55.0

func (s *SuspendResumeHelper) SuspendApp() error

type TagsHelper

type TagsHelper struct {
	// contains filtered or unexported fields
}

func NewTagsHelper

func NewTagsHelper(c *HelperCommon, commitsHelper *CommitsHelper, gpg *GpgHelper) *TagsHelper

func (*TagsHelper) OpenCreateTagPrompt added in v0.39.3

func (self *TagsHelper) OpenCreateTagPrompt(ref string, onCreate func()) error

type UpdateHelper added in v0.39.0

type UpdateHelper struct {
	// contains filtered or unexported fields
}

func NewUpdateHelper added in v0.39.0

func NewUpdateHelper(c *HelperCommon, updater *updates.Updater) *UpdateHelper

func (*UpdateHelper) CheckForUpdateInBackground added in v0.39.0

func (self *UpdateHelper) CheckForUpdateInBackground()

func (*UpdateHelper) CheckForUpdateInForeground added in v0.39.0

func (self *UpdateHelper) CheckForUpdateInForeground() error

type UpstreamHelper

type UpstreamHelper struct {
	// contains filtered or unexported fields
}

func NewUpstreamHelper

func NewUpstreamHelper(
	c *HelperCommon,
	getRemoteBranchesSuggestionsFunc func(string) func(string) []*types.Suggestion,
) *UpstreamHelper

func (*UpstreamHelper) GetSuggestedRemote

func (self *UpstreamHelper) GetSuggestedRemote() string

func (*UpstreamHelper) ParseUpstream

func (self *UpstreamHelper) ParseUpstream(upstream string) (string, string, error)

func (*UpstreamHelper) PromptForUpstreamWithInitialContent

func (self *UpstreamHelper) PromptForUpstreamWithInitialContent(currentBranch *models.Branch, onConfirm func(string) error) error

func (*UpstreamHelper) PromptForUpstreamWithoutInitialContent

func (self *UpstreamHelper) PromptForUpstreamWithoutInitialContent(_ *models.Branch, onConfirm func(string) error) error

type ViewHelper added in v0.39.0

type ViewHelper struct {
	// contains filtered or unexported fields
}

func NewViewHelper added in v0.39.0

func NewViewHelper(c *HelperCommon, contexts *context.ContextTree) *ViewHelper

func (*ViewHelper) ContextForView added in v0.39.0

func (self *ViewHelper) ContextForView(viewName string) (types.Context, bool)

type ViewSubCommitsOpts added in v0.41.0

type ViewSubCommitsOpts struct {
	Ref                     models.Ref
	RefToShowDivergenceFrom string
	TitleRef                string
	Context                 types.Context
	ShowBranchHeads         bool
}

type WindowArrangementArgs added in v0.41.0

type WindowArrangementArgs struct {
	// Width of the screen (in characters)
	Width int
	// Height of the screen (in characters)
	Height int
	// User config
	UserConfig *config.UserConfig
	// Name of the currently focused window. (It's actually the current static window, meaning
	// popups are ignored)
	CurrentWindow string
	// Name of the current side window (i.e. the current window in the left
	// section of the UI)
	CurrentSideWindow string
	// Returns the view currently shown in the given window. When a window holds
	// several tabbed views this is the selected tab, which is what the status and
	// stash height special-cases key off (rather than the window itself, whose
	// name is just its first tab).
	ActiveViewForWindow func(window string) string
	// Returns the number of content lines of the view currently shown in the given
	// window. Used by the shrink-to-content feature to size a panel to its content.
	ContentHeightForWindow func(window string) int
	// Whether the main panel is split (as is the case e.g. when a file has both
	// staged and unstaged changes)
	MainPanes types.MainPanes
	// The current screen mode (normal, half, full)
	ScreenMode types.ScreenMode
	// The content shown on the bottom left of the screen when showing a loader
	// or toast e.g. 'Rebasing /'
	AppStatus string
	// The content shown on the bottom right of the screen (e.g. the 'donate',
	// 'ask question' links or a message about the current mode e.g. rebase mode)
	InformationStr string
	// Whether to show the extras window which contains the command log context
	ShowExtrasWindow bool
	// Whether we are in a demo (which is used for generating demo gifs for the
	// repo's readme)
	InDemo bool
	// Whether any mode is active (e.g. rebasing, cherry picking, etc)
	IsAnyModeActive bool
	// Whether the search prompt is shown in the bottom left
	InSearchPrompt bool
	// One of ” (not searching), 'Search: ', and 'Filter: '
	SearchPrefix string
}

type WindowArrangementHelper added in v0.39.0

type WindowArrangementHelper struct {
	// contains filtered or unexported fields
}

func NewWindowArrangementHelper added in v0.39.0

func NewWindowArrangementHelper(
	c *HelperCommon,
	windowHelper *WindowHelper,
	modeHelper *ModeHelper,
	appStatusHelper *AppStatusHelper,
) *WindowArrangementHelper

func (*WindowArrangementHelper) GetWindowDimensions added in v0.39.0

func (self *WindowArrangementHelper) GetWindowDimensions(informationStr string, appStatus string) map[string]boxlayout.Dimensions

type WindowHelper added in v0.39.0

type WindowHelper struct {
	// contains filtered or unexported fields
}

func NewWindowHelper added in v0.39.0

func NewWindowHelper(c *HelperCommon, viewHelper *ViewHelper) *WindowHelper

func (*WindowHelper) CurrentWindow added in v0.39.0

func (self *WindowHelper) CurrentWindow() string

func (*WindowHelper) GetContextForWindow added in v0.39.0

func (self *WindowHelper) GetContextForWindow(window string) types.Context

func (*WindowHelper) GetViewNameForWindow added in v0.39.0

func (self *WindowHelper) GetViewNameForWindow(window string) string

func (*WindowHelper) MoveToTopOfWindow added in v0.39.0

func (self *WindowHelper) MoveToTopOfWindow(context types.Context)

moves given context's view to the top of the window

func (*WindowHelper) SetWindowContext added in v0.39.0

func (self *WindowHelper) SetWindowContext(c types.Context)

for now all we actually care about is the context's view so we're storing that

func (*WindowHelper) SideWindows added in v0.39.0

func (self *WindowHelper) SideWindows() []string

func (*WindowHelper) TopViewInWindow added in v0.39.0

func (self *WindowHelper) TopViewInWindow(windowName string, includeInvisibleViews bool) *gocui.View

func (*WindowHelper) WindowForView added in v0.39.0

func (self *WindowHelper) WindowForView(viewName string) string

type WorkingTreeHelper

type WorkingTreeHelper struct {
	// contains filtered or unexported fields
}

func NewWorkingTreeHelper

func NewWorkingTreeHelper(
	c *HelperCommon,
	refHelper *RefsHelper,
	commitsHelper *CommitsHelper,
	gpgHelper *GpgHelper,
	mergeAndRebaseHelper *MergeAndRebaseHelper,
) *WorkingTreeHelper

func (*WorkingTreeHelper) AnyStagedFiles

func (self *WorkingTreeHelper) AnyStagedFiles() bool

func (*WorkingTreeHelper) AnyStagedFilesExceptSubmodules added in v0.56.0

func (self *WorkingTreeHelper) AnyStagedFilesExceptSubmodules() bool

func (*WorkingTreeHelper) AnyTrackedFiles

func (self *WorkingTreeHelper) AnyTrackedFiles() bool

func (*WorkingTreeHelper) AnyTrackedFilesExceptSubmodules added in v0.56.0

func (self *WorkingTreeHelper) AnyTrackedFilesExceptSubmodules() bool

func (*WorkingTreeHelper) CreateMergeConflictMenu added in v0.56.0

func (self *WorkingTreeHelper) CreateMergeConflictMenu(selectedFilepaths []string) error

func (*WorkingTreeHelper) FileForSubmodule

func (self *WorkingTreeHelper) FileForSubmodule(submodule *models.SubmoduleConfig) *models.File

func (*WorkingTreeHelper) HandleCommitEditorPress added in v0.37.0

func (self *WorkingTreeHelper) HandleCommitEditorPress() error

HandleCommitEditorPress - handle when the user wants to commit changes via their editor rather than via the popup panel

func (*WorkingTreeHelper) HandleCommitPress added in v0.37.0

func (self *WorkingTreeHelper) HandleCommitPress() error

func (*WorkingTreeHelper) HandleCommitPressWithMessage added in v0.38.0

func (self *WorkingTreeHelper) HandleCommitPressWithMessage(initialMessage string, forceSkipHooks bool) error

func (*WorkingTreeHelper) HandleWIPCommitPress added in v0.37.0

func (self *WorkingTreeHelper) HandleWIPCommitPress() error

func (*WorkingTreeHelper) IsWorkingTreeDirtyExceptSubmodules added in v0.56.0

func (self *WorkingTreeHelper) IsWorkingTreeDirtyExceptSubmodules() bool

func (*WorkingTreeHelper) OpenMergeTool

func (self *WorkingTreeHelper) OpenMergeTool() error

func (*WorkingTreeHelper) WithEnsureCommittableFiles added in v0.45.0

func (self *WorkingTreeHelper) WithEnsureCommittableFiles(handler func() error) error

type WorktreeHelper added in v0.40.0

type WorktreeHelper struct {
	// contains filtered or unexported fields
}

func NewWorktreeHelper added in v0.40.0

func NewWorktreeHelper(c *HelperCommon, reposHelper *ReposHelper, refsHelper *RefsHelper, suggestionsHelper *SuggestionsHelper) *WorktreeHelper

func (*WorktreeHelper) Detach added in v0.40.0

func (self *WorktreeHelper) Detach(worktree *models.Worktree, then func(gocui.Task) error) error

func (*WorktreeHelper) GetLinkedWorktreeName added in v0.40.0

func (self *WorktreeHelper) GetLinkedWorktreeName() string

If we're on the main worktree, we return an empty string

func (*WorktreeHelper) GetMainWorktreeName added in v0.40.0

func (self *WorktreeHelper) GetMainWorktreeName() string

func (*WorktreeHelper) NewWorktree added in v0.40.0

func (self *WorktreeHelper) NewWorktree() error

func (*WorktreeHelper) NewWorktreeMenuForBranch added in v0.63.0

func (self *WorktreeHelper) NewWorktreeMenuForBranch(branch *models.Branch) error

func (*WorktreeHelper) NewWorktreeMenuForCommit added in v0.63.0

func (self *WorktreeHelper) NewWorktreeMenuForCommit(commit *models.Commit) error

func (*WorktreeHelper) NewWorktreeMenuForRemoteBranch added in v0.63.0

func (self *WorktreeHelper) NewWorktreeMenuForRemoteBranch(remoteBranch *models.RemoteBranch) error

func (*WorktreeHelper) NewWorktreeMenuForStash added in v0.63.0

func (self *WorktreeHelper) NewWorktreeMenuForStash(stash *models.StashEntry) error

func (*WorktreeHelper) NewWorktreeMenuForTag added in v0.63.0

func (self *WorktreeHelper) NewWorktreeMenuForTag(tag *models.Tag) error

func (*WorktreeHelper) Remove added in v0.40.0

func (self *WorktreeHelper) Remove(worktree *models.Worktree, then func(gocui.Task) error) error

Remove deletes the worktree without confirming first; callers are expected to have confirmed (or shown a menu) already. If git refuses because the worktree is dirty or contains submodules, we ask for confirmation and retry with --force. When then is non-nil it runs in place of the default refresh after a successful removal, letting callers chain further work such as deleting the worktree's branch.

func (*WorktreeHelper) Switch added in v0.40.0

func (self *WorktreeHelper) Switch(worktree *models.Worktree, contextKey types.ContextKey) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL