summaryrefslogtreecommitdiffstats
path: root/pkg/commands/git_commands/status.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-01-18 21:26:21 +1100
committerJesse Duffield <jessedduffield@gmail.com>2022-01-18 22:01:09 +1100
commit3e80a9e886007e11cc774b74a32959625e102750 (patch)
tree0388789b4929785542afcb9f3a6691db0873180f /pkg/commands/git_commands/status.go
parent9706416a4171b9fce72d404ef38e2988b894c554 (diff)
refactor to group up more commonly used git command stuff
Diffstat (limited to 'pkg/commands/git_commands/status.go')
-rw-r--r--pkg/commands/git_commands/status.go23
1 files changed, 6 insertions, 17 deletions
diff --git a/pkg/commands/git_commands/status.go b/pkg/commands/git_commands/status.go
index fe89646d2..50b1fab57 100644
--- a/pkg/commands/git_commands/status.go
+++ b/pkg/commands/git_commands/status.go
@@ -4,43 +4,32 @@ import (
"path/filepath"
gogit "github.com/jesseduffield/go-git/v5"
- "github.com/jesseduffield/lazygit/pkg/commands/oscommands"
"github.com/jesseduffield/lazygit/pkg/commands/types/enums"
- "github.com/jesseduffield/lazygit/pkg/common"
)
type StatusCommands struct {
- *common.Common
- osCommand *oscommands.OSCommand
- repo *gogit.Repository
- dotGitDir string
+ *GitCommon
}
func NewStatusCommands(
- common *common.Common,
- osCommand *oscommands.OSCommand,
- repo *gogit.Repository,
- dotGitDir string,
+ gitCommon *GitCommon,
) *StatusCommands {
return &StatusCommands{
- Common: common,
- osCommand: osCommand,
- repo: repo,
- dotGitDir: dotGitDir,
+ GitCommon: gitCommon,
}
}
// RebaseMode returns "" for non-rebase mode, "normal" for normal rebase
// and "interactive" for interactive rebase
func (self *StatusCommands) RebaseMode() (enums.RebaseMode, error) {
- exists, err := self.osCommand.FileExists(filepath.Join(self.dotGitDir, "rebase-apply"))
+ exists, err := self.os.FileExists(filepath.Join(self.dotGitDir, "rebase-apply"))
if err != nil {
return enums.REBASE_MODE_NONE, err
}
if exists {
return enums.REBASE_MODE_NORMAL, nil
}
- exists, err = self.osCommand.FileExists(filepath.Join(self.dotGitDir, "rebase-merge"))
+ exists, err = self.os.FileExists(filepath.Join(self.dotGitDir, "rebase-merge"))
if exists {
return enums.REBASE_MODE_INTERACTIVE, err
} else {
@@ -62,7 +51,7 @@ func (self *StatusCommands) WorkingTreeState() enums.RebaseMode {
// IsInMergeState states whether we are still mid-merge
func (self *StatusCommands) IsInMergeState() (bool, error) {
- return self.osCommand.FileExists(filepath.Join(self.dotGitDir, "MERGE_HEAD"))
+ return self.os.FileExists(filepath.Join(self.dotGitDir, "MERGE_HEAD"))
}
func (self *StatusCommands) IsBareRepo() bool {