From 8af8f7754b027834e39b098df8ecf28e13e082e7 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Mon, 7 Apr 2025 10:44:11 +0200 Subject: [PATCH] Move types/enums/enums.go to working_tree_state.go It looks like enums.go was supposed to be file that collects a bunch of enums, but actually there's only one in there, and since it has methods, it deserves to be in a file of its own, named after the type. --- pkg/commands/git_commands/commit_loader.go | 5 ++--- pkg/commands/git_commands/commit_loader_test.go | 5 ++--- pkg/commands/git_commands/patch.go | 5 ++--- pkg/commands/git_commands/status.go | 10 +++++----- .../enums/enums.go => models/working_tree_state.go} | 2 +- pkg/gui/context/local_commits_context.go | 3 +-- .../controllers/custom_patch_options_menu_action.go | 6 +++--- .../controllers/helpers/merge_and_rebase_helper.go | 11 +++++------ pkg/gui/controllers/helpers/mode_helper.go | 4 ++-- pkg/gui/controllers/helpers/patch_building_helper.go | 4 ++-- pkg/gui/controllers/helpers/refresh_helper.go | 3 +-- pkg/gui/controllers/local_commits_controller.go | 5 ++--- pkg/gui/controllers/status_controller.go | 4 ++-- pkg/gui/controllers/undo_controller.go | 6 +++--- pkg/gui/presentation/status.go | 5 ++--- pkg/gui/types/common.go | 3 +-- 16 files changed, 36 insertions(+), 45 deletions(-) rename pkg/commands/{types/enums/enums.go => models/working_tree_state.go} (98%) diff --git a/pkg/commands/git_commands/commit_loader.go b/pkg/commands/git_commands/commit_loader.go index 08ee08313..fdaf8d9ff 100644 --- a/pkg/commands/git_commands/commit_loader.go +++ b/pkg/commands/git_commands/commit_loader.go @@ -13,7 +13,6 @@ import ( "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/commands/oscommands" - "github.com/jesseduffield/lazygit/pkg/commands/types/enums" "github.com/jesseduffield/lazygit/pkg/common" "github.com/jesseduffield/lazygit/pkg/utils" "github.com/samber/lo" @@ -31,7 +30,7 @@ type CommitLoader struct { *common.Common cmd oscommands.ICmdObjBuilder - getWorkingTreeState func() enums.WorkingTreeState + getWorkingTreeState func() models.WorkingTreeState readFile func(filename string) ([]byte, error) walkFiles func(root string, fn filepath.WalkFunc) error dotGitDir string @@ -42,7 +41,7 @@ type CommitLoader struct { func NewCommitLoader( cmn *common.Common, cmd oscommands.ICmdObjBuilder, - getWorkingTreeState func() enums.WorkingTreeState, + getWorkingTreeState func() models.WorkingTreeState, gitCommon *GitCommon, ) *CommitLoader { return &CommitLoader{ diff --git a/pkg/commands/git_commands/commit_loader_test.go b/pkg/commands/git_commands/commit_loader_test.go index 9aac43d11..0641f2476 100644 --- a/pkg/commands/git_commands/commit_loader_test.go +++ b/pkg/commands/git_commands/commit_loader_test.go @@ -8,7 +8,6 @@ import ( "github.com/go-errors/errors" "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/commands/oscommands" - "github.com/jesseduffield/lazygit/pkg/commands/types/enums" "github.com/jesseduffield/lazygit/pkg/config" "github.com/jesseduffield/lazygit/pkg/utils" "github.com/stefanhaller/git-todo-parser/todo" @@ -304,7 +303,7 @@ func TestGetCommits(t *testing.T) { builder := &CommitLoader{ Common: common, cmd: cmd, - getWorkingTreeState: func() enums.WorkingTreeState { return enums.WORKING_TREE_STATE_NONE }, + getWorkingTreeState: func() models.WorkingTreeState { return models.WORKING_TREE_STATE_NONE }, dotGitDir: ".git", readFile: func(filename string) ([]byte, error) { return []byte(""), nil @@ -487,7 +486,7 @@ func TestCommitLoader_getConflictedCommitImpl(t *testing.T) { builder := &CommitLoader{ Common: common, cmd: oscommands.NewDummyCmdObjBuilder(oscommands.NewFakeRunner(t)), - getWorkingTreeState: func() enums.WorkingTreeState { return enums.WORKING_TREE_STATE_REBASING }, + getWorkingTreeState: func() models.WorkingTreeState { return models.WORKING_TREE_STATE_REBASING }, dotGitDir: ".git", readFile: func(filename string) ([]byte, error) { return []byte(""), nil diff --git a/pkg/commands/git_commands/patch.go b/pkg/commands/git_commands/patch.go index daa1030d4..a76121186 100644 --- a/pkg/commands/git_commands/patch.go +++ b/pkg/commands/git_commands/patch.go @@ -8,7 +8,6 @@ import ( "github.com/jesseduffield/lazygit/pkg/app/daemon" "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/commands/patch" - "github.com/jesseduffield/lazygit/pkg/commands/types/enums" "github.com/stefanhaller/git-todo-parser/todo" ) @@ -229,7 +228,7 @@ func (self *PatchCommands) MovePatchIntoIndex(commits []*models.Commit, commitId } if err := self.ApplyCustomPatch(true, true); err != nil { - if self.status.WorkingTreeState() == enums.WORKING_TREE_STATE_REBASING { + if self.status.WorkingTreeState() == models.WORKING_TREE_STATE_REBASING { _ = self.rebase.AbortRebase() } return err @@ -253,7 +252,7 @@ func (self *PatchCommands) MovePatchIntoIndex(commits []*models.Commit, commitId self.rebase.onSuccessfulContinue = func() error { // add patches to index if err := self.ApplyPatch(patch, ApplyPatchOpts{Index: true, ThreeWay: true}); err != nil { - if self.status.WorkingTreeState() == enums.WORKING_TREE_STATE_REBASING { + if self.status.WorkingTreeState() == models.WORKING_TREE_STATE_REBASING { _ = self.rebase.AbortRebase() } return err diff --git a/pkg/commands/git_commands/status.go b/pkg/commands/git_commands/status.go index ba4fdb679..a0d68e241 100644 --- a/pkg/commands/git_commands/status.go +++ b/pkg/commands/git_commands/status.go @@ -5,7 +5,7 @@ import ( "path/filepath" "strings" - "github.com/jesseduffield/lazygit/pkg/commands/types/enums" + "github.com/jesseduffield/lazygit/pkg/commands/models" ) type StatusCommands struct { @@ -20,16 +20,16 @@ func NewStatusCommands( } } -func (self *StatusCommands) WorkingTreeState() enums.WorkingTreeState { +func (self *StatusCommands) WorkingTreeState() models.WorkingTreeState { isInRebase, _ := self.IsInRebase() if isInRebase { - return enums.WORKING_TREE_STATE_REBASING + return models.WORKING_TREE_STATE_REBASING } merging, _ := self.IsInMergeState() if merging { - return enums.WORKING_TREE_STATE_MERGING + return models.WORKING_TREE_STATE_MERGING } - return enums.WORKING_TREE_STATE_NONE + return models.WORKING_TREE_STATE_NONE } func (self *StatusCommands) IsBareRepo() bool { diff --git a/pkg/commands/types/enums/enums.go b/pkg/commands/models/working_tree_state.go similarity index 98% rename from pkg/commands/types/enums/enums.go rename to pkg/commands/models/working_tree_state.go index 09fb1211a..bb8f6536b 100644 --- a/pkg/commands/types/enums/enums.go +++ b/pkg/commands/models/working_tree_state.go @@ -1,4 +1,4 @@ -package enums +package models import "github.com/jesseduffield/lazygit/pkg/i18n" diff --git a/pkg/gui/context/local_commits_context.go b/pkg/gui/context/local_commits_context.go index 9f6c2f5f1..a286241da 100644 --- a/pkg/gui/context/local_commits_context.go +++ b/pkg/gui/context/local_commits_context.go @@ -7,7 +7,6 @@ import ( "github.com/jesseduffield/gocui" "github.com/jesseduffield/lazygit/pkg/commands/models" - "github.com/jesseduffield/lazygit/pkg/commands/types/enums" "github.com/jesseduffield/lazygit/pkg/gui/presentation" "github.com/jesseduffield/lazygit/pkg/gui/types" "github.com/samber/lo" @@ -41,7 +40,7 @@ func NewLocalCommitsContext(c *ContextCommon) *LocalCommitsContext { } } - showYouAreHereLabel := c.Model().WorkingTreeStateAtLastCommitRefresh == enums.WORKING_TREE_STATE_REBASING + showYouAreHereLabel := c.Model().WorkingTreeStateAtLastCommitRefresh == models.WORKING_TREE_STATE_REBASING hasRebaseUpdateRefsConfig := c.Git().Config.GetRebaseUpdateRefs() return presentation.GetCommitListDisplayStrings( diff --git a/pkg/gui/controllers/custom_patch_options_menu_action.go b/pkg/gui/controllers/custom_patch_options_menu_action.go index 5208cfb15..ca06d5fd2 100644 --- a/pkg/gui/controllers/custom_patch_options_menu_action.go +++ b/pkg/gui/controllers/custom_patch_options_menu_action.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/jesseduffield/gocui" - "github.com/jesseduffield/lazygit/pkg/commands/types/enums" + "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers" "github.com/jesseduffield/lazygit/pkg/gui/types" ) @@ -44,7 +44,7 @@ func (self *CustomPatchOptionsMenuAction) Call() error { }, } - if self.c.Git().Patch.PatchBuilder.CanRebase && self.c.Git().Status.WorkingTreeState() == enums.WORKING_TREE_STATE_NONE { + if self.c.Git().Patch.PatchBuilder.CanRebase && self.c.Git().Status.WorkingTreeState() == models.WORKING_TREE_STATE_NONE { menuItems = append(menuItems, []*types.MenuItem{ { Label: fmt.Sprintf(self.c.Tr.RemovePatchFromOriginalCommit, self.c.Git().Patch.PatchBuilder.To), @@ -115,7 +115,7 @@ func (self *CustomPatchOptionsMenuAction) getPatchCommitIndex() int { } func (self *CustomPatchOptionsMenuAction) validateNormalWorkingTreeState() (bool, error) { - if self.c.Git().Status.WorkingTreeState() != enums.WORKING_TREE_STATE_NONE { + if self.c.Git().Status.WorkingTreeState() != models.WORKING_TREE_STATE_NONE { return false, errors.New(self.c.Tr.CantPatchWhileRebasingError) } return true, nil diff --git a/pkg/gui/controllers/helpers/merge_and_rebase_helper.go b/pkg/gui/controllers/helpers/merge_and_rebase_helper.go index 55a322292..dbb10fac6 100644 --- a/pkg/gui/controllers/helpers/merge_and_rebase_helper.go +++ b/pkg/gui/controllers/helpers/merge_and_rebase_helper.go @@ -10,7 +10,6 @@ import ( "github.com/jesseduffield/gocui" "github.com/jesseduffield/lazygit/pkg/commands/git_commands" "github.com/jesseduffield/lazygit/pkg/commands/models" - "github.com/jesseduffield/lazygit/pkg/commands/types/enums" "github.com/jesseduffield/lazygit/pkg/gui/types" "github.com/jesseduffield/lazygit/pkg/utils" "github.com/samber/lo" @@ -51,7 +50,7 @@ func (self *MergeAndRebaseHelper) CreateRebaseOptionsMenu() error { {option: REBASE_OPTION_ABORT, key: 'a'}, } - if self.c.Git().Status.WorkingTreeState() == enums.WORKING_TREE_STATE_REBASING { + if self.c.Git().Status.WorkingTreeState() == models.WORKING_TREE_STATE_REBASING { options = append(options, optionAndKey{ option: REBASE_OPTION_SKIP, key: 's', }) @@ -78,12 +77,12 @@ func (self *MergeAndRebaseHelper) ContinueRebase() error { func (self *MergeAndRebaseHelper) genericMergeCommand(command string) error { status := self.c.Git().Status.WorkingTreeState() - if status != enums.WORKING_TREE_STATE_MERGING && status != enums.WORKING_TREE_STATE_REBASING { + if status != models.WORKING_TREE_STATE_MERGING && status != models.WORKING_TREE_STATE_REBASING { return errors.New(self.c.Tr.NotMergingOrRebasing) } self.c.LogAction(fmt.Sprintf("Merge/Rebase: %s", command)) - if status == enums.WORKING_TREE_STATE_REBASING { + if status == models.WORKING_TREE_STATE_REBASING { todoFile, err := os.ReadFile( filepath.Join(self.c.Git().RepoPaths.WorktreeGitDirPath(), "rebase-merge/git-rebase-todo"), ) @@ -102,10 +101,10 @@ func (self *MergeAndRebaseHelper) genericMergeCommand(command string) error { // we should end up with a command like 'git merge --continue' // it's impossible for a rebase to require a commit so we'll use a subprocess only if it's a merge - needsSubprocess := (status == enums.WORKING_TREE_STATE_MERGING && command != REBASE_OPTION_ABORT && self.c.UserConfig().Git.Merging.ManualCommit) || + needsSubprocess := (status == models.WORKING_TREE_STATE_MERGING && command != REBASE_OPTION_ABORT && self.c.UserConfig().Git.Merging.ManualCommit) || // but we'll also use a subprocess if we have exec todos; those are likely to be lengthy build // tasks whose output the user will want to see in the terminal - (status == enums.WORKING_TREE_STATE_REBASING && command != REBASE_OPTION_ABORT && self.hasExecTodos()) + (status == models.WORKING_TREE_STATE_REBASING && command != REBASE_OPTION_ABORT && self.hasExecTodos()) if needsSubprocess { // TODO: see if we should be calling more of the code from self.Git.Rebase.GenericMergeOrRebaseAction diff --git a/pkg/gui/controllers/helpers/mode_helper.go b/pkg/gui/controllers/helpers/mode_helper.go index 0c964d2de..b5b3df7ac 100644 --- a/pkg/gui/controllers/helpers/mode_helper.go +++ b/pkg/gui/controllers/helpers/mode_helper.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "github.com/jesseduffield/lazygit/pkg/commands/types/enums" + "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/gui/style" "github.com/jesseduffield/lazygit/pkg/gui/types" "github.com/samber/lo" @@ -115,7 +115,7 @@ func (self *ModeHelper) Statuses() []ModeStatus { }, { IsActive: func() bool { - return !self.suppressRebasingMode && self.c.Git().Status.WorkingTreeState() != enums.WORKING_TREE_STATE_NONE + return !self.suppressRebasingMode && self.c.Git().Status.WorkingTreeState() != models.WORKING_TREE_STATE_NONE }, Description: func() string { workingTreeState := self.c.Git().Status.WorkingTreeState() diff --git a/pkg/gui/controllers/helpers/patch_building_helper.go b/pkg/gui/controllers/helpers/patch_building_helper.go index 2deb19d9c..700cfff6a 100644 --- a/pkg/gui/controllers/helpers/patch_building_helper.go +++ b/pkg/gui/controllers/helpers/patch_building_helper.go @@ -3,8 +3,8 @@ package helpers import ( "errors" + "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/commands/patch" - "github.com/jesseduffield/lazygit/pkg/commands/types/enums" "github.com/jesseduffield/lazygit/pkg/gui/patch_exploring" "github.com/jesseduffield/lazygit/pkg/gui/types" ) @@ -22,7 +22,7 @@ func NewPatchBuildingHelper( } func (self *PatchBuildingHelper) ValidateNormalWorkingTreeState() (bool, error) { - if self.c.Git().Status.WorkingTreeState() != enums.WORKING_TREE_STATE_NONE { + if self.c.Git().Status.WorkingTreeState() != models.WORKING_TREE_STATE_NONE { return false, errors.New(self.c.Tr.CantPatchWhileRebasingError) } return true, nil diff --git a/pkg/gui/controllers/helpers/refresh_helper.go b/pkg/gui/controllers/helpers/refresh_helper.go index 9e6dff1dd..a05860324 100644 --- a/pkg/gui/controllers/helpers/refresh_helper.go +++ b/pkg/gui/controllers/helpers/refresh_helper.go @@ -9,7 +9,6 @@ import ( "github.com/jesseduffield/gocui" "github.com/jesseduffield/lazygit/pkg/commands/git_commands" "github.com/jesseduffield/lazygit/pkg/commands/models" - "github.com/jesseduffield/lazygit/pkg/commands/types/enums" "github.com/jesseduffield/lazygit/pkg/gui/context" "github.com/jesseduffield/lazygit/pkg/gui/filetree" "github.com/jesseduffield/lazygit/pkg/gui/mergeconflicts" @@ -583,7 +582,7 @@ func (self *RefreshHelper) refreshStateFiles() error { } } - if self.c.Git().Status.WorkingTreeState() != enums.WORKING_TREE_STATE_NONE && conflictFileCount == 0 && prevConflictFileCount > 0 { + if self.c.Git().Status.WorkingTreeState() != models.WORKING_TREE_STATE_NONE && conflictFileCount == 0 && prevConflictFileCount > 0 { self.c.OnUIThread(func() error { return self.mergeAndRebaseHelper.PromptToContinueRebase() }) } diff --git a/pkg/gui/controllers/local_commits_controller.go b/pkg/gui/controllers/local_commits_controller.go index 4e7f652e0..7487d3def 100644 --- a/pkg/gui/controllers/local_commits_controller.go +++ b/pkg/gui/controllers/local_commits_controller.go @@ -8,7 +8,6 @@ import ( "github.com/jesseduffield/gocui" "github.com/jesseduffield/lazygit/pkg/commands/git_commands" "github.com/jesseduffield/lazygit/pkg/commands/models" - "github.com/jesseduffield/lazygit/pkg/commands/types/enums" "github.com/jesseduffield/lazygit/pkg/gui/context" "github.com/jesseduffield/lazygit/pkg/gui/context/traits" "github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers" @@ -682,7 +681,7 @@ func (self *LocalCommitsController) rewordEnabled(commit *models.Commit) *types. } func (self *LocalCommitsController) isRebasing() bool { - return self.c.Model().WorkingTreeStateAtLastCommitRefresh != enums.WORKING_TREE_STATE_NONE + return self.c.Model().WorkingTreeStateAtLastCommitRefresh != models.WORKING_TREE_STATE_NONE } func (self *LocalCommitsController) moveDown(selectedCommits []*models.Commit, startIdx int, endIdx int) error { @@ -976,7 +975,7 @@ func (self *LocalCommitsController) moveFixupCommitToOwnerStackedBranch(targetCo return nil } - if self.c.Git().Status.WorkingTreeState() != enums.WORKING_TREE_STATE_NONE { + if self.c.Git().Status.WorkingTreeState() != models.WORKING_TREE_STATE_NONE { // Can't move commits while rebasing return nil } diff --git a/pkg/gui/controllers/status_controller.go b/pkg/gui/controllers/status_controller.go index 31b264e17..73d36c0f7 100644 --- a/pkg/gui/controllers/status_controller.go +++ b/pkg/gui/controllers/status_controller.go @@ -7,7 +7,7 @@ import ( "time" "github.com/jesseduffield/gocui" - "github.com/jesseduffield/lazygit/pkg/commands/types/enums" + "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/constants" "github.com/jesseduffield/lazygit/pkg/gui/presentation" "github.com/jesseduffield/lazygit/pkg/gui/style" @@ -110,7 +110,7 @@ func (self *StatusController) onClick(opts gocui.ViewMouseBindingOpts) error { repoName := self.c.Git().RepoPaths.RepoName() workingTreeState := self.c.Git().Status.WorkingTreeState() switch workingTreeState { - case enums.WORKING_TREE_STATE_REBASING, enums.WORKING_TREE_STATE_MERGING: + case models.WORKING_TREE_STATE_REBASING, models.WORKING_TREE_STATE_MERGING: workingTreeStatus := fmt.Sprintf("(%s)", workingTreeState.LowerCaseTitle(self.c.Tr)) if cursorInSubstring(opts.X, upstreamStatus+" ", workingTreeStatus) { return self.c.Helpers().MergeAndRebase.CreateRebaseOptionsMenu() diff --git a/pkg/gui/controllers/undo_controller.go b/pkg/gui/controllers/undo_controller.go index b00eb802f..1150975bc 100644 --- a/pkg/gui/controllers/undo_controller.go +++ b/pkg/gui/controllers/undo_controller.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/jesseduffield/gocui" - "github.com/jesseduffield/lazygit/pkg/commands/types/enums" + "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/gui/types" "github.com/jesseduffield/lazygit/pkg/utils" ) @@ -78,7 +78,7 @@ func (self *UndoController) reflogUndo() error { undoEnvVars := []string{"GIT_REFLOG_ACTION=[lazygit undo]"} undoingStatus := self.c.Tr.UndoingStatus - if self.c.Git().Status.WorkingTreeState() == enums.WORKING_TREE_STATE_REBASING { + if self.c.Git().Status.WorkingTreeState() == models.WORKING_TREE_STATE_REBASING { return errors.New(self.c.Tr.CantUndoWhileRebasing) } @@ -142,7 +142,7 @@ func (self *UndoController) reflogRedo() error { redoEnvVars := []string{"GIT_REFLOG_ACTION=[lazygit redo]"} redoingStatus := self.c.Tr.RedoingStatus - if self.c.Git().Status.WorkingTreeState() == enums.WORKING_TREE_STATE_REBASING { + if self.c.Git().Status.WorkingTreeState() == models.WORKING_TREE_STATE_REBASING { return errors.New(self.c.Tr.CantRedoWhileRebasing) } diff --git a/pkg/gui/presentation/status.go b/pkg/gui/presentation/status.go index 3c0fe068a..e09aab5f3 100644 --- a/pkg/gui/presentation/status.go +++ b/pkg/gui/presentation/status.go @@ -5,7 +5,6 @@ import ( "time" "github.com/jesseduffield/lazygit/pkg/commands/models" - "github.com/jesseduffield/lazygit/pkg/commands/types/enums" "github.com/jesseduffield/lazygit/pkg/config" "github.com/jesseduffield/lazygit/pkg/gui/presentation/icons" "github.com/jesseduffield/lazygit/pkg/gui/style" @@ -18,7 +17,7 @@ func FormatStatus( currentBranch *models.Branch, itemOperation types.ItemOperation, linkedWorktreeName string, - workingTreeState enums.WorkingTreeState, + workingTreeState models.WorkingTreeState, tr *i18n.TranslationSet, userConfig *config.UserConfig, ) string { @@ -31,7 +30,7 @@ func FormatStatus( } } - if workingTreeState != enums.WORKING_TREE_STATE_NONE { + if workingTreeState != models.WORKING_TREE_STATE_NONE { status += style.FgYellow.Sprintf("(%s) ", workingTreeState.LowerCaseTitle(tr)) } diff --git a/pkg/gui/types/common.go b/pkg/gui/types/common.go index afa0bf2a4..e01c66423 100644 --- a/pkg/gui/types/common.go +++ b/pkg/gui/types/common.go @@ -6,7 +6,6 @@ import ( "github.com/jesseduffield/lazygit/pkg/commands/git_commands" "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/commands/oscommands" - "github.com/jesseduffield/lazygit/pkg/commands/types/enums" "github.com/jesseduffield/lazygit/pkg/common" "github.com/jesseduffield/lazygit/pkg/config" "github.com/jesseduffield/lazygit/pkg/utils" @@ -288,7 +287,7 @@ type Model struct { ReflogCommits []*models.Commit BisectInfo *git_commands.BisectInfo - WorkingTreeStateAtLastCommitRefresh enums.WorkingTreeState + WorkingTreeStateAtLastCommitRefresh models.WorkingTreeState RemoteBranches []*models.RemoteBranch Tags []*models.Tag