1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-28 16:02:01 +03:00

add commit files controller

This commit is contained in:
Jesse Duffield
2022-02-22 20:13:11 +11:00
parent 85f2319897
commit ecaff7fc6c
13 changed files with 358 additions and 321 deletions

View File

@ -10,6 +10,20 @@ func New() Diffing {
return Diffing{}
}
func (m *Diffing) Active() bool {
return m.Ref != ""
func (self *Diffing) Active() bool {
return self.Ref != ""
}
// GetFromAndReverseArgsForDiff tells us the from and reverse args to be used in a diff command.
// If we're not in diff mode we'll end up with the equivalent of a `git show` i.e `git diff blah^..blah`.
func (self *Diffing) GetFromAndReverseArgsForDiff(to string) (string, bool) {
from := to + "^"
reverse := false
if self.Active() {
reverse = self.Reverse
from = self.Ref
}
return from, reverse
}