diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2021-06-05 15:08:36 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2021-06-06 09:12:49 +1000 |
commit | 93bf691fd66cfd19702db2a674c73fbefc244467 (patch) | |
tree | 095f49a36f863a7559c17cc75c0e43d5216fabe3 /pkg/gui/modes | |
parent | 82022615ddc25ec5bc0631894e32d8dda380eac2 (diff) |
refactoring
Diffstat (limited to 'pkg/gui/modes')
-rw-r--r-- | pkg/gui/modes/cherrypicking/cherry_picking.go | 23 | ||||
-rw-r--r-- | pkg/gui/modes/diffing/diffing.go | 15 | ||||
-rw-r--r-- | pkg/gui/modes/filtering/filtering.go | 2 |
3 files changed, 39 insertions, 1 deletions
diff --git a/pkg/gui/modes/cherrypicking/cherry_picking.go b/pkg/gui/modes/cherrypicking/cherry_picking.go new file mode 100644 index 000000000..705735510 --- /dev/null +++ b/pkg/gui/modes/cherrypicking/cherry_picking.go @@ -0,0 +1,23 @@ +package cherrypicking + +import ( + "github.com/jesseduffield/lazygit/pkg/commands/models" +) + +type CherryPicking struct { + CherryPickedCommits []*models.Commit + + // we only allow cherry picking from one context at a time, so you can't copy a commit from the local commits context and then also copy a commit in the reflog context + ContextKey string +} + +func New() CherryPicking { + return CherryPicking{ + CherryPickedCommits: make([]*models.Commit, 0), + ContextKey: "", + } +} + +func (m *CherryPicking) Active() bool { + return len(m.CherryPickedCommits) > 0 +} diff --git a/pkg/gui/modes/diffing/diffing.go b/pkg/gui/modes/diffing/diffing.go new file mode 100644 index 000000000..a5e103d62 --- /dev/null +++ b/pkg/gui/modes/diffing/diffing.go @@ -0,0 +1,15 @@ +package diffing + +// if ref is blank we're not diffing anything +type Diffing struct { + Ref string + Reverse bool +} + +func New() Diffing { + return Diffing{} +} + +func (m *Diffing) Active() bool { + return m.Ref != "" +} diff --git a/pkg/gui/modes/filtering/filtering.go b/pkg/gui/modes/filtering/filtering.go index 010a04993..ca8026dc0 100644 --- a/pkg/gui/modes/filtering/filtering.go +++ b/pkg/gui/modes/filtering/filtering.go @@ -4,7 +4,7 @@ type Filtering struct { path string // the filename that gets passed to git log } -func NewFiltering(path string) Filtering { +func New(path string) Filtering { return Filtering{path: path} } |