summaryrefslogtreecommitdiffstats
path: root/pkg/gui/modes/diffing
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-02-22 20:13:11 +1100
committerJesse Duffield <jessedduffield@gmail.com>2022-03-17 19:13:40 +1100
commitecaff7fc6cc3d2e510a88e336abcb74567de3f12 (patch)
tree4c896b81f194659708062a9fa5979f54e7a2ed3e /pkg/gui/modes/diffing
parent85f23198971de56195a4a1790d70e9d3b4ea1908 (diff)
add commit files controller
Diffstat (limited to 'pkg/gui/modes/diffing')
-rw-r--r--pkg/gui/modes/diffing/diffing.go18
1 files changed, 16 insertions, 2 deletions
diff --git a/pkg/gui/modes/diffing/diffing.go b/pkg/gui/modes/diffing/diffing.go
index a5e103d62..b27662b72 100644
--- a/pkg/gui/modes/diffing/diffing.go
+++ b/pkg/gui/modes/diffing/diffing.go
@@ -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
}