summaryrefslogtreecommitdiffstats
path: root/pkg/gui
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-09-29 18:34:01 +1000
committerJesse Duffield <jessedduffield@gmail.com>2020-09-29 20:48:49 +1000
commit44248d9ab0818dfca6a5c1f5ee2ad5b0d45d4998 (patch)
tree832829129b6cc3690fc51e2c254d8b71d0de4657 /pkg/gui
parentc87b2c02fa2c82dd07a77335df6c7d2e7817a012 (diff)
pull branch model out into models package
Diffstat (limited to 'pkg/gui')
-rw-r--r--pkg/gui/branches_panel.go9
-rw-r--r--pkg/gui/custom_commands.go5
-rw-r--r--pkg/gui/gui.go3
-rw-r--r--pkg/gui/presentation/branches.go6
4 files changed, 13 insertions, 10 deletions
diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go
index be67def2d..dae81f7fa 100644
--- a/pkg/gui/branches_panel.go
+++ b/pkg/gui/branches_panel.go
@@ -6,11 +6,12 @@ import (
"github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands"
+ "github.com/jesseduffield/lazygit/pkg/models"
)
// list panel functions
-func (gui *Gui) getSelectedBranch() *commands.Branch {
+func (gui *Gui) getSelectedBranch() *models.Branch {
if len(gui.State.Branches) == 0 {
return nil
}
@@ -209,7 +210,7 @@ func (gui *Gui) handleCheckoutByName(g *gocui.Gui, v *gocui.View) error {
})
}
-func (gui *Gui) getCheckedOutBranch() *commands.Branch {
+func (gui *Gui) getCheckedOutBranch() *models.Branch {
if len(gui.State.Branches) == 0 {
return nil
}
@@ -247,7 +248,7 @@ func (gui *Gui) deleteBranch(force bool) error {
return gui.deleteNamedBranch(selectedBranch, force)
}
-func (gui *Gui) deleteNamedBranch(selectedBranch *commands.Branch, force bool) error {
+func (gui *Gui) deleteNamedBranch(selectedBranch *models.Branch, force bool) error {
title := gui.Tr.SLocalize("DeleteBranch")
var messageID string
if force {
@@ -446,7 +447,7 @@ func (gui *Gui) handleRenameBranch(g *gocui.Gui, v *gocui.View) error {
})
}
-func (gui *Gui) currentBranch() *commands.Branch {
+func (gui *Gui) currentBranch() *models.Branch {
if len(gui.State.Branches) == 0 {
return nil
}
diff --git a/pkg/gui/custom_commands.go b/pkg/gui/custom_commands.go
index d13c2d918..847163f81 100644
--- a/pkg/gui/custom_commands.go
+++ b/pkg/gui/custom_commands.go
@@ -9,6 +9,7 @@ import (
"github.com/fatih/color"
"github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands"
+ "github.com/jesseduffield/lazygit/pkg/models"
"github.com/jesseduffield/lazygit/pkg/utils"
)
@@ -17,13 +18,13 @@ type CustomCommandObjects struct {
SelectedReflogCommit *commands.Commit
SelectedSubCommit *commands.Commit
SelectedFile *commands.File
- SelectedLocalBranch *commands.Branch
+ SelectedLocalBranch *models.Branch
SelectedRemoteBranch *commands.RemoteBranch
SelectedRemote *commands.Remote
SelectedTag *commands.Tag
SelectedStashEntry *commands.StashEntry
SelectedCommitFile *commands.CommitFile
- CheckedOutBranch *commands.Branch
+ CheckedOutBranch *models.Branch
PromptResponses []string
}
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go
index d35fe59be..c1d52bee3 100644
--- a/pkg/gui/gui.go
+++ b/pkg/gui/gui.go
@@ -25,6 +25,7 @@ import (
"github.com/jesseduffield/lazygit/pkg/commands/patch"
"github.com/jesseduffield/lazygit/pkg/config"
"github.com/jesseduffield/lazygit/pkg/i18n"
+ "github.com/jesseduffield/lazygit/pkg/models"
"github.com/jesseduffield/lazygit/pkg/tasks"
"github.com/jesseduffield/lazygit/pkg/theme"
"github.com/jesseduffield/lazygit/pkg/updates"
@@ -273,7 +274,7 @@ type Modes struct {
type guiState struct {
Files []*commands.File
SubmoduleConfigs []*commands.SubmoduleConfig
- Branches []*commands.Branch
+ Branches []*models.Branch
Commits []*commands.Commit
StashEntries []*commands.StashEntry
CommitFiles []*commands.CommitFile
diff --git a/pkg/gui/presentation/branches.go b/pkg/gui/presentation/branches.go
index 3e5c2d625..17107698d 100644
--- a/pkg/gui/presentation/branches.go
+++ b/pkg/gui/presentation/branches.go
@@ -5,12 +5,12 @@ import (
"strings"
"github.com/fatih/color"
- "github.com/jesseduffield/lazygit/pkg/commands"
+ "github.com/jesseduffield/lazygit/pkg/models"
"github.com/jesseduffield/lazygit/pkg/theme"
"github.com/jesseduffield/lazygit/pkg/utils"
)
-func GetBranchListDisplayStrings(branches []*commands.Branch, fullDescription bool, diffName string) [][]string {
+func GetBranchListDisplayStrings(branches []*models.Branch, fullDescription bool, diffName string) [][]string {
lines := make([][]string, len(branches))
for i := range branches {
@@ -22,7 +22,7 @@ func GetBranchListDisplayStrings(branches []*commands.Branch, fullDescription bo
}
// getBranchDisplayStrings returns the display string of branch
-func getBranchDisplayStrings(b *commands.Branch, fullDescription bool, diffed bool) []string {
+func getBranchDisplayStrings(b *models.Branch, fullDescription bool, diffed bool) []string {
displayName := b.Name
if b.DisplayName != "" {
displayName = b.DisplayName