summaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-08-22 17:26:23 +1000
committerJesse Duffield <jessedduffield@gmail.com>2020-08-23 14:29:18 +1000
commit2eee079d3aafb7914947e85fe5decd528c34ab93 (patch)
tree7570fd5cdfb1aa0a3b4c4d6cbdf4c7f4a9472db0 /pkg
parent30a555b108ddf85d53ea26013e590027660ac5da (diff)
minor rename
Diffstat (limited to 'pkg')
-rw-r--r--pkg/commands/git.go8
-rw-r--r--pkg/commands/git_test.go2
-rw-r--r--pkg/gui/files_panel.go4
-rw-r--r--pkg/gui/staging_panel.go4
4 files changed, 9 insertions, 9 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go
index 3a38bce13..868ca0a50 100644
--- a/pkg/commands/git.go
+++ b/pkg/commands/git.go
@@ -758,14 +758,14 @@ func (c *GitCommand) CheckRemoteBranchExists(branch *Branch) bool {
return err == nil
}
-// Diff returns the diff of a file
-func (c *GitCommand) Diff(file *File, plain bool, cached bool) string {
+// WorktreeFileDiff returns the diff of a file
+func (c *GitCommand) WorktreeFileDiff(file *File, plain bool, cached bool) string {
// for now we assume an error means the file was deleted
- s, _ := c.OSCommand.RunCommandWithOutput(c.DiffCmdStr(file, plain, cached))
+ s, _ := c.OSCommand.RunCommandWithOutput(c.WorktreeFileDiffCmdStr(file, plain, cached))
return s
}
-func (c *GitCommand) DiffCmdStr(file *File, plain bool, cached bool) string {
+func (c *GitCommand) WorktreeFileDiffCmdStr(file *File, plain bool, cached bool) string {
cachedArg := ""
trackedArg := "--"
colorArg := c.colorArg()
diff --git a/pkg/commands/git_test.go b/pkg/commands/git_test.go
index 7a892eec8..a4dbe3bde 100644
--- a/pkg/commands/git_test.go
+++ b/pkg/commands/git_test.go
@@ -1474,7 +1474,7 @@ func TestGitCommandDiff(t *testing.T) {
t.Run(s.testName, func(t *testing.T) {
gitCmd := NewDummyGitCommand()
gitCmd.OSCommand.command = s.command
- gitCmd.Diff(s.file, s.plain, s.cached)
+ gitCmd.WorktreeFileDiff(s.file, s.plain, s.cached)
})
}
}
diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go
index 28c52fcea..1d20f54d9 100644
--- a/pkg/gui/files_panel.go
+++ b/pkg/gui/files_panel.go
@@ -54,7 +54,7 @@ func (gui *Gui) selectFile(alreadySelected bool) error {
return gui.refreshMergePanel()
}
- cmdStr := gui.GitCommand.DiffCmdStr(file, false, !file.HasUnstagedChanges && file.HasStagedChanges)
+ cmdStr := gui.GitCommand.WorktreeFileDiffCmdStr(file, false, !file.HasUnstagedChanges && file.HasStagedChanges)
cmd := gui.OSCommand.ExecutableFromString(cmdStr)
refreshOpts := refreshMainOpts{main: &viewUpdateOpts{
@@ -63,7 +63,7 @@ func (gui *Gui) selectFile(alreadySelected bool) error {
}}
if file.HasStagedChanges && file.HasUnstagedChanges {
- cmdStr := gui.GitCommand.DiffCmdStr(file, false, true)
+ cmdStr := gui.GitCommand.WorktreeFileDiffCmdStr(file, false, true)
cmd := gui.OSCommand.ExecutableFromString(cmdStr)
refreshOpts.secondary = &viewUpdateOpts{
diff --git a/pkg/gui/staging_panel.go b/pkg/gui/staging_panel.go
index 4c8cb3571..97bd84fbb 100644
--- a/pkg/gui/staging_panel.go
+++ b/pkg/gui/staging_panel.go
@@ -43,8 +43,8 @@ func (gui *Gui) refreshStagingPanel(forceSecondaryFocused bool, selectedLineIdx
}
// note for custom diffs, we'll need to send a flag here saying not to use the custom diff
- diff := gui.GitCommand.Diff(file, true, secondaryFocused)
- secondaryDiff := gui.GitCommand.Diff(file, true, !secondaryFocused)
+ diff := gui.GitCommand.WorktreeFileDiff(file, true, secondaryFocused)
+ secondaryDiff := gui.GitCommand.WorktreeFileDiff(file, true, !secondaryFocused)
// if we have e.g. a deleted file with nothing else to the diff will have only
// 4-5 lines in which case we'll swap panels