1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

showing changes for directories

This commit is contained in:
Jesse Duffield
2021-03-14 18:46:22 +11:00
parent 9f2d7adb8e
commit 77a7619690
6 changed files with 64 additions and 24 deletions

View File

@ -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 {