1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-12 23:41:54 +03:00

Merge pull request #172 from jesseduffield/hotfix/167-ambiguous-name-in-diff

167: Support File names that match Branch names
This commit is contained in:
Jesse Duffield
2018-08-19 14:53:14 +10:00
committed by GitHub
11 changed files with 215 additions and 6 deletions

View File

@ -486,15 +486,11 @@ func (c *GitCommand) Diff(file File) string {
// if the file is staged and has spaces in it, it comes pre-quoted
fileName = c.OSCommand.Quote(fileName)
}
deletedArg := ""
if file.Deleted {
deletedArg = "--"
}
trackedArg := ""
trackedArg := "--"
if !file.Tracked && !file.HasStagedChanges {
trackedArg = "--no-index /dev/null"
}
command := fmt.Sprintf("%s %s %s %s %s", "git diff --color ", cachedArg, deletedArg, trackedArg, fileName)
command := fmt.Sprintf("%s %s %s %s", "git diff --color ", cachedArg, trackedArg, fileName)
// for now we assume an error means the file was deleted
s, _ := c.OSCommand.RunCommandWithOutput(command)