mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-02-09 13:47:11 +02:00
shorten name
This commit is contained in:
parent
c9a0cc6b30
commit
364c5db19c
@ -184,7 +184,7 @@ func (app *App) setupRepo() (bool, error) {
|
||||
}
|
||||
|
||||
if env.GetGitDirEnv() != "" {
|
||||
// we've been given the git dir directly. We'll verify this dir when initializing our GitCommand object
|
||||
// we've been given the git dir directly. We'll verify this dir when initializing our Git object
|
||||
return false, nil
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ func (gui *Gui) branchesRenderToMain() error {
|
||||
if branch == nil {
|
||||
task = NewRenderStringTask(gui.Tr.NoBranchesThisRepo)
|
||||
} else {
|
||||
cmdObj := gui.GitCommand.Branch.GetGraphCmdObj(branch.Name)
|
||||
cmdObj := gui.Git.Branch.GetGraphCmdObj(branch.Name)
|
||||
|
||||
task = NewRunPtyTask(cmdObj.GetCmd())
|
||||
}
|
||||
@ -54,13 +54,13 @@ func (gui *Gui) refreshBranches() {
|
||||
// which allows us to order them correctly. So if we're filtering we'll just
|
||||
// manually load all the reflog commits here
|
||||
var err error
|
||||
reflogCommits, _, err = gui.GitCommand.Loaders.ReflogCommits.GetReflogCommits(nil, "")
|
||||
reflogCommits, _, err = gui.Git.Loaders.ReflogCommits.GetReflogCommits(nil, "")
|
||||
if err != nil {
|
||||
gui.Log.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
gui.State.Branches = gui.GitCommand.Loaders.Branches.Load(reflogCommits)
|
||||
gui.State.Branches = gui.Git.Loaders.Branches.Load(reflogCommits)
|
||||
|
||||
if err := gui.postRefreshUpdate(gui.State.Contexts.Branches); err != nil {
|
||||
gui.Log.Error(err)
|
||||
@ -103,7 +103,7 @@ func (gui *Gui) handleCopyPullRequestURLPress() error {
|
||||
|
||||
branch := gui.getSelectedBranch()
|
||||
|
||||
branchExistsOnRemote := gui.GitCommand.Remote.CheckRemoteBranchExists(branch.Name)
|
||||
branchExistsOnRemote := gui.Git.Remote.CheckRemoteBranchExists(branch.Name)
|
||||
|
||||
if !branchExistsOnRemote {
|
||||
return gui.surfaceError(errors.New(gui.Tr.NoBranchOnRemote))
|
||||
@ -146,7 +146,7 @@ func (gui *Gui) handleForceCheckout() error {
|
||||
prompt: message,
|
||||
handleConfirm: func() error {
|
||||
gui.logAction(gui.Tr.Actions.ForceCheckoutBranch)
|
||||
if err := gui.GitCommand.Branch.Checkout(branch.Name, git_commands.CheckoutOptions{Force: true}); err != nil {
|
||||
if err := gui.Git.Branch.Checkout(branch.Name, git_commands.CheckoutOptions{Force: true}); err != nil {
|
||||
_ = gui.surfaceError(err)
|
||||
}
|
||||
return gui.refreshSidePanels(refreshOptions{mode: ASYNC})
|
||||
@ -176,7 +176,7 @@ func (gui *Gui) handleCheckoutRef(ref string, options handleCheckoutRefOptions)
|
||||
}
|
||||
|
||||
return gui.WithWaitingStatus(waitingStatus, func() error {
|
||||
if err := gui.GitCommand.Branch.Checkout(ref, cmdOptions); err != nil {
|
||||
if err := gui.Git.Branch.Checkout(ref, cmdOptions); err != nil {
|
||||
// note, this will only work for english-language git commands. If we force git to use english, and the error isn't this one, then the user will receive an english command they may not understand. I'm not sure what the best solution to this is. Running the command once in english and a second time in the native language is one option
|
||||
|
||||
if options.onRefNotFound != nil && strings.Contains(err.Error(), "did not match any file(s) known to git") {
|
||||
@ -190,15 +190,15 @@ func (gui *Gui) handleCheckoutRef(ref string, options handleCheckoutRefOptions)
|
||||
title: gui.Tr.AutoStashTitle,
|
||||
prompt: gui.Tr.AutoStashPrompt,
|
||||
handleConfirm: func() error {
|
||||
if err := gui.GitCommand.Stash.Save(gui.Tr.StashPrefix + ref); err != nil {
|
||||
if err := gui.Git.Stash.Save(gui.Tr.StashPrefix + ref); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
if err := gui.GitCommand.Branch.Checkout(ref, cmdOptions); err != nil {
|
||||
if err := gui.Git.Branch.Checkout(ref, cmdOptions); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
||||
onSuccess()
|
||||
if err := gui.GitCommand.Stash.Pop(0); err != nil {
|
||||
if err := gui.Git.Stash.Pop(0); err != nil {
|
||||
if err := gui.refreshSidePanels(refreshOptions{mode: BLOCK_UI}); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -254,7 +254,7 @@ func (gui *Gui) createNewBranchWithName(newBranchName string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := gui.GitCommand.Branch.New(newBranchName, branch.Name); err != nil {
|
||||
if err := gui.Git.Branch.New(newBranchName, branch.Name); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
||||
@ -298,7 +298,7 @@ func (gui *Gui) deleteNamedBranch(selectedBranch *models.Branch, force bool) err
|
||||
prompt: message,
|
||||
handleConfirm: func() error {
|
||||
gui.logAction(gui.Tr.Actions.DeleteBranch)
|
||||
if err := gui.GitCommand.Branch.Delete(selectedBranch.Name, force); err != nil {
|
||||
if err := gui.Git.Branch.Delete(selectedBranch.Name, force); err != nil {
|
||||
errMessage := err.Error()
|
||||
if !force && strings.Contains(errMessage, "git branch -D ") {
|
||||
return gui.deleteNamedBranch(selectedBranch, true)
|
||||
@ -315,7 +315,7 @@ func (gui *Gui) mergeBranchIntoCheckedOutBranch(branchName string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if gui.GitCommand.Branch.IsHeadDetached() {
|
||||
if gui.Git.Branch.IsHeadDetached() {
|
||||
return gui.createErrorPanel("Cannot merge branch in detached head state. You might have checked out a commit directly or a remote branch, in which case you should checkout the local branch you want to be on")
|
||||
}
|
||||
checkedOutBranchName := gui.getCheckedOutBranch().Name
|
||||
@ -335,7 +335,7 @@ func (gui *Gui) mergeBranchIntoCheckedOutBranch(branchName string) error {
|
||||
prompt: prompt,
|
||||
handleConfirm: func() error {
|
||||
gui.logAction(gui.Tr.Actions.Merge)
|
||||
err := gui.GitCommand.Branch.Merge(branchName, git_commands.MergeOpts{})
|
||||
err := gui.Git.Branch.Merge(branchName, git_commands.MergeOpts{})
|
||||
return gui.handleGenericMergeCommandResult(err)
|
||||
},
|
||||
})
|
||||
@ -377,7 +377,7 @@ func (gui *Gui) handleRebaseOntoBranch(selectedBranchName string) error {
|
||||
prompt: prompt,
|
||||
handleConfirm: func() error {
|
||||
gui.logAction(gui.Tr.Actions.RebaseBranch)
|
||||
err := gui.GitCommand.Rebase.RebaseBranch(selectedBranchName)
|
||||
err := gui.Git.Rebase.RebaseBranch(selectedBranchName)
|
||||
return gui.handleGenericMergeCommandResult(err)
|
||||
},
|
||||
})
|
||||
@ -396,7 +396,7 @@ func (gui *Gui) handleFastForward() error {
|
||||
return gui.createErrorPanel(gui.Tr.FwdCommitsToPush)
|
||||
}
|
||||
|
||||
upstream, err := gui.GitCommand.Branch.GetUpstream(branch.Name)
|
||||
upstream, err := gui.Git.Branch.GetUpstream(branch.Name)
|
||||
if err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
@ -421,7 +421,7 @@ func (gui *Gui) handleFastForward() error {
|
||||
_ = gui.pullWithLock(PullFilesOptions{action: action, FastForwardOnly: true})
|
||||
} else {
|
||||
gui.logAction(action)
|
||||
err := gui.GitCommand.Sync.FastForward(branch.Name, remoteName, remoteBranchName)
|
||||
err := gui.Git.Sync.FastForward(branch.Name, remoteName, remoteBranchName)
|
||||
gui.handleCredentialsPopup(err)
|
||||
_ = gui.refreshSidePanels(refreshOptions{mode: ASYNC, scope: []RefreshableView{BRANCHES}})
|
||||
}
|
||||
@ -450,7 +450,7 @@ func (gui *Gui) handleRenameBranch() error {
|
||||
initialContent: branch.Name,
|
||||
handleConfirm: func(newBranchName string) error {
|
||||
gui.logAction(gui.Tr.Actions.RenameBranch)
|
||||
if err := gui.GitCommand.Branch.Rename(branch.Name, newBranchName); err != nil {
|
||||
if err := gui.Git.Branch.Rename(branch.Name, newBranchName); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
||||
@ -519,7 +519,7 @@ func (gui *Gui) handleNewBranchOffCurrentItem() error {
|
||||
initialContent: prefilledName,
|
||||
handleConfirm: func(response string) error {
|
||||
gui.logAction(gui.Tr.Actions.CreateBranch)
|
||||
if err := gui.GitCommand.Branch.New(sanitizedBranchName(response), item.ID()); err != nil {
|
||||
if err := gui.Git.Branch.New(sanitizedBranchName(response), item.ID()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ func (gui *Gui) HandlePasteCommits() error {
|
||||
handleConfirm: func() error {
|
||||
return gui.WithWaitingStatus(gui.Tr.CherryPickingStatus, func() error {
|
||||
gui.logAction(gui.Tr.Actions.CherryPick)
|
||||
err := gui.GitCommand.Rebase.CherryPickCommits(gui.State.Modes.CherryPicking.CherryPickedCommits)
|
||||
err := gui.Git.Rebase.CherryPickCommits(gui.State.Modes.CherryPicking.CherryPickedCommits)
|
||||
return gui.handleGenericMergeCommandResult(err)
|
||||
})
|
||||
},
|
||||
|
@ -45,7 +45,7 @@ func (gui *Gui) commitFilesRenderToMain() error {
|
||||
to := gui.State.CommitFileManager.GetParent()
|
||||
from, reverse := gui.getFromAndReverseArgsForDiff(to)
|
||||
|
||||
cmdObj := gui.GitCommand.WorkingTree.ShowFileDiffCmdObj(from, to, reverse, node.GetPath(), false)
|
||||
cmdObj := gui.Git.WorkingTree.ShowFileDiffCmdObj(from, to, reverse, node.GetPath(), false)
|
||||
task := NewRunPtyTask(cmdObj.GetCmd())
|
||||
|
||||
return gui.refreshMainViews(refreshMainOpts{
|
||||
@ -64,7 +64,7 @@ func (gui *Gui) handleCheckoutCommitFile() error {
|
||||
}
|
||||
|
||||
gui.logAction(gui.Tr.Actions.CheckoutFile)
|
||||
if err := gui.GitCommand.WorkingTree.CheckoutFile(gui.State.CommitFileManager.GetParent(), node.GetPath()); err != nil {
|
||||
if err := gui.Git.WorkingTree.CheckoutFile(gui.State.CommitFileManager.GetParent(), node.GetPath()); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ func (gui *Gui) handleDiscardOldFileChange() error {
|
||||
handleConfirm: func() error {
|
||||
return gui.WithWaitingStatus(gui.Tr.RebasingStatus, func() error {
|
||||
gui.logAction(gui.Tr.Actions.DiscardOldFileChange)
|
||||
if err := gui.GitCommand.Rebase.DiscardOldFileChanges(gui.State.Commits, gui.State.Panels.Commits.SelectedLineIdx, fileName); err != nil {
|
||||
if err := gui.Git.Rebase.DiscardOldFileChanges(gui.State.Commits, gui.State.Panels.Commits.SelectedLineIdx, fileName); err != nil {
|
||||
if err := gui.handleGenericMergeCommandResult(err); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -107,7 +107,7 @@ func (gui *Gui) refreshCommitFilesView() error {
|
||||
to := gui.State.Panels.CommitFiles.refName
|
||||
from, reverse := gui.getFromAndReverseArgsForDiff(to)
|
||||
|
||||
files, err := gui.GitCommand.Loaders.CommitFiles.GetFilesInDiff(from, to, reverse)
|
||||
files, err := gui.Git.Loaders.CommitFiles.GetFilesInDiff(from, to, reverse)
|
||||
if err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
@ -145,7 +145,7 @@ func (gui *Gui) handleToggleFileForPatch() error {
|
||||
}
|
||||
|
||||
toggleTheFile := func() error {
|
||||
if !gui.GitCommand.Patch.PatchManager.Active() {
|
||||
if !gui.Git.Patch.PatchManager.Active() {
|
||||
if err := gui.startPatchManager(); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -154,14 +154,14 @@ func (gui *Gui) handleToggleFileForPatch() error {
|
||||
// if there is any file that hasn't been fully added we'll fully add everything,
|
||||
// otherwise we'll remove everything
|
||||
adding := node.AnyFile(func(file *models.CommitFile) bool {
|
||||
return gui.GitCommand.Patch.PatchManager.GetFileStatus(file.Name, gui.State.CommitFileManager.GetParent()) != patch.WHOLE
|
||||
return gui.Git.Patch.PatchManager.GetFileStatus(file.Name, gui.State.CommitFileManager.GetParent()) != patch.WHOLE
|
||||
})
|
||||
|
||||
err := node.ForEachFile(func(file *models.CommitFile) error {
|
||||
if adding {
|
||||
return gui.GitCommand.Patch.PatchManager.AddFileWhole(file.Name)
|
||||
return gui.Git.Patch.PatchManager.AddFileWhole(file.Name)
|
||||
} else {
|
||||
return gui.GitCommand.Patch.PatchManager.RemoveFile(file.Name)
|
||||
return gui.Git.Patch.PatchManager.RemoveFile(file.Name)
|
||||
}
|
||||
})
|
||||
|
||||
@ -169,19 +169,19 @@ func (gui *Gui) handleToggleFileForPatch() error {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
||||
if gui.GitCommand.Patch.PatchManager.IsEmpty() {
|
||||
gui.GitCommand.Patch.PatchManager.Reset()
|
||||
if gui.Git.Patch.PatchManager.IsEmpty() {
|
||||
gui.Git.Patch.PatchManager.Reset()
|
||||
}
|
||||
|
||||
return gui.postRefreshUpdate(gui.State.Contexts.CommitFiles)
|
||||
}
|
||||
|
||||
if gui.GitCommand.Patch.PatchManager.Active() && gui.GitCommand.Patch.PatchManager.To != gui.State.CommitFileManager.GetParent() {
|
||||
if gui.Git.Patch.PatchManager.Active() && gui.Git.Patch.PatchManager.To != gui.State.CommitFileManager.GetParent() {
|
||||
return gui.ask(askOpts{
|
||||
title: gui.Tr.DiscardPatch,
|
||||
prompt: gui.Tr.DiscardPatchConfirm,
|
||||
handleConfirm: func() error {
|
||||
gui.GitCommand.Patch.PatchManager.Reset()
|
||||
gui.Git.Patch.PatchManager.Reset()
|
||||
return toggleTheFile()
|
||||
},
|
||||
})
|
||||
@ -196,7 +196,7 @@ func (gui *Gui) startPatchManager() error {
|
||||
to := gui.State.Panels.CommitFiles.refName
|
||||
from, reverse := gui.getFromAndReverseArgsForDiff(to)
|
||||
|
||||
gui.GitCommand.Patch.PatchManager.Start(from, to, reverse, canRebase)
|
||||
gui.Git.Patch.PatchManager.Start(from, to, reverse, canRebase)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -215,7 +215,7 @@ func (gui *Gui) enterCommitFile(opts OnFocusOpts) error {
|
||||
}
|
||||
|
||||
enterTheFile := func() error {
|
||||
if !gui.GitCommand.Patch.PatchManager.Active() {
|
||||
if !gui.Git.Patch.PatchManager.Active() {
|
||||
if err := gui.startPatchManager(); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -224,13 +224,13 @@ func (gui *Gui) enterCommitFile(opts OnFocusOpts) error {
|
||||
return gui.pushContext(gui.State.Contexts.PatchBuilding, opts)
|
||||
}
|
||||
|
||||
if gui.GitCommand.Patch.PatchManager.Active() && gui.GitCommand.Patch.PatchManager.To != gui.State.CommitFileManager.GetParent() {
|
||||
if gui.Git.Patch.PatchManager.Active() && gui.Git.Patch.PatchManager.To != gui.State.CommitFileManager.GetParent() {
|
||||
return gui.ask(askOpts{
|
||||
title: gui.Tr.DiscardPatch,
|
||||
prompt: gui.Tr.DiscardPatchConfirm,
|
||||
handlersManageFocus: true,
|
||||
handleConfirm: func() error {
|
||||
gui.GitCommand.Patch.PatchManager.Reset()
|
||||
gui.Git.Patch.PatchManager.Reset()
|
||||
return enterTheFile()
|
||||
},
|
||||
handleClose: func() error {
|
||||
|
@ -15,7 +15,7 @@ func (gui *Gui) handleCommitConfirm() error {
|
||||
return gui.createErrorPanel(gui.Tr.CommitWithoutMessageErr)
|
||||
}
|
||||
|
||||
cmdObj := gui.GitCommand.Commit.CommitCmdObj(message)
|
||||
cmdObj := gui.Git.Commit.CommitCmdObj(message)
|
||||
gui.logAction(gui.Tr.Actions.Commit)
|
||||
|
||||
_ = gui.returnFromContext()
|
||||
|
@ -45,7 +45,7 @@ func (gui *Gui) branchCommitsRenderToMain() error {
|
||||
if commit == nil {
|
||||
task = NewRenderStringTask(gui.Tr.NoCommitsThisBranch)
|
||||
} else {
|
||||
cmdObj := gui.GitCommand.Commit.ShowCmdObj(commit.Sha, gui.State.Modes.Filtering.GetPath())
|
||||
cmdObj := gui.Git.Commit.ShowCmdObj(commit.Sha, gui.State.Modes.Filtering.GetPath())
|
||||
task = NewRunPtyTask(cmdObj.GetCmd())
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ func (gui *Gui) refreshCommitsWithLimit() error {
|
||||
gui.Mutexes.BranchCommitsMutex.Lock()
|
||||
defer gui.Mutexes.BranchCommitsMutex.Unlock()
|
||||
|
||||
commits, err := gui.GitCommand.Loaders.Commits.GetCommits(
|
||||
commits, err := gui.Git.Loaders.Commits.GetCommits(
|
||||
loaders.GetCommitsOptions{
|
||||
Limit: gui.State.Panels.Commits.LimitCommits,
|
||||
FilterPath: gui.State.Modes.Filtering.GetPath(),
|
||||
@ -139,7 +139,7 @@ func (gui *Gui) refreshRebaseCommits() error {
|
||||
gui.Mutexes.BranchCommitsMutex.Lock()
|
||||
defer gui.Mutexes.BranchCommitsMutex.Unlock()
|
||||
|
||||
updatedCommits, err := gui.GitCommand.Loaders.Commits.MergeRebasingCommits(gui.State.Commits)
|
||||
updatedCommits, err := gui.Git.Loaders.Commits.MergeRebasingCommits(gui.State.Commits)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -173,7 +173,7 @@ func (gui *Gui) handleCommitSquashDown() error {
|
||||
handleConfirm: func() error {
|
||||
return gui.WithWaitingStatus(gui.Tr.SquashingStatus, func() error {
|
||||
gui.logAction(gui.Tr.Actions.SquashCommitDown)
|
||||
err := gui.GitCommand.Rebase.InteractiveRebase(gui.State.Commits, gui.State.Panels.Commits.SelectedLineIdx, "squash")
|
||||
err := gui.Git.Rebase.InteractiveRebase(gui.State.Commits, gui.State.Panels.Commits.SelectedLineIdx, "squash")
|
||||
return gui.handleGenericMergeCommandResult(err)
|
||||
})
|
||||
},
|
||||
@ -203,7 +203,7 @@ func (gui *Gui) handleCommitFixup() error {
|
||||
handleConfirm: func() error {
|
||||
return gui.WithWaitingStatus(gui.Tr.FixingStatus, func() error {
|
||||
gui.logAction(gui.Tr.Actions.FixupCommit)
|
||||
err := gui.GitCommand.Rebase.InteractiveRebase(gui.State.Commits, gui.State.Panels.Commits.SelectedLineIdx, "fixup")
|
||||
err := gui.Git.Rebase.InteractiveRebase(gui.State.Commits, gui.State.Panels.Commits.SelectedLineIdx, "fixup")
|
||||
return gui.handleGenericMergeCommandResult(err)
|
||||
})
|
||||
},
|
||||
@ -232,7 +232,7 @@ func (gui *Gui) handleRewordCommit() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
message, err := gui.GitCommand.Commit.GetCommitMessage(commit.Sha)
|
||||
message, err := gui.Git.Commit.GetCommitMessage(commit.Sha)
|
||||
if err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
@ -242,7 +242,7 @@ func (gui *Gui) handleRewordCommit() error {
|
||||
initialContent: message,
|
||||
handleConfirm: func(response string) error {
|
||||
gui.logAction(gui.Tr.Actions.RewordCommit)
|
||||
if err := gui.GitCommand.Commit.RewordLastCommit(response); err != nil {
|
||||
if err := gui.Git.Commit.RewordLastCommit(response); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
||||
@ -265,7 +265,7 @@ func (gui *Gui) handleRenameCommitEditor() error {
|
||||
}
|
||||
|
||||
gui.logAction(gui.Tr.Actions.RewordCommit)
|
||||
subProcess, err := gui.GitCommand.Rebase.RewordCommit(gui.State.Commits, gui.State.Panels.Commits.SelectedLineIdx)
|
||||
subProcess, err := gui.Git.Rebase.RewordCommit(gui.State.Commits, gui.State.Panels.Commits.SelectedLineIdx)
|
||||
if err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
@ -299,7 +299,7 @@ func (gui *Gui) handleMidRebaseCommand(action string) (bool, error) {
|
||||
false,
|
||||
)
|
||||
|
||||
if err := gui.GitCommand.Rebase.EditRebaseTodo(gui.State.Panels.Commits.SelectedLineIdx, action); err != nil {
|
||||
if err := gui.Git.Rebase.EditRebaseTodo(gui.State.Panels.Commits.SelectedLineIdx, action); err != nil {
|
||||
return false, gui.surfaceError(err)
|
||||
}
|
||||
|
||||
@ -325,7 +325,7 @@ func (gui *Gui) handleCommitDelete() error {
|
||||
handleConfirm: func() error {
|
||||
return gui.WithWaitingStatus(gui.Tr.DeletingStatus, func() error {
|
||||
gui.logAction(gui.Tr.Actions.DropCommit)
|
||||
err := gui.GitCommand.Rebase.InteractiveRebase(gui.State.Commits, gui.State.Panels.Commits.SelectedLineIdx, "drop")
|
||||
err := gui.Git.Rebase.InteractiveRebase(gui.State.Commits, gui.State.Panels.Commits.SelectedLineIdx, "drop")
|
||||
return gui.handleGenericMergeCommandResult(err)
|
||||
})
|
||||
},
|
||||
@ -349,7 +349,7 @@ func (gui *Gui) handleCommitMoveDown() error {
|
||||
gui.logAction(gui.Tr.Actions.MoveCommitDown)
|
||||
gui.logCommand(fmt.Sprintf("Moving commit %s down", selectedCommit.ShortSha()), false)
|
||||
|
||||
if err := gui.GitCommand.Rebase.MoveTodoDown(index); err != nil {
|
||||
if err := gui.Git.Rebase.MoveTodoDown(index); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
gui.State.Panels.Commits.SelectedLineIdx++
|
||||
@ -358,7 +358,7 @@ func (gui *Gui) handleCommitMoveDown() error {
|
||||
|
||||
return gui.WithWaitingStatus(gui.Tr.MovingStatus, func() error {
|
||||
gui.logAction(gui.Tr.Actions.MoveCommitDown)
|
||||
err := gui.GitCommand.Rebase.MoveCommitDown(gui.State.Commits, index)
|
||||
err := gui.Git.Rebase.MoveCommitDown(gui.State.Commits, index)
|
||||
if err == nil {
|
||||
gui.State.Panels.Commits.SelectedLineIdx++
|
||||
}
|
||||
@ -386,7 +386,7 @@ func (gui *Gui) handleCommitMoveUp() error {
|
||||
false,
|
||||
)
|
||||
|
||||
if err := gui.GitCommand.Rebase.MoveTodoDown(index - 1); err != nil {
|
||||
if err := gui.Git.Rebase.MoveTodoDown(index - 1); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
gui.State.Panels.Commits.SelectedLineIdx--
|
||||
@ -395,7 +395,7 @@ func (gui *Gui) handleCommitMoveUp() error {
|
||||
|
||||
return gui.WithWaitingStatus(gui.Tr.MovingStatus, func() error {
|
||||
gui.logAction(gui.Tr.Actions.MoveCommitUp)
|
||||
err := gui.GitCommand.Rebase.MoveCommitDown(gui.State.Commits, index-1)
|
||||
err := gui.Git.Rebase.MoveCommitDown(gui.State.Commits, index-1)
|
||||
if err == nil {
|
||||
gui.State.Panels.Commits.SelectedLineIdx--
|
||||
}
|
||||
@ -418,7 +418,7 @@ func (gui *Gui) handleCommitEdit() error {
|
||||
|
||||
return gui.WithWaitingStatus(gui.Tr.RebasingStatus, func() error {
|
||||
gui.logAction(gui.Tr.Actions.EditCommit)
|
||||
err = gui.GitCommand.Rebase.InteractiveRebase(gui.State.Commits, gui.State.Panels.Commits.SelectedLineIdx, "edit")
|
||||
err = gui.Git.Rebase.InteractiveRebase(gui.State.Commits, gui.State.Panels.Commits.SelectedLineIdx, "edit")
|
||||
return gui.handleGenericMergeCommandResult(err)
|
||||
})
|
||||
}
|
||||
@ -434,7 +434,7 @@ func (gui *Gui) handleCommitAmendTo() error {
|
||||
handleConfirm: func() error {
|
||||
return gui.WithWaitingStatus(gui.Tr.AmendingStatus, func() error {
|
||||
gui.logAction(gui.Tr.Actions.AmendCommit)
|
||||
err := gui.GitCommand.Rebase.AmendTo(gui.State.Commits[gui.State.Panels.Commits.SelectedLineIdx].Sha)
|
||||
err := gui.Git.Rebase.AmendTo(gui.State.Commits[gui.State.Panels.Commits.SelectedLineIdx].Sha)
|
||||
return gui.handleGenericMergeCommandResult(err)
|
||||
})
|
||||
},
|
||||
@ -470,7 +470,7 @@ func (gui *Gui) handleCommitRevert() error {
|
||||
return gui.createRevertMergeCommitMenu(commit)
|
||||
} else {
|
||||
gui.logAction(gui.Tr.Actions.RevertCommit)
|
||||
if err := gui.GitCommand.Commit.Revert(commit.Sha); err != nil {
|
||||
if err := gui.Git.Commit.Revert(commit.Sha); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
return gui.afterRevertCommit()
|
||||
@ -481,7 +481,7 @@ func (gui *Gui) createRevertMergeCommitMenu(commit *models.Commit) error {
|
||||
menuItems := make([]*menuItem, len(commit.Parents))
|
||||
for i, parentSha := range commit.Parents {
|
||||
i := i
|
||||
message, err := gui.GitCommand.Commit.GetCommitMessageFirstLine(parentSha)
|
||||
message, err := gui.Git.Commit.GetCommitMessageFirstLine(parentSha)
|
||||
if err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
@ -491,7 +491,7 @@ func (gui *Gui) createRevertMergeCommitMenu(commit *models.Commit) error {
|
||||
onPress: func() error {
|
||||
parentNumber := i + 1
|
||||
gui.logAction(gui.Tr.Actions.RevertCommit)
|
||||
if err := gui.GitCommand.Commit.RevertMerge(commit.Sha, parentNumber); err != nil {
|
||||
if err := gui.Git.Commit.RevertMerge(commit.Sha, parentNumber); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
return gui.afterRevertCommit()
|
||||
@ -538,7 +538,7 @@ func (gui *Gui) handleCreateFixupCommit() error {
|
||||
prompt: prompt,
|
||||
handleConfirm: func() error {
|
||||
gui.logAction(gui.Tr.Actions.CreateFixupCommit)
|
||||
if err := gui.GitCommand.Commit.CreateFixupCommit(commit.Sha); err != nil {
|
||||
if err := gui.Git.Commit.CreateFixupCommit(commit.Sha); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
||||
@ -570,7 +570,7 @@ func (gui *Gui) handleSquashAllAboveFixupCommits() error {
|
||||
handleConfirm: func() error {
|
||||
return gui.WithWaitingStatus(gui.Tr.SquashingStatus, func() error {
|
||||
gui.logAction(gui.Tr.Actions.SquashAllAboveFixupCommits)
|
||||
err := gui.GitCommand.Rebase.SquashAllAboveFixupCommits(commit.Sha)
|
||||
err := gui.Git.Rebase.SquashAllAboveFixupCommits(commit.Sha)
|
||||
return gui.handleGenericMergeCommandResult(err)
|
||||
})
|
||||
},
|
||||
@ -618,7 +618,7 @@ func (gui *Gui) handleCreateAnnotatedTag(commitSha string) error {
|
||||
title: gui.Tr.TagMessageTitle,
|
||||
handleConfirm: func(msg string) error {
|
||||
gui.logAction(gui.Tr.Actions.CreateAnnotatedTag)
|
||||
if err := gui.GitCommand.Tag.CreateAnnotated(tagName, commitSha, msg); err != nil {
|
||||
if err := gui.Git.Tag.CreateAnnotated(tagName, commitSha, msg); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
return gui.afterTagCreate(tagName)
|
||||
@ -633,7 +633,7 @@ func (gui *Gui) handleCreateLightweightTag(commitSha string) error {
|
||||
title: gui.Tr.TagNameTitle,
|
||||
handleConfirm: func(tagName string) error {
|
||||
gui.logAction(gui.Tr.Actions.CreateLightweightTag)
|
||||
if err := gui.GitCommand.Tag.CreateLightweight(tagName, commitSha); err != nil {
|
||||
if err := gui.Git.Tag.CreateLightweight(tagName, commitSha); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
return gui.afterTagCreate(tagName)
|
||||
@ -702,7 +702,7 @@ func (gui *Gui) handleCopySelectedCommitMessageToClipboard() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
message, err := gui.GitCommand.Commit.GetCommitMessage(commit.Sha)
|
||||
message, err := gui.Git.Commit.GetCommitMessage(commit.Sha)
|
||||
if err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ func (gui *Gui) menuPromptFromCommand(prompt config.CustomCommandPrompt, promptR
|
||||
}
|
||||
|
||||
// Run and save output
|
||||
message, err := gui.GitCommand.Custom.RunWithOutput(cmdStr)
|
||||
message, err := gui.Git.Custom.RunWithOutput(cmdStr)
|
||||
if err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ func (gui *Gui) DecreaseContextInDiffView() error {
|
||||
}
|
||||
|
||||
func (gui *Gui) CheckCanChangeContext() error {
|
||||
if gui.GitCommand.Patch.PatchManager.Active() {
|
||||
if gui.Git.Patch.PatchManager.Active() {
|
||||
return errors.New(gui.Tr.CantChangeContextSizeError)
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ func setupGuiForTest(gui *Gui) {
|
||||
gui.g = &gocui.Gui{}
|
||||
gui.Views.Main, _ = gui.prepareView("main")
|
||||
gui.Views.Secondary, _ = gui.prepareView("secondary")
|
||||
gui.GitCommand.Patch.PatchManager = &patch.PatchManager{}
|
||||
gui.Git.Patch.PatchManager = &patch.PatchManager{}
|
||||
_, _ = gui.refreshLineByLinePanel(diffForTest, "", false, 11)
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ func TestDoesntIncreaseContextInDiffViewInContextWhenInPatchBuildingMode(t *test
|
||||
setupGuiForTest(gui)
|
||||
gui.UserConfig.Git.DiffContextSize = 2
|
||||
_ = gui.pushContextDirect(gui.State.Contexts.CommitFiles)
|
||||
gui.GitCommand.Patch.PatchManager.Start("from", "to", false, false)
|
||||
gui.Git.Patch.PatchManager.Start("from", "to", false, false)
|
||||
|
||||
errorCount := 0
|
||||
gui.PopupHandler = &TestPopupHandler{
|
||||
@ -158,7 +158,7 @@ func TestDoesntDecreaseContextInDiffViewInContextWhenInPatchBuildingMode(t *test
|
||||
setupGuiForTest(gui)
|
||||
gui.UserConfig.Git.DiffContextSize = 2
|
||||
_ = gui.pushContextDirect(gui.State.Contexts.CommitFiles)
|
||||
gui.GitCommand.Patch.PatchManager.Start("from", "to", false, false)
|
||||
gui.Git.Patch.PatchManager.Start("from", "to", false, false)
|
||||
|
||||
errorCount := 0
|
||||
gui.PopupHandler = &TestPopupHandler{
|
||||
|
@ -13,7 +13,7 @@ func (gui *Gui) handleCreateDiscardMenu() error {
|
||||
displayString: gui.Tr.LcDiscardAllChanges,
|
||||
onPress: func() error {
|
||||
gui.logAction(gui.Tr.Actions.DiscardAllChangesInDirectory)
|
||||
if err := gui.GitCommand.WorkingTree.DiscardAllDirChanges(node); err != nil {
|
||||
if err := gui.Git.WorkingTree.DiscardAllDirChanges(node); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
return gui.refreshSidePanels(refreshOptions{mode: ASYNC, scope: []RefreshableView{FILES}})
|
||||
@ -26,7 +26,7 @@ func (gui *Gui) handleCreateDiscardMenu() error {
|
||||
displayString: gui.Tr.LcDiscardUnstagedChanges,
|
||||
onPress: func() error {
|
||||
gui.logAction(gui.Tr.Actions.DiscardUnstagedChangesInDirectory)
|
||||
if err := gui.GitCommand.WorkingTree.DiscardUnstagedDirChanges(node); err != nil {
|
||||
if err := gui.Git.WorkingTree.DiscardUnstagedDirChanges(node); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ func (gui *Gui) handleCreateDiscardMenu() error {
|
||||
displayString: gui.Tr.LcDiscardAllChanges,
|
||||
onPress: func() error {
|
||||
gui.logAction(gui.Tr.Actions.DiscardAllChangesInFile)
|
||||
if err := gui.GitCommand.WorkingTree.DiscardAllFileChanges(file); err != nil {
|
||||
if err := gui.Git.WorkingTree.DiscardAllFileChanges(file); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
return gui.refreshSidePanels(refreshOptions{mode: ASYNC, scope: []RefreshableView{FILES}})
|
||||
@ -68,7 +68,7 @@ func (gui *Gui) handleCreateDiscardMenu() error {
|
||||
displayString: gui.Tr.LcDiscardUnstagedChanges,
|
||||
onPress: func() error {
|
||||
gui.logAction(gui.Tr.Actions.DiscardAllUnstagedChangesInFile)
|
||||
if err := gui.GitCommand.WorkingTree.DiscardUnstagedFileChanges(file); err != nil {
|
||||
if err := gui.Git.WorkingTree.DiscardUnstagedFileChanges(file); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ func (gui *Gui) filesRenderToMain() error {
|
||||
return gui.refreshMergePanelWithLock()
|
||||
}
|
||||
|
||||
cmdObj := gui.GitCommand.WorkingTree.WorktreeFileDiffCmdObj(node, false, !node.GetHasUnstagedChanges() && node.GetHasStagedChanges(), gui.State.IgnoreWhitespaceInDiffView)
|
||||
cmdObj := gui.Git.WorkingTree.WorktreeFileDiffCmdObj(node, false, !node.GetHasUnstagedChanges() && node.GetHasStagedChanges(), gui.State.IgnoreWhitespaceInDiffView)
|
||||
|
||||
refreshOpts := refreshMainOpts{main: &viewUpdateOpts{
|
||||
title: gui.Tr.UnstagedChanges,
|
||||
@ -67,7 +67,7 @@ func (gui *Gui) filesRenderToMain() error {
|
||||
|
||||
if node.GetHasUnstagedChanges() {
|
||||
if node.GetHasStagedChanges() {
|
||||
cmdObj := gui.GitCommand.WorkingTree.WorktreeFileDiffCmdObj(node, false, true, gui.State.IgnoreWhitespaceInDiffView)
|
||||
cmdObj := gui.Git.WorkingTree.WorktreeFileDiffCmdObj(node, false, true, gui.State.IgnoreWhitespaceInDiffView)
|
||||
|
||||
refreshOpts.secondary = &viewUpdateOpts{
|
||||
title: gui.Tr.StagedChanges,
|
||||
@ -157,7 +157,7 @@ func (gui *Gui) stageSelectedFile() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
return gui.GitCommand.WorkingTree.StageFile(file.Name)
|
||||
return gui.Git.WorkingTree.StageFile(file.Name)
|
||||
}
|
||||
|
||||
func (gui *Gui) handleEnterFile() error {
|
||||
@ -207,12 +207,12 @@ func (gui *Gui) handleFilePress() error {
|
||||
|
||||
if file.HasUnstagedChanges {
|
||||
gui.logAction(gui.Tr.Actions.StageFile)
|
||||
if err := gui.GitCommand.WorkingTree.StageFile(file.Name); err != nil {
|
||||
if err := gui.Git.WorkingTree.StageFile(file.Name); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
} else {
|
||||
gui.logAction(gui.Tr.Actions.UnstageFile)
|
||||
if err := gui.GitCommand.WorkingTree.UnStageFile(file.Names(), file.Tracked); err != nil {
|
||||
if err := gui.Git.WorkingTree.UnStageFile(file.Names(), file.Tracked); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
}
|
||||
@ -225,13 +225,13 @@ func (gui *Gui) handleFilePress() error {
|
||||
|
||||
if node.GetHasUnstagedChanges() {
|
||||
gui.logAction(gui.Tr.Actions.StageFile)
|
||||
if err := gui.GitCommand.WorkingTree.StageFile(node.Path); err != nil {
|
||||
if err := gui.Git.WorkingTree.StageFile(node.Path); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
} else {
|
||||
// pretty sure it doesn't matter that we're always passing true here
|
||||
gui.logAction(gui.Tr.Actions.UnstageFile)
|
||||
if err := gui.GitCommand.WorkingTree.UnStageFile([]string{node.Path}, true); err != nil {
|
||||
if err := gui.Git.WorkingTree.UnStageFile([]string{node.Path}, true); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
}
|
||||
@ -262,10 +262,10 @@ func (gui *Gui) handleStageAll() error {
|
||||
var err error
|
||||
if gui.allFilesStaged() {
|
||||
gui.logAction(gui.Tr.Actions.UnstageAllFiles)
|
||||
err = gui.GitCommand.WorkingTree.UnstageAll()
|
||||
err = gui.Git.WorkingTree.UnstageAll()
|
||||
} else {
|
||||
gui.logAction(gui.Tr.Actions.StageAllFiles)
|
||||
err = gui.GitCommand.WorkingTree.StageAll()
|
||||
err = gui.Git.WorkingTree.StageAll()
|
||||
}
|
||||
if err != nil {
|
||||
_ = gui.surfaceError(err)
|
||||
@ -291,7 +291,7 @@ func (gui *Gui) handleIgnoreFile() error {
|
||||
unstageFiles := func() error {
|
||||
return node.ForEachFile(func(file *models.File) error {
|
||||
if file.HasStagedChanges {
|
||||
if err := gui.GitCommand.WorkingTree.UnStageFile(file.Names(), file.Tracked); err != nil {
|
||||
if err := gui.Git.WorkingTree.UnStageFile(file.Names(), file.Tracked); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@ -311,11 +311,11 @@ func (gui *Gui) handleIgnoreFile() error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := gui.GitCommand.WorkingTree.RemoveTrackedFiles(node.GetPath()); err != nil {
|
||||
if err := gui.Git.WorkingTree.RemoveTrackedFiles(node.GetPath()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := gui.GitCommand.WorkingTree.Ignore(node.GetPath()); err != nil {
|
||||
if err := gui.Git.WorkingTree.Ignore(node.GetPath()); err != nil {
|
||||
return err
|
||||
}
|
||||
return gui.refreshSidePanels(refreshOptions{scope: []RefreshableView{FILES}})
|
||||
@ -329,7 +329,7 @@ func (gui *Gui) handleIgnoreFile() error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := gui.GitCommand.WorkingTree.Ignore(node.GetPath()); err != nil {
|
||||
if err := gui.Git.WorkingTree.Ignore(node.GetPath()); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
||||
@ -363,7 +363,7 @@ func (gui *Gui) prepareFilesForCommit() error {
|
||||
noStagedFiles := len(gui.stagedFiles()) == 0
|
||||
if noStagedFiles && gui.UserConfig.Gui.SkipNoStagedFilesWarning {
|
||||
gui.logAction(gui.Tr.Actions.StageAllFiles)
|
||||
err := gui.GitCommand.WorkingTree.StageAll()
|
||||
err := gui.Git.WorkingTree.StageAll()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -424,7 +424,7 @@ func (gui *Gui) promptToStageAllAndRetry(retry func() error) error {
|
||||
prompt: gui.Tr.NoFilesStagedPrompt,
|
||||
handleConfirm: func() error {
|
||||
gui.logAction(gui.Tr.Actions.StageAllFiles)
|
||||
if err := gui.GitCommand.WorkingTree.StageAll(); err != nil {
|
||||
if err := gui.Git.WorkingTree.StageAll(); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
if err := gui.refreshFilesAndSubmodules(); err != nil {
|
||||
@ -453,7 +453,7 @@ func (gui *Gui) handleAmendCommitPress() error {
|
||||
title: strings.Title(gui.Tr.AmendLastCommit),
|
||||
prompt: gui.Tr.SureToAmend,
|
||||
handleConfirm: func() error {
|
||||
cmdObj := gui.GitCommand.Commit.AmendHeadCmdObj()
|
||||
cmdObj := gui.Git.Commit.AmendHeadCmdObj()
|
||||
gui.logAction(gui.Tr.Actions.AmendCommit)
|
||||
return gui.withGpgHandling(cmdObj, gui.Tr.AmendingStatus, nil)
|
||||
},
|
||||
@ -473,7 +473,7 @@ func (gui *Gui) handleCommitEditorPress() error {
|
||||
|
||||
gui.logAction(gui.Tr.Actions.Commit)
|
||||
return gui.runSubprocessWithSuspenseAndRefresh(
|
||||
gui.GitCommand.Commit.CommitEditorCmdObj(),
|
||||
gui.Git.Commit.CommitEditorCmdObj(),
|
||||
)
|
||||
}
|
||||
|
||||
@ -513,7 +513,7 @@ func (gui *Gui) editFile(filename string) error {
|
||||
}
|
||||
|
||||
func (gui *Gui) editFileAtLine(filename string, lineNumber int) error {
|
||||
cmdStr, err := gui.GitCommand.File.GetEditCmdStr(filename, lineNumber)
|
||||
cmdStr, err := gui.Git.File.GetEditCmdStr(filename, lineNumber)
|
||||
if err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
@ -562,7 +562,7 @@ func (gui *Gui) refreshStateFiles() error {
|
||||
prevNodes := gui.State.FileManager.GetAllItems()
|
||||
prevSelectedLineIdx := gui.State.Panels.Files.SelectedLineIdx
|
||||
|
||||
files := gui.GitCommand.Loaders.Files.
|
||||
files := gui.Git.Loaders.Files.
|
||||
GetStatusFiles(loaders.GetStatusFileOptions{})
|
||||
|
||||
// for when you stage the old file of a rename and the new file is in a collapsed dir
|
||||
@ -660,7 +660,7 @@ func (gui *Gui) handlePullFiles() error {
|
||||
// if we have no upstream branch we need to set that first
|
||||
if !currentBranch.IsTrackingRemote() {
|
||||
// see if we have this branch in our config with an upstream
|
||||
branches, err := gui.GitCommand.Config.Branches()
|
||||
branches, err := gui.Git.Config.Branches()
|
||||
if err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
@ -677,7 +677,7 @@ func (gui *Gui) handlePullFiles() error {
|
||||
initialContent: suggestedRemote + "/" + currentBranch.Name,
|
||||
findSuggestionsFunc: gui.getRemoteBranchesSuggestionsFunc("/"),
|
||||
handleConfirm: func(upstream string) error {
|
||||
if err := gui.GitCommand.Branch.SetCurrentBranchUpstream(upstream); err != nil {
|
||||
if err := gui.Git.Branch.SetCurrentBranchUpstream(upstream); err != nil {
|
||||
errorMessage := err.Error()
|
||||
if strings.Contains(errorMessage, "does not exist") {
|
||||
errorMessage = fmt.Sprintf("upstream branch %s not found.\nIf you expect it to exist, you should fetch (with 'f').\nOtherwise, you should push (with 'shift+P')", upstream)
|
||||
@ -716,7 +716,7 @@ func (gui *Gui) pullWithLock(opts PullFilesOptions) error {
|
||||
|
||||
gui.logAction(opts.action)
|
||||
|
||||
err := gui.GitCommand.Sync.Pull(
|
||||
err := gui.Git.Sync.Pull(
|
||||
git_commands.PullOptions{
|
||||
RemoteName: opts.RemoteName,
|
||||
BranchName: opts.BranchName,
|
||||
@ -742,7 +742,7 @@ func (gui *Gui) push(opts pushOpts) error {
|
||||
}
|
||||
go utils.Safe(func() {
|
||||
gui.logAction(gui.Tr.Actions.Push)
|
||||
err := gui.GitCommand.Sync.Push(git_commands.PushOpts{
|
||||
err := gui.Git.Sync.Push(git_commands.PushOpts{
|
||||
Force: opts.force,
|
||||
UpstreamRemote: opts.upstreamRemote,
|
||||
UpstreamBranch: opts.upstreamBranch,
|
||||
@ -810,7 +810,7 @@ func (gui *Gui) pushFiles() error {
|
||||
|
||||
suggestedRemote := getSuggestedRemote(gui.State.Remotes)
|
||||
|
||||
if gui.GitCommand.Config.GetPushToCurrent() {
|
||||
if gui.Git.Config.GetPushToCurrent() {
|
||||
return gui.push(pushOpts{setUpstream: true})
|
||||
} else {
|
||||
return gui.prompt(promptOpts{
|
||||
@ -870,7 +870,7 @@ func (gui *Gui) requestToForcePush() error {
|
||||
}
|
||||
|
||||
func (gui *Gui) upstreamForBranchInConfig(branchName string) (string, string, error) {
|
||||
branches, err := gui.GitCommand.Config.Branches()
|
||||
branches, err := gui.Git.Config.Branches()
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
@ -945,14 +945,14 @@ func (gui *Gui) handleCreateStashMenu() error {
|
||||
displayString: gui.Tr.LcStashAllChanges,
|
||||
onPress: func() error {
|
||||
gui.logAction(gui.Tr.Actions.StashAllChanges)
|
||||
return gui.handleStashSave(gui.GitCommand.Stash.Save)
|
||||
return gui.handleStashSave(gui.Git.Stash.Save)
|
||||
},
|
||||
},
|
||||
{
|
||||
displayString: gui.Tr.LcStashStagedChanges,
|
||||
onPress: func() error {
|
||||
gui.logAction(gui.Tr.Actions.StashStagedChanges)
|
||||
return gui.handleStashSave(gui.GitCommand.Stash.SaveStagedChanges)
|
||||
return gui.handleStashSave(gui.Git.Stash.SaveStagedChanges)
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -961,7 +961,7 @@ func (gui *Gui) handleCreateStashMenu() error {
|
||||
}
|
||||
|
||||
func (gui *Gui) handleStashChanges() error {
|
||||
return gui.handleStashSave(gui.GitCommand.Stash.Save)
|
||||
return gui.handleStashSave(gui.Git.Stash.Save)
|
||||
}
|
||||
|
||||
func (gui *Gui) handleCreateResetToUpstreamMenu() error {
|
||||
@ -1017,7 +1017,7 @@ func (gui *Gui) handleOpenMergeTool() error {
|
||||
handleConfirm: func() error {
|
||||
gui.logAction(gui.Tr.Actions.OpenMergeTool)
|
||||
return gui.runSubprocessWithSuspenseAndRefresh(
|
||||
gui.GitCommand.WorkingTree.OpenMergeToolCmdObj(),
|
||||
gui.Git.WorkingTree.OpenMergeToolCmdObj(),
|
||||
)
|
||||
},
|
||||
})
|
||||
|
@ -12,7 +12,7 @@ func (gui *Gui) handleCreateGitFlowMenu() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
if !gui.GitCommand.Flow.GitFlowEnabled() {
|
||||
if !gui.Git.Flow.GitFlowEnabled() {
|
||||
return gui.createErrorPanel("You need to install git-flow and enable it in this repo to use git-flow features")
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ func (gui *Gui) handleCreateGitFlowMenu() error {
|
||||
handleConfirm: func(name string) error {
|
||||
gui.logAction(gui.Tr.Actions.GitFlowStart)
|
||||
return gui.runSubprocessWithSuspenseAndRefresh(
|
||||
gui.GitCommand.Flow.StartCmdObj(branchType, name),
|
||||
gui.Git.Flow.StartCmdObj(branchType, name),
|
||||
)
|
||||
},
|
||||
})
|
||||
@ -62,7 +62,7 @@ func (gui *Gui) handleCreateGitFlowMenu() error {
|
||||
}
|
||||
|
||||
func (gui *Gui) gitFlowFinishBranch(branchName string) error {
|
||||
cmdObj, err := gui.GitCommand.Flow.FinishCmdObj(branchName)
|
||||
cmdObj, err := gui.Git.Flow.FinishCmdObj(branchName)
|
||||
if err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ func (gui *Gui) fetch() (err error) {
|
||||
defer gui.Mutexes.FetchMutex.Unlock()
|
||||
|
||||
gui.logAction("Fetch")
|
||||
err = gui.GitCommand.Sync.Fetch(git_commands.FetchOptions{})
|
||||
err = gui.Git.Sync.Fetch(git_commands.FetchOptions{})
|
||||
|
||||
if err != nil && strings.Contains(err.Error(), "exit status 128") {
|
||||
_ = gui.createErrorPanel(gui.Tr.PassUnameWrong)
|
||||
@ -230,7 +230,7 @@ func (gui *Gui) backgroundFetch() (err error) {
|
||||
gui.Mutexes.FetchMutex.Lock()
|
||||
defer gui.Mutexes.FetchMutex.Unlock()
|
||||
|
||||
err = gui.GitCommand.Sync.Fetch(git_commands.FetchOptions{Background: true})
|
||||
err = gui.Git.Sync.Fetch(git_commands.FetchOptions{Background: true})
|
||||
|
||||
_ = gui.refreshSidePanels(refreshOptions{scope: []RefreshableView{BRANCHES, COMMITS, REMOTES, TAGS}, mode: ASYNC})
|
||||
|
||||
|
@ -15,7 +15,7 @@ import (
|
||||
func (gui *Gui) withGpgHandling(cmdObj oscommands.ICmdObj, waitingStatus string, onSuccess func() error) error {
|
||||
gui.logCommand(cmdObj.ToString(), true)
|
||||
|
||||
useSubprocess := gui.GitCommand.Config.UsingGpg()
|
||||
useSubprocess := gui.Git.Config.UsingGpg()
|
||||
if useSubprocess {
|
||||
success, err := gui.runSubprocessWithSuspense(gui.OSCommand.Cmd.NewShell(cmdObj.ToString()))
|
||||
if success && onSuccess != nil {
|
||||
|
@ -68,9 +68,9 @@ type Repo string
|
||||
// Gui wraps the gocui Gui object which handles rendering and events
|
||||
type Gui struct {
|
||||
*common.Common
|
||||
g *gocui.Gui
|
||||
GitCommand *commands.GitCommand
|
||||
OSCommand *oscommands.OSCommand
|
||||
g *gocui.Gui
|
||||
Git *commands.GitCommand
|
||||
OSCommand *oscommands.OSCommand
|
||||
|
||||
// this is the state of the GUI for the current repo
|
||||
State *guiState
|
||||
@ -471,7 +471,7 @@ func NewGui(
|
||||
|
||||
gui.OSCommand = osCommand
|
||||
var err error
|
||||
gui.GitCommand, err = commands.NewGitCommand(
|
||||
gui.Git, err = commands.NewGitCommand(
|
||||
cmn,
|
||||
osCommand,
|
||||
gitConfig,
|
||||
|
@ -144,7 +144,7 @@ func (gui *Gui) refreshMainViewForLineByLine(state *LblPanelState) error {
|
||||
if gui.currentContext().GetKey() == gui.State.Contexts.PatchBuilding.GetKey() {
|
||||
filename := gui.getSelectedCommitFileName()
|
||||
var err error
|
||||
includedLineIndices, err = gui.GitCommand.Patch.PatchManager.GetFileIncLineIndices(filename)
|
||||
includedLineIndices, err = gui.Git.Patch.PatchManager.GetFileIncLineIndices(filename)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -312,7 +312,7 @@ func (gui *Gui) commitFilesListContext() IListContext {
|
||||
return [][]string{{style.FgRed.Sprint("(none)")}}
|
||||
}
|
||||
|
||||
lines := gui.State.CommitFileManager.Render(gui.State.Modes.Diffing.Ref, gui.GitCommand.Patch.PatchManager)
|
||||
lines := gui.State.CommitFileManager.Render(gui.State.Modes.Diffing.Ref, gui.Git.Patch.PatchManager)
|
||||
mappedLines := make([][]string, len(lines))
|
||||
for i, line := range lines {
|
||||
mappedLines[i] = []string{line}
|
||||
|
@ -195,7 +195,7 @@ func (gui *Gui) catSelectedFile() (string, error) {
|
||||
return "", errors.New(gui.Tr.NotAFile)
|
||||
}
|
||||
|
||||
cat, err := gui.GitCommand.File.Cat(item.Name)
|
||||
cat, err := gui.Git.File.Cat(item.Name)
|
||||
if err != nil {
|
||||
gui.Log.Error(err)
|
||||
return "", err
|
||||
@ -263,7 +263,7 @@ func (gui *Gui) handleCompleteMerge() error {
|
||||
}
|
||||
// if we got conflicts after unstashing, we don't want to call any git
|
||||
// commands to continue rebasing/merging here
|
||||
if gui.GitCommand.Status.WorkingTreeState() == enums.REBASE_MODE_NONE {
|
||||
if gui.Git.Status.WorkingTreeState() == enums.REBASE_MODE_NONE {
|
||||
return gui.handleEscapeMerge()
|
||||
}
|
||||
// if there are no more files with merge conflicts, we should ask whether the user wants to continue
|
||||
|
@ -26,7 +26,7 @@ func (gui *Gui) modeStatuses() []modeStatus {
|
||||
reset: gui.exitDiffMode,
|
||||
},
|
||||
{
|
||||
isActive: gui.GitCommand.Patch.PatchManager.Active,
|
||||
isActive: gui.Git.Patch.PatchManager.Active,
|
||||
description: func() string {
|
||||
return style.FgYellow.SetBold().Sprintf(
|
||||
"%s %s",
|
||||
@ -61,10 +61,10 @@ func (gui *Gui) modeStatuses() []modeStatus {
|
||||
},
|
||||
{
|
||||
isActive: func() bool {
|
||||
return gui.GitCommand.Status.WorkingTreeState() != enums.REBASE_MODE_NONE
|
||||
return gui.Git.Status.WorkingTreeState() != enums.REBASE_MODE_NONE
|
||||
},
|
||||
description: func() string {
|
||||
workingTreeState := gui.GitCommand.Status.WorkingTreeState()
|
||||
workingTreeState := gui.Git.Status.WorkingTreeState()
|
||||
return style.FgYellow.Sprintf(
|
||||
"%s %s",
|
||||
workingTreeState,
|
||||
|
@ -18,7 +18,7 @@ func (gui *Gui) getFromAndReverseArgsForDiff(to string) (string, bool) {
|
||||
}
|
||||
|
||||
func (gui *Gui) refreshPatchBuildingPanel(selectedLineIdx int, state *LblPanelState) error {
|
||||
if !gui.GitCommand.Patch.PatchManager.Active() {
|
||||
if !gui.Git.Patch.PatchManager.Active() {
|
||||
return gui.handleEscapePatchBuildingPanel()
|
||||
}
|
||||
|
||||
@ -33,12 +33,12 @@ func (gui *Gui) refreshPatchBuildingPanel(selectedLineIdx int, state *LblPanelSt
|
||||
|
||||
to := gui.State.CommitFileManager.GetParent()
|
||||
from, reverse := gui.getFromAndReverseArgsForDiff(to)
|
||||
diff, err := gui.GitCommand.WorkingTree.ShowFileDiff(from, to, reverse, node.GetPath(), true)
|
||||
diff, err := gui.Git.WorkingTree.ShowFileDiff(from, to, reverse, node.GetPath(), true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
secondaryDiff := gui.GitCommand.Patch.PatchManager.RenderPatchForFile(node.GetPath(), true, false, true)
|
||||
secondaryDiff := gui.Git.Patch.PatchManager.RenderPatchForFile(node.GetPath(), true, false, true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -64,15 +64,15 @@ func (gui *Gui) handleRefreshPatchBuildingPanel(selectedLineIdx int) error {
|
||||
|
||||
func (gui *Gui) handleToggleSelectionForPatch() error {
|
||||
err := gui.withLBLActiveCheck(func(state *LblPanelState) error {
|
||||
toggleFunc := gui.GitCommand.Patch.PatchManager.AddFileLineRange
|
||||
toggleFunc := gui.Git.Patch.PatchManager.AddFileLineRange
|
||||
filename := gui.getSelectedCommitFileName()
|
||||
includedLineIndices, err := gui.GitCommand.Patch.PatchManager.GetFileIncLineIndices(filename)
|
||||
includedLineIndices, err := gui.Git.Patch.PatchManager.GetFileIncLineIndices(filename)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
currentLineIsStaged := utils.IncludesInt(includedLineIndices, state.GetSelectedLineIdx())
|
||||
if currentLineIsStaged {
|
||||
toggleFunc = gui.GitCommand.Patch.PatchManager.RemoveFileLineRange
|
||||
toggleFunc = gui.Git.Patch.PatchManager.RemoveFileLineRange
|
||||
}
|
||||
|
||||
// add range of lines to those set for the file
|
||||
@ -105,8 +105,8 @@ func (gui *Gui) handleToggleSelectionForPatch() error {
|
||||
func (gui *Gui) handleEscapePatchBuildingPanel() error {
|
||||
gui.escapeLineByLinePanel()
|
||||
|
||||
if gui.GitCommand.Patch.PatchManager.IsEmpty() {
|
||||
gui.GitCommand.Patch.PatchManager.Reset()
|
||||
if gui.Git.Patch.PatchManager.IsEmpty() {
|
||||
gui.Git.Patch.PatchManager.Reset()
|
||||
}
|
||||
|
||||
if gui.currentContext().GetKey() == gui.State.Contexts.PatchBuilding.GetKey() {
|
||||
@ -118,8 +118,8 @@ func (gui *Gui) handleEscapePatchBuildingPanel() error {
|
||||
}
|
||||
|
||||
func (gui *Gui) secondaryPatchPanelUpdateOpts() *viewUpdateOpts {
|
||||
if gui.GitCommand.Patch.PatchManager.Active() {
|
||||
patch := gui.GitCommand.Patch.PatchManager.RenderAggregatedPatchColored(false)
|
||||
if gui.Git.Patch.PatchManager.Active() {
|
||||
patch := gui.Git.Patch.PatchManager.RenderAggregatedPatchColored(false)
|
||||
|
||||
return &viewUpdateOpts{
|
||||
title: "Custom Patch",
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
)
|
||||
|
||||
func (gui *Gui) handleCreatePatchOptionsMenu() error {
|
||||
if !gui.GitCommand.Patch.PatchManager.Active() {
|
||||
if !gui.Git.Patch.PatchManager.Active() {
|
||||
return gui.createErrorPanel(gui.Tr.NoPatchError)
|
||||
}
|
||||
|
||||
@ -26,10 +26,10 @@ func (gui *Gui) handleCreatePatchOptionsMenu() error {
|
||||
},
|
||||
}
|
||||
|
||||
if gui.GitCommand.Patch.PatchManager.CanRebase && gui.GitCommand.Status.WorkingTreeState() == enums.REBASE_MODE_NONE {
|
||||
if gui.Git.Patch.PatchManager.CanRebase && gui.Git.Status.WorkingTreeState() == enums.REBASE_MODE_NONE {
|
||||
menuItems = append(menuItems, []*menuItem{
|
||||
{
|
||||
displayString: fmt.Sprintf("remove patch from original commit (%s)", gui.GitCommand.Patch.PatchManager.To),
|
||||
displayString: fmt.Sprintf("remove patch from original commit (%s)", gui.Git.Patch.PatchManager.To),
|
||||
onPress: gui.handleDeletePatchFromCommit,
|
||||
},
|
||||
{
|
||||
@ -44,7 +44,7 @@ func (gui *Gui) handleCreatePatchOptionsMenu() error {
|
||||
|
||||
if gui.currentContext().GetKey() == gui.State.Contexts.BranchCommits.GetKey() {
|
||||
selectedCommit := gui.getSelectedLocalCommit()
|
||||
if selectedCommit != nil && gui.GitCommand.Patch.PatchManager.To != selectedCommit.Sha {
|
||||
if selectedCommit != nil && gui.Git.Patch.PatchManager.To != selectedCommit.Sha {
|
||||
// adding this option to index 1
|
||||
menuItems = append(
|
||||
menuItems[:1],
|
||||
@ -66,7 +66,7 @@ func (gui *Gui) handleCreatePatchOptionsMenu() error {
|
||||
|
||||
func (gui *Gui) getPatchCommitIndex() int {
|
||||
for index, commit := range gui.State.Commits {
|
||||
if commit.Sha == gui.GitCommand.Patch.PatchManager.To {
|
||||
if commit.Sha == gui.Git.Patch.PatchManager.To {
|
||||
return index
|
||||
}
|
||||
}
|
||||
@ -74,7 +74,7 @@ func (gui *Gui) getPatchCommitIndex() int {
|
||||
}
|
||||
|
||||
func (gui *Gui) validateNormalWorkingTreeState() (bool, error) {
|
||||
if gui.GitCommand.Status.WorkingTreeState() != enums.REBASE_MODE_NONE {
|
||||
if gui.Git.Status.WorkingTreeState() != enums.REBASE_MODE_NONE {
|
||||
return false, gui.createErrorPanel(gui.Tr.CantPatchWhileRebasingError)
|
||||
}
|
||||
return true, nil
|
||||
@ -99,7 +99,7 @@ func (gui *Gui) handleDeletePatchFromCommit() error {
|
||||
return gui.WithWaitingStatus(gui.Tr.RebasingStatus, func() error {
|
||||
commitIndex := gui.getPatchCommitIndex()
|
||||
gui.logAction(gui.Tr.Actions.RemovePatchFromCommit)
|
||||
err := gui.GitCommand.Patch.DeletePatchesFromCommit(gui.State.Commits, commitIndex)
|
||||
err := gui.Git.Patch.DeletePatchesFromCommit(gui.State.Commits, commitIndex)
|
||||
return gui.handleGenericMergeCommandResult(err)
|
||||
})
|
||||
}
|
||||
@ -116,7 +116,7 @@ func (gui *Gui) handleMovePatchToSelectedCommit() error {
|
||||
return gui.WithWaitingStatus(gui.Tr.RebasingStatus, func() error {
|
||||
commitIndex := gui.getPatchCommitIndex()
|
||||
gui.logAction(gui.Tr.Actions.MovePatchToSelectedCommit)
|
||||
err := gui.GitCommand.Patch.MovePatchToSelectedCommit(gui.State.Commits, commitIndex, gui.State.Panels.Commits.SelectedLineIdx)
|
||||
err := gui.Git.Patch.MovePatchToSelectedCommit(gui.State.Commits, commitIndex, gui.State.Panels.Commits.SelectedLineIdx)
|
||||
return gui.handleGenericMergeCommandResult(err)
|
||||
})
|
||||
}
|
||||
@ -134,7 +134,7 @@ func (gui *Gui) handleMovePatchIntoWorkingTree() error {
|
||||
return gui.WithWaitingStatus(gui.Tr.RebasingStatus, func() error {
|
||||
commitIndex := gui.getPatchCommitIndex()
|
||||
gui.logAction(gui.Tr.Actions.MovePatchIntoIndex)
|
||||
err := gui.GitCommand.Patch.MovePatchIntoIndex(gui.State.Commits, commitIndex, stash)
|
||||
err := gui.Git.Patch.MovePatchIntoIndex(gui.State.Commits, commitIndex, stash)
|
||||
return gui.handleGenericMergeCommandResult(err)
|
||||
})
|
||||
}
|
||||
@ -164,7 +164,7 @@ func (gui *Gui) handlePullPatchIntoNewCommit() error {
|
||||
return gui.WithWaitingStatus(gui.Tr.RebasingStatus, func() error {
|
||||
commitIndex := gui.getPatchCommitIndex()
|
||||
gui.logAction(gui.Tr.Actions.MovePatchIntoNewCommit)
|
||||
err := gui.GitCommand.Patch.PullPatchIntoNewCommit(gui.State.Commits, commitIndex)
|
||||
err := gui.Git.Patch.PullPatchIntoNewCommit(gui.State.Commits, commitIndex)
|
||||
return gui.handleGenericMergeCommandResult(err)
|
||||
})
|
||||
}
|
||||
@ -179,14 +179,14 @@ func (gui *Gui) handleApplyPatch(reverse bool) error {
|
||||
action = "Apply patch in reverse"
|
||||
}
|
||||
gui.logAction(action)
|
||||
if err := gui.GitCommand.Patch.PatchManager.ApplyPatches(reverse); err != nil {
|
||||
if err := gui.Git.Patch.PatchManager.ApplyPatches(reverse); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
return gui.refreshSidePanels(refreshOptions{mode: ASYNC})
|
||||
}
|
||||
|
||||
func (gui *Gui) handleResetPatch() error {
|
||||
gui.GitCommand.Patch.PatchManager.Reset()
|
||||
gui.Git.Patch.PatchManager.Reset()
|
||||
if gui.currentContextKeyIgnoringPopups() == MAIN_PATCH_BUILDING_CONTEXT_KEY {
|
||||
if err := gui.pushContext(gui.State.Contexts.CommitFiles); err != nil {
|
||||
return err
|
||||
|
@ -41,7 +41,7 @@ func (gui *Gui) onResize() error {
|
||||
// command.
|
||||
func (gui *Gui) newPtyTask(view *gocui.View, cmd *exec.Cmd, prefix string) error {
|
||||
width, _ := gui.Views.Main.Size()
|
||||
pager := gui.GitCommand.Config.GetPager(width)
|
||||
pager := gui.Git.Config.GetPager(width)
|
||||
|
||||
if pager == "" {
|
||||
// if we're not using a custom pager we don't need to use a pty
|
||||
|
@ -71,7 +71,7 @@ func (gui *Gui) createPullRequest(from string, to string) error {
|
||||
}
|
||||
|
||||
func (gui *Gui) getHostingServiceMgr() *hosting_service.HostingServiceMgr {
|
||||
remoteUrl := gui.GitCommand.Config.GetRemoteURL()
|
||||
remoteUrl := gui.Git.Config.GetRemoteURL()
|
||||
configServices := gui.UserConfig.Services
|
||||
return hosting_service.NewHostingServiceMgr(gui.Log, gui.Tr, remoteUrl, configServices)
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ const (
|
||||
func (gui *Gui) handleCreateRebaseOptionsMenu() error {
|
||||
options := []string{REBASE_OPTION_CONTINUE, REBASE_OPTION_ABORT}
|
||||
|
||||
if gui.GitCommand.Status.WorkingTreeState() == enums.REBASE_MODE_REBASING {
|
||||
if gui.Git.Status.WorkingTreeState() == enums.REBASE_MODE_REBASING {
|
||||
options = append(options, REBASE_OPTION_SKIP)
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ func (gui *Gui) handleCreateRebaseOptionsMenu() error {
|
||||
}
|
||||
|
||||
var title string
|
||||
if gui.GitCommand.Status.WorkingTreeState() == enums.REBASE_MODE_MERGING {
|
||||
if gui.Git.Status.WorkingTreeState() == enums.REBASE_MODE_MERGING {
|
||||
title = gui.Tr.MergeOptionsTitle
|
||||
} else {
|
||||
title = gui.Tr.RebaseOptionsTitle
|
||||
@ -45,7 +45,7 @@ func (gui *Gui) handleCreateRebaseOptionsMenu() error {
|
||||
}
|
||||
|
||||
func (gui *Gui) genericMergeCommand(command string) error {
|
||||
status := gui.GitCommand.Status.WorkingTreeState()
|
||||
status := gui.Git.Status.WorkingTreeState()
|
||||
|
||||
if status != enums.REBASE_MODE_MERGING && status != enums.REBASE_MODE_REBASING {
|
||||
return gui.createErrorPanel(gui.Tr.NotMergingOrRebasing)
|
||||
@ -65,12 +65,12 @@ func (gui *Gui) genericMergeCommand(command string) error {
|
||||
|
||||
// it's impossible for a rebase to require a commit so we'll use a subprocess only if it's a merge
|
||||
if status == enums.REBASE_MODE_MERGING && command != REBASE_OPTION_ABORT && gui.UserConfig.Git.Merging.ManualCommit {
|
||||
// TODO: see if we should be calling more of the code from gui.GitCommand.Rebase.GenericMergeOrRebaseAction
|
||||
// TODO: see if we should be calling more of the code from gui.Git.Rebase.GenericMergeOrRebaseAction
|
||||
return gui.runSubprocessWithSuspenseAndRefresh(
|
||||
gui.GitCommand.Rebase.GenericMergeOrRebaseActionCmdObj(commandType, command),
|
||||
gui.Git.Rebase.GenericMergeOrRebaseActionCmdObj(commandType, command),
|
||||
)
|
||||
}
|
||||
result := gui.GitCommand.Rebase.GenericMergeOrRebaseAction(commandType, command)
|
||||
result := gui.Git.Rebase.GenericMergeOrRebaseAction(commandType, command)
|
||||
if err := gui.handleGenericMergeCommandResult(result); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -141,7 +141,7 @@ func (gui *Gui) abortMergeOrRebaseWithConfirm() error {
|
||||
}
|
||||
|
||||
func (gui *Gui) workingTreeStateNoun() string {
|
||||
workingTreeState := gui.GitCommand.Status.WorkingTreeState()
|
||||
workingTreeState := gui.Git.Status.WorkingTreeState()
|
||||
switch workingTreeState {
|
||||
case enums.REBASE_MODE_NONE:
|
||||
return ""
|
||||
|
@ -38,7 +38,7 @@ func (gui *Gui) handleCreateRecentReposMenu() error {
|
||||
}
|
||||
|
||||
func (gui *Gui) handleShowAllBranchLogs() error {
|
||||
cmdObj := gui.GitCommand.Branch.AllBranchesLogCmdObj()
|
||||
cmdObj := gui.Git.Branch.AllBranchesLogCmdObj()
|
||||
task := NewRunPtyTask(cmdObj.GetCmd())
|
||||
|
||||
return gui.refreshMainViews(refreshMainOpts{
|
||||
@ -75,7 +75,7 @@ func (gui *Gui) dispatchSwitchToRepo(path string, reuse bool) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
gui.GitCommand = newGitCommand
|
||||
gui.Git = newGitCommand
|
||||
|
||||
gui.g.Update(func(*gocui.Gui) error {
|
||||
// these two mutexes are used by our background goroutines (triggered via `gui.goEvery`. We don't want to
|
||||
@ -97,7 +97,7 @@ func (gui *Gui) dispatchSwitchToRepo(path string, reuse bool) error {
|
||||
// updateRecentRepoList registers the fact that we opened lazygit in this repo,
|
||||
// so that we can open the same repo via the 'recent repos' menu
|
||||
func (gui *Gui) updateRecentRepoList() error {
|
||||
if gui.GitCommand.Status.IsBareRepo() {
|
||||
if gui.Git.Status.IsBareRepo() {
|
||||
// we could totally do this but it would require storing both the git-dir and the
|
||||
// worktree in our recent repos list, which is a change that would need to be
|
||||
// backwards compatible
|
||||
|
@ -22,7 +22,7 @@ func (gui *Gui) reflogCommitsRenderToMain() error {
|
||||
if commit == nil {
|
||||
task = NewRenderStringTask("No reflog history")
|
||||
} else {
|
||||
cmdObj := gui.GitCommand.Commit.ShowCmdObj(commit.Sha, gui.State.Modes.Filtering.GetPath())
|
||||
cmdObj := gui.Git.Commit.ShowCmdObj(commit.Sha, gui.State.Modes.Filtering.GetPath())
|
||||
|
||||
task = NewRunPtyTask(cmdObj.GetCmd())
|
||||
}
|
||||
@ -52,7 +52,7 @@ func (gui *Gui) refreshReflogCommits() error {
|
||||
}
|
||||
|
||||
refresh := func(stateCommits *[]*models.Commit, filterPath string) error {
|
||||
commits, onlyObtainedNewReflogCommits, err := gui.GitCommand.Loaders.ReflogCommits.
|
||||
commits, onlyObtainedNewReflogCommits, err := gui.Git.Loaders.ReflogCommits.
|
||||
GetReflogCommits(lastReflogCommit, filterPath)
|
||||
if err != nil {
|
||||
return gui.surfaceError(err)
|
||||
|
@ -24,7 +24,7 @@ func (gui *Gui) remoteBranchesRenderToMain() error {
|
||||
if remoteBranch == nil {
|
||||
task = NewRenderStringTask("No branches for this remote")
|
||||
} else {
|
||||
cmdObj := gui.GitCommand.Branch.GetGraphCmdObj(remoteBranch.FullName())
|
||||
cmdObj := gui.Git.Branch.GetGraphCmdObj(remoteBranch.FullName())
|
||||
task = NewRunCommandTask(cmdObj.GetCmd())
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ func (gui *Gui) handleDeleteRemoteBranch() error {
|
||||
handleConfirm: func() error {
|
||||
return gui.WithWaitingStatus(gui.Tr.DeletingStatus, func() error {
|
||||
gui.logAction(gui.Tr.Actions.DeleteRemoteBranch)
|
||||
err := gui.GitCommand.Remote.DeleteRemoteBranch(remoteBranch.RemoteName, remoteBranch.Name)
|
||||
err := gui.Git.Remote.DeleteRemoteBranch(remoteBranch.RemoteName, remoteBranch.Name)
|
||||
gui.handleCredentialsPopup(err)
|
||||
|
||||
return gui.refreshSidePanels(refreshOptions{scope: []RefreshableView{BRANCHES, REMOTES}})
|
||||
@ -89,7 +89,7 @@ func (gui *Gui) handleSetBranchUpstream() error {
|
||||
prompt: message,
|
||||
handleConfirm: func() error {
|
||||
gui.logAction(gui.Tr.Actions.SetBranchUpstream)
|
||||
if err := gui.GitCommand.Branch.SetUpstream(selectedBranch.RemoteName, selectedBranch.Name, checkedOutBranch.Name); err != nil {
|
||||
if err := gui.Git.Branch.SetUpstream(selectedBranch.RemoteName, selectedBranch.Name, checkedOutBranch.Name); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ func (gui *Gui) remotesRenderToMain() error {
|
||||
func (gui *Gui) refreshRemotes() error {
|
||||
prevSelectedRemote := gui.getSelectedRemote()
|
||||
|
||||
remotes, err := gui.GitCommand.Loaders.Remotes.GetRemotes()
|
||||
remotes, err := gui.Git.Loaders.Remotes.GetRemotes()
|
||||
if err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
@ -86,7 +86,7 @@ func (gui *Gui) handleAddRemote() error {
|
||||
title: gui.Tr.LcNewRemoteUrl,
|
||||
handleConfirm: func(remoteUrl string) error {
|
||||
gui.logAction(gui.Tr.Actions.AddRemote)
|
||||
if err := gui.GitCommand.Remote.AddRemote(remoteName, remoteUrl); err != nil {
|
||||
if err := gui.Git.Remote.AddRemote(remoteName, remoteUrl); err != nil {
|
||||
return err
|
||||
}
|
||||
return gui.refreshSidePanels(refreshOptions{scope: []RefreshableView{REMOTES}})
|
||||
@ -108,7 +108,7 @@ func (gui *Gui) handleRemoveRemote() error {
|
||||
prompt: gui.Tr.LcRemoveRemotePrompt + " '" + remote.Name + "'?",
|
||||
handleConfirm: func() error {
|
||||
gui.logAction(gui.Tr.Actions.RemoveRemote)
|
||||
if err := gui.GitCommand.Remote.RemoveRemote(remote.Name); err != nil {
|
||||
if err := gui.Git.Remote.RemoveRemote(remote.Name); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ func (gui *Gui) handleEditRemote() error {
|
||||
handleConfirm: func(updatedRemoteName string) error {
|
||||
if updatedRemoteName != remote.Name {
|
||||
gui.logAction(gui.Tr.Actions.UpdateRemote)
|
||||
if err := gui.GitCommand.Remote.RenameRemote(remote.Name, updatedRemoteName); err != nil {
|
||||
if err := gui.Git.Remote.RenameRemote(remote.Name, updatedRemoteName); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
}
|
||||
@ -159,7 +159,7 @@ func (gui *Gui) handleEditRemote() error {
|
||||
initialContent: url,
|
||||
handleConfirm: func(updatedRemoteUrl string) error {
|
||||
gui.logAction(gui.Tr.Actions.UpdateRemote)
|
||||
if err := gui.GitCommand.Remote.UpdateRemoteUrl(updatedRemoteName, updatedRemoteUrl); err != nil {
|
||||
if err := gui.Git.Remote.UpdateRemoteUrl(updatedRemoteName, updatedRemoteUrl); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
return gui.refreshSidePanels(refreshOptions{scope: []RefreshableView{BRANCHES, REMOTES}})
|
||||
@ -179,7 +179,7 @@ func (gui *Gui) handleFetchRemote() error {
|
||||
gui.Mutexes.FetchMutex.Lock()
|
||||
defer gui.Mutexes.FetchMutex.Unlock()
|
||||
|
||||
err := gui.GitCommand.Sync.FetchRemote(remote.Name)
|
||||
err := gui.Git.Sync.FetchRemote(remote.Name)
|
||||
gui.handleCredentialsPopup(err)
|
||||
|
||||
return gui.refreshSidePanels(refreshOptions{scope: []RefreshableView{BRANCHES, REMOTES}})
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
)
|
||||
|
||||
func (gui *Gui) resetToRef(ref string, strength string, envVars []string) error {
|
||||
if err := gui.GitCommand.Commit.ResetToCommit(ref, strength, envVars); err != nil {
|
||||
if err := gui.Git.Commit.ResetToCommit(ref, strength, envVars); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
||||
|
@ -34,8 +34,8 @@ func (gui *Gui) refreshStagingPanel(forceSecondaryFocused bool, selectedLineIdx
|
||||
}
|
||||
|
||||
// note for custom diffs, we'll need to send a flag here saying not to use the custom diff
|
||||
diff := gui.GitCommand.WorkingTree.WorktreeFileDiff(file, true, secondaryFocused, false)
|
||||
secondaryDiff := gui.GitCommand.WorkingTree.WorktreeFileDiff(file, true, !secondaryFocused, false)
|
||||
diff := gui.Git.WorkingTree.WorktreeFileDiff(file, true, secondaryFocused, false)
|
||||
secondaryDiff := gui.Git.WorkingTree.WorktreeFileDiff(file, true, !secondaryFocused, false)
|
||||
|
||||
// if we have e.g. a deleted file with nothing else to the diff will have only
|
||||
// 4-5 lines in which case we'll swap panels
|
||||
@ -144,7 +144,7 @@ func (gui *Gui) applySelection(reverse bool, state *LblPanelState) error {
|
||||
applyFlags = append(applyFlags, "cached")
|
||||
}
|
||||
gui.logAction(gui.Tr.Actions.ApplyPatch)
|
||||
err := gui.GitCommand.WorkingTree.ApplyPatch(patch, applyFlags...)
|
||||
err := gui.Git.WorkingTree.ApplyPatch(patch, applyFlags...)
|
||||
if err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ func (gui *Gui) stashRenderToMain() error {
|
||||
if stashEntry == nil {
|
||||
task = NewRenderStringTask(gui.Tr.NoStashEntries)
|
||||
} else {
|
||||
task = NewRunPtyTask(gui.GitCommand.Stash.ShowStashEntryCmdObj(stashEntry.Index).GetCmd())
|
||||
task = NewRunPtyTask(gui.Git.Stash.ShowStashEntryCmdObj(stashEntry.Index).GetCmd())
|
||||
}
|
||||
|
||||
return gui.refreshMainViews(refreshMainOpts{
|
||||
@ -33,7 +33,7 @@ func (gui *Gui) stashRenderToMain() error {
|
||||
}
|
||||
|
||||
func (gui *Gui) refreshStashEntries() error {
|
||||
gui.State.StashEntries = gui.GitCommand.Loaders.Stash.
|
||||
gui.State.StashEntries = gui.Git.Loaders.Stash.
|
||||
GetStashEntries(gui.State.Modes.Filtering.GetPath())
|
||||
|
||||
return gui.State.Contexts.Stash.HandleRender()
|
||||
@ -51,7 +51,7 @@ func (gui *Gui) handleStashApply() error {
|
||||
|
||||
apply := func() error {
|
||||
gui.logAction(gui.Tr.Actions.Stash)
|
||||
if err := gui.GitCommand.Stash.Apply(stashEntry.Index); err != nil {
|
||||
if err := gui.Git.Stash.Apply(stashEntry.Index); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
return gui.postStashRefresh()
|
||||
@ -80,7 +80,7 @@ func (gui *Gui) handleStashPop() error {
|
||||
|
||||
pop := func() error {
|
||||
gui.logAction(gui.Tr.Actions.Stash)
|
||||
if err := gui.GitCommand.Stash.Pop(stashEntry.Index); err != nil {
|
||||
if err := gui.Git.Stash.Pop(stashEntry.Index); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
return gui.postStashRefresh()
|
||||
@ -110,7 +110,7 @@ func (gui *Gui) handleStashDrop() error {
|
||||
prompt: gui.Tr.SureDropStashEntry,
|
||||
handleConfirm: func() error {
|
||||
gui.logAction(gui.Tr.Actions.Stash)
|
||||
if err := gui.GitCommand.Stash.Drop(stashEntry.Index); err != nil {
|
||||
if err := gui.Git.Stash.Drop(stashEntry.Index); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
return gui.postStashRefresh()
|
||||
|
@ -28,8 +28,8 @@ func (gui *Gui) refreshStatus() {
|
||||
status += presentation.ColoredBranchStatus(currentBranch) + " "
|
||||
}
|
||||
|
||||
if gui.GitCommand.Status.WorkingTreeState() != enums.REBASE_MODE_NONE {
|
||||
status += style.FgYellow.Sprintf("(%s) ", gui.GitCommand.Status.WorkingTreeState())
|
||||
if gui.Git.Status.WorkingTreeState() != enums.REBASE_MODE_NONE {
|
||||
status += style.FgYellow.Sprintf("(%s) ", gui.Git.Status.WorkingTreeState())
|
||||
}
|
||||
|
||||
name := presentation.GetBranchTextStyle(currentBranch.Name).Sprint(currentBranch.Name)
|
||||
@ -71,7 +71,7 @@ func (gui *Gui) handleStatusClick() error {
|
||||
cx, _ := gui.Views.Status.Cursor()
|
||||
upstreamStatus := presentation.BranchStatus(currentBranch)
|
||||
repoName := utils.GetCurrentRepoName()
|
||||
workingTreeState := gui.GitCommand.Status.WorkingTreeState()
|
||||
workingTreeState := gui.Git.Status.WorkingTreeState()
|
||||
switch workingTreeState {
|
||||
case enums.REBASE_MODE_REBASING, enums.REBASE_MODE_MERGING:
|
||||
var formattedState string
|
||||
|
@ -23,7 +23,7 @@ func (gui *Gui) subCommitsRenderToMain() error {
|
||||
if commit == nil {
|
||||
task = NewRenderStringTask("No commits")
|
||||
} else {
|
||||
cmdObj := gui.GitCommand.Commit.ShowCmdObj(commit.Sha, gui.State.Modes.Filtering.GetPath())
|
||||
cmdObj := gui.Git.Commit.ShowCmdObj(commit.Sha, gui.State.Modes.Filtering.GetPath())
|
||||
|
||||
task = NewRunPtyTask(cmdObj.GetCmd())
|
||||
}
|
||||
@ -76,7 +76,7 @@ func (gui *Gui) handleViewSubCommitFiles() error {
|
||||
|
||||
func (gui *Gui) switchToSubCommitsContext(refName string) error {
|
||||
// need to populate my sub commits
|
||||
commits, err := gui.GitCommand.Loaders.Commits.GetCommits(
|
||||
commits, err := gui.Git.Loaders.Commits.GetCommits(
|
||||
loaders.GetCommitsOptions{
|
||||
Limit: gui.State.Panels.Commits.LimitCommits,
|
||||
FilterPath: gui.State.Modes.Filtering.GetPath(),
|
||||
|
@ -36,7 +36,7 @@ func (gui *Gui) submodulesRenderToMain() error {
|
||||
if file == nil {
|
||||
task = NewRenderStringTask(prefix)
|
||||
} else {
|
||||
cmdObj := gui.GitCommand.WorkingTree.WorktreeFileDiffCmdObj(file, false, !file.HasUnstagedChanges && file.HasStagedChanges, gui.State.IgnoreWhitespaceInDiffView)
|
||||
cmdObj := gui.Git.WorkingTree.WorktreeFileDiffCmdObj(file, false, !file.HasUnstagedChanges && file.HasStagedChanges, gui.State.IgnoreWhitespaceInDiffView)
|
||||
task = NewRunCommandTaskWithPrefix(cmdObj.GetCmd(), prefix)
|
||||
}
|
||||
}
|
||||
@ -50,7 +50,7 @@ func (gui *Gui) submodulesRenderToMain() error {
|
||||
}
|
||||
|
||||
func (gui *Gui) refreshStateSubmoduleConfigs() error {
|
||||
configs, err := gui.GitCommand.Submodule.GetConfigs()
|
||||
configs, err := gui.Git.Submodule.GetConfigs()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -80,7 +80,7 @@ func (gui *Gui) removeSubmodule(submodule *models.SubmoduleConfig) error {
|
||||
prompt: fmt.Sprintf(gui.Tr.RemoveSubmodulePrompt, submodule.Name),
|
||||
handleConfirm: func() error {
|
||||
gui.logAction(gui.Tr.Actions.RemoveSubmodule)
|
||||
if err := gui.GitCommand.Submodule.Delete(submodule); err != nil {
|
||||
if err := gui.Git.Submodule.Delete(submodule); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
||||
@ -110,15 +110,15 @@ func (gui *Gui) resetSubmodule(submodule *models.SubmoduleConfig) error {
|
||||
|
||||
file := gui.fileForSubmodule(submodule)
|
||||
if file != nil {
|
||||
if err := gui.GitCommand.WorkingTree.UnStageFile(file.Names(), file.Tracked); err != nil {
|
||||
if err := gui.Git.WorkingTree.UnStageFile(file.Names(), file.Tracked); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
}
|
||||
|
||||
if err := gui.GitCommand.Submodule.Stash(submodule); err != nil {
|
||||
if err := gui.Git.Submodule.Stash(submodule); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
if err := gui.GitCommand.Submodule.Reset(submodule); err != nil {
|
||||
if err := gui.Git.Submodule.Reset(submodule); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ func (gui *Gui) handleAddSubmodule() error {
|
||||
handleConfirm: func(submodulePath string) error {
|
||||
return gui.WithWaitingStatus(gui.Tr.LcAddingSubmoduleStatus, func() error {
|
||||
gui.logAction(gui.Tr.Actions.AddSubmodule)
|
||||
err := gui.GitCommand.Submodule.Add(submoduleName, submodulePath, submoduleUrl)
|
||||
err := gui.Git.Submodule.Add(submoduleName, submodulePath, submoduleUrl)
|
||||
gui.handleCredentialsPopup(err)
|
||||
|
||||
return gui.refreshSidePanels(refreshOptions{scope: []RefreshableView{SUBMODULES}})
|
||||
@ -163,7 +163,7 @@ func (gui *Gui) handleEditSubmoduleUrl(submodule *models.SubmoduleConfig) error
|
||||
handleConfirm: func(newUrl string) error {
|
||||
return gui.WithWaitingStatus(gui.Tr.LcUpdatingSubmoduleUrlStatus, func() error {
|
||||
gui.logAction(gui.Tr.Actions.UpdateSubmoduleUrl)
|
||||
err := gui.GitCommand.Submodule.UpdateUrl(submodule.Name, submodule.Path, newUrl)
|
||||
err := gui.Git.Submodule.UpdateUrl(submodule.Name, submodule.Path, newUrl)
|
||||
gui.handleCredentialsPopup(err)
|
||||
|
||||
return gui.refreshSidePanels(refreshOptions{scope: []RefreshableView{SUBMODULES}})
|
||||
@ -175,7 +175,7 @@ func (gui *Gui) handleEditSubmoduleUrl(submodule *models.SubmoduleConfig) error
|
||||
func (gui *Gui) handleSubmoduleInit(submodule *models.SubmoduleConfig) error {
|
||||
return gui.WithWaitingStatus(gui.Tr.LcInitializingSubmoduleStatus, func() error {
|
||||
gui.logAction(gui.Tr.Actions.InitialiseSubmodule)
|
||||
err := gui.GitCommand.Submodule.Init(submodule.Path)
|
||||
err := gui.Git.Submodule.Init(submodule.Path)
|
||||
gui.handleCredentialsPopup(err)
|
||||
|
||||
return gui.refreshSidePanels(refreshOptions{scope: []RefreshableView{SUBMODULES}})
|
||||
@ -215,11 +215,11 @@ func (gui *Gui) handleResetRemoveSubmodule(submodule *models.SubmoduleConfig) er
|
||||
func (gui *Gui) handleBulkSubmoduleActionsMenu() error {
|
||||
menuItems := []*menuItem{
|
||||
{
|
||||
displayStrings: []string{gui.Tr.LcBulkInitSubmodules, style.FgGreen.Sprint(gui.GitCommand.Submodule.BulkInitCmdObj().ToString())},
|
||||
displayStrings: []string{gui.Tr.LcBulkInitSubmodules, style.FgGreen.Sprint(gui.Git.Submodule.BulkInitCmdObj().ToString())},
|
||||
onPress: func() error {
|
||||
return gui.WithWaitingStatus(gui.Tr.LcRunningCommand, func() error {
|
||||
gui.logAction(gui.Tr.Actions.BulkInitialiseSubmodules)
|
||||
err := gui.GitCommand.Submodule.BulkInitCmdObj().Run()
|
||||
err := gui.Git.Submodule.BulkInitCmdObj().Run()
|
||||
if err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
@ -229,11 +229,11 @@ func (gui *Gui) handleBulkSubmoduleActionsMenu() error {
|
||||
},
|
||||
},
|
||||
{
|
||||
displayStrings: []string{gui.Tr.LcBulkUpdateSubmodules, style.FgYellow.Sprint(gui.GitCommand.Submodule.BulkUpdateCmdObj().ToString())},
|
||||
displayStrings: []string{gui.Tr.LcBulkUpdateSubmodules, style.FgYellow.Sprint(gui.Git.Submodule.BulkUpdateCmdObj().ToString())},
|
||||
onPress: func() error {
|
||||
return gui.WithWaitingStatus(gui.Tr.LcRunningCommand, func() error {
|
||||
gui.logAction(gui.Tr.Actions.BulkUpdateSubmodules)
|
||||
if err := gui.GitCommand.Submodule.BulkUpdateCmdObj().Run(); err != nil {
|
||||
if err := gui.Git.Submodule.BulkUpdateCmdObj().Run(); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
||||
@ -242,11 +242,11 @@ func (gui *Gui) handleBulkSubmoduleActionsMenu() error {
|
||||
},
|
||||
},
|
||||
{
|
||||
displayStrings: []string{gui.Tr.LcSubmoduleStashAndReset, style.FgRed.Sprintf("git stash in each submodule && %s", gui.GitCommand.Submodule.ForceBulkUpdateCmdObj().ToString())},
|
||||
displayStrings: []string{gui.Tr.LcSubmoduleStashAndReset, style.FgRed.Sprintf("git stash in each submodule && %s", gui.Git.Submodule.ForceBulkUpdateCmdObj().ToString())},
|
||||
onPress: func() error {
|
||||
return gui.WithWaitingStatus(gui.Tr.LcRunningCommand, func() error {
|
||||
gui.logAction(gui.Tr.Actions.BulkStashAndResetSubmodules)
|
||||
if err := gui.GitCommand.Submodule.ResetSubmodules(gui.State.Submodules); err != nil {
|
||||
if err := gui.Git.Submodule.ResetSubmodules(gui.State.Submodules); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
||||
@ -255,11 +255,11 @@ func (gui *Gui) handleBulkSubmoduleActionsMenu() error {
|
||||
},
|
||||
},
|
||||
{
|
||||
displayStrings: []string{gui.Tr.LcBulkDeinitSubmodules, style.FgRed.Sprint(gui.GitCommand.Submodule.BulkDeinitCmdObj().ToString())},
|
||||
displayStrings: []string{gui.Tr.LcBulkDeinitSubmodules, style.FgRed.Sprint(gui.Git.Submodule.BulkDeinitCmdObj().ToString())},
|
||||
onPress: func() error {
|
||||
return gui.WithWaitingStatus(gui.Tr.LcRunningCommand, func() error {
|
||||
gui.logAction(gui.Tr.Actions.BulkDeinitialiseSubmodules)
|
||||
if err := gui.GitCommand.Submodule.BulkDeinitCmdObj().Run(); err != nil {
|
||||
if err := gui.Git.Submodule.BulkDeinitCmdObj().Run(); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
||||
@ -275,7 +275,7 @@ func (gui *Gui) handleBulkSubmoduleActionsMenu() error {
|
||||
func (gui *Gui) handleUpdateSubmodule(submodule *models.SubmoduleConfig) error {
|
||||
return gui.WithWaitingStatus(gui.Tr.LcUpdatingSubmoduleStatus, func() error {
|
||||
gui.logAction(gui.Tr.Actions.UpdateSubmodule)
|
||||
err := gui.GitCommand.Submodule.Update(submodule.Path)
|
||||
err := gui.Git.Submodule.Update(submodule.Path)
|
||||
gui.handleCredentialsPopup(err)
|
||||
|
||||
return gui.refreshSidePanels(refreshOptions{scope: []RefreshableView{SUBMODULES}})
|
||||
|
@ -25,7 +25,7 @@ func (gui *Gui) tagsRenderToMain() error {
|
||||
if tag == nil {
|
||||
task = NewRenderStringTask("No tags")
|
||||
} else {
|
||||
cmdObj := gui.GitCommand.Branch.GetGraphCmdObj(tag.Name)
|
||||
cmdObj := gui.Git.Branch.GetGraphCmdObj(tag.Name)
|
||||
task = NewRunCommandTask(cmdObj.GetCmd())
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ func (gui *Gui) tagsRenderToMain() error {
|
||||
|
||||
// this is a controller: it can't access tags directly. Or can it? It should be able to get but not set. But that's exactly what I'm doing here, setting it. but through a mutator which encapsulates the event.
|
||||
func (gui *Gui) refreshTags() error {
|
||||
tags, err := gui.GitCommand.Loaders.Tags.GetTags()
|
||||
tags, err := gui.Git.Loaders.Tags.GetTags()
|
||||
if err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
@ -83,7 +83,7 @@ func (gui *Gui) handleDeleteTag(tag *models.Tag) error {
|
||||
prompt: prompt,
|
||||
handleConfirm: func() error {
|
||||
gui.logAction(gui.Tr.Actions.DeleteTag)
|
||||
if err := gui.GitCommand.Tag.Delete(tag.Name); err != nil {
|
||||
if err := gui.Git.Tag.Delete(tag.Name); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
return gui.refreshSidePanels(refreshOptions{mode: ASYNC, scope: []RefreshableView{COMMITS, TAGS}})
|
||||
@ -106,7 +106,7 @@ func (gui *Gui) handlePushTag(tag *models.Tag) error {
|
||||
handleConfirm: func(response string) error {
|
||||
return gui.WithWaitingStatus(gui.Tr.PushingTagStatus, func() error {
|
||||
gui.logAction(gui.Tr.Actions.PushTag)
|
||||
err := gui.GitCommand.Tag.Push(response, tag.Name)
|
||||
err := gui.Git.Tag.Push(response, tag.Name)
|
||||
gui.handleCredentialsPopup(err)
|
||||
|
||||
return nil
|
||||
|
@ -88,7 +88,7 @@ func (gui *Gui) reflogUndo() error {
|
||||
undoEnvVars := []string{"GIT_REFLOG_ACTION=[lazygit undo]"}
|
||||
undoingStatus := gui.Tr.UndoingStatus
|
||||
|
||||
if gui.GitCommand.Status.WorkingTreeState() == enums.REBASE_MODE_REBASING {
|
||||
if gui.Git.Status.WorkingTreeState() == enums.REBASE_MODE_REBASING {
|
||||
return gui.createErrorPanel(gui.Tr.LcCantUndoWhileRebasing)
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ func (gui *Gui) reflogRedo() error {
|
||||
redoEnvVars := []string{"GIT_REFLOG_ACTION=[lazygit redo]"}
|
||||
redoingStatus := gui.Tr.RedoingStatus
|
||||
|
||||
if gui.GitCommand.Status.WorkingTreeState() == enums.REBASE_MODE_REBASING {
|
||||
if gui.Git.Status.WorkingTreeState() == enums.REBASE_MODE_REBASING {
|
||||
return gui.createErrorPanel(gui.Tr.LcCantRedoWhileRebasing)
|
||||
}
|
||||
|
||||
@ -176,14 +176,14 @@ func (gui *Gui) handleHardResetWithAutoStash(commitSha string, options handleHar
|
||||
prompt: gui.Tr.AutoStashPrompt,
|
||||
handleConfirm: func() error {
|
||||
return gui.WithWaitingStatus(options.WaitingStatus, func() error {
|
||||
if err := gui.GitCommand.Stash.Save(gui.Tr.StashPrefix + commitSha); err != nil {
|
||||
if err := gui.Git.Stash.Save(gui.Tr.StashPrefix + commitSha); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
if err := reset(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err := gui.GitCommand.Stash.Pop(0)
|
||||
err := gui.Git.Stash.Pop(0)
|
||||
if err := gui.refreshSidePanels(refreshOptions{}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ func (gui *Gui) handleCreateResetMenu() error {
|
||||
},
|
||||
onPress: func() error {
|
||||
gui.logAction(gui.Tr.Actions.NukeWorkingTree)
|
||||
if err := gui.GitCommand.WorkingTree.ResetAndClean(); err != nil {
|
||||
if err := gui.Git.WorkingTree.ResetAndClean(); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ func (gui *Gui) handleCreateResetMenu() error {
|
||||
},
|
||||
onPress: func() error {
|
||||
gui.logAction(gui.Tr.Actions.DiscardUnstagedFileChanges)
|
||||
if err := gui.GitCommand.WorkingTree.DiscardAnyUnstagedFileChanges(); err != nil {
|
||||
if err := gui.Git.WorkingTree.DiscardAnyUnstagedFileChanges(); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ func (gui *Gui) handleCreateResetMenu() error {
|
||||
},
|
||||
onPress: func() error {
|
||||
gui.logAction(gui.Tr.Actions.RemoveUntrackedFiles)
|
||||
if err := gui.GitCommand.WorkingTree.RemoveUntrackedFiles(); err != nil {
|
||||
if err := gui.Git.WorkingTree.RemoveUntrackedFiles(); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ func (gui *Gui) handleCreateResetMenu() error {
|
||||
},
|
||||
onPress: func() error {
|
||||
gui.logAction(gui.Tr.Actions.SoftReset)
|
||||
if err := gui.GitCommand.WorkingTree.ResetSoft("HEAD"); err != nil {
|
||||
if err := gui.Git.WorkingTree.ResetSoft("HEAD"); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
||||
@ -78,7 +78,7 @@ func (gui *Gui) handleCreateResetMenu() error {
|
||||
},
|
||||
onPress: func() error {
|
||||
gui.logAction(gui.Tr.Actions.MixedReset)
|
||||
if err := gui.GitCommand.WorkingTree.ResetMixed("HEAD"); err != nil {
|
||||
if err := gui.Git.WorkingTree.ResetMixed("HEAD"); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ func (gui *Gui) handleCreateResetMenu() error {
|
||||
},
|
||||
onPress: func() error {
|
||||
gui.logAction(gui.Tr.Actions.HardReset)
|
||||
if err := gui.GitCommand.WorkingTree.ResetHard("HEAD"); err != nil {
|
||||
if err := gui.Git.WorkingTree.ResetHard("HEAD"); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user