summaryrefslogtreecommitdiffstats
path: root/pkg/commands/files.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2021-03-14 18:46:22 +1100
committerJesse Duffield <jessedduffield@gmail.com>2021-03-30 21:57:00 +1100
commit77a7619690ff21bc572470a1573de7f6c212d13b (patch)
treeaeaed221d56eefca152dd191c9b0291cbd09812e /pkg/commands/files.go
parent9f2d7adb8ea8135b402cda8cbb84a97744ec7357 (diff)
showing changes for directories
Diffstat (limited to 'pkg/commands/files.go')
-rw-r--r--pkg/commands/files.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/pkg/commands/files.go b/pkg/commands/files.go
index 55a5f55d3..c73a898b4 100644
--- a/pkg/commands/files.go
+++ b/pkg/commands/files.go
@@ -158,23 +158,22 @@ func (c *GitCommand) WorktreeFileDiff(file *models.File, plain bool, cached bool
return s
}
-func (c *GitCommand) WorktreeFileDiffCmdStr(file *models.File, plain bool, cached bool) string {
+func (c *GitCommand) WorktreeFileDiffCmdStr(node models.IStatusLine, plain bool, cached bool) string {
cachedArg := ""
trackedArg := "--"
colorArg := c.colorArg()
- split := strings.Split(file.Name, models.RENAME_SEPARATOR) // in case of a renamed file we get the new filename
- fileName := c.OSCommand.Quote(split[len(split)-1])
+ path := c.OSCommand.Quote(node.GetPath())
if cached {
cachedArg = "--cached"
}
- if !file.Tracked && !file.HasStagedChanges && !cached {
+ if !node.GetIsTracked() && !node.GetHasStagedChanges() && !cached {
trackedArg = "--no-index -- /dev/null"
}
if plain {
colorArg = "never"
}
- return fmt.Sprintf("git diff --submodule --no-ext-diff --color=%s %s %s %s", colorArg, cachedArg, trackedArg, fileName)
+ return fmt.Sprintf("git diff --submodule --no-ext-diff --color=%s %s %s %s", colorArg, cachedArg, trackedArg, path)
}
func (c *GitCommand) ApplyPatch(patch string, flags ...string) error {