1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-11-30 09:16:47 +02:00

support filenames that match branchnames

This commit is contained in:
Jesse Duffield 2018-08-17 22:25:53 +10:00
parent aaa8558de8
commit 03a7e32694

View File

@ -481,15 +481,11 @@ func (c *GitCommand) Diff(file File) string {
// if the file is staged and has spaces in it, it comes pre-quoted // if the file is staged and has spaces in it, it comes pre-quoted
fileName = c.OSCommand.Quote(fileName) fileName = c.OSCommand.Quote(fileName)
} }
deletedArg := "" trackedArg := "--"
if file.Deleted {
deletedArg = "--"
}
trackedArg := ""
if !file.Tracked && !file.HasStagedChanges { if !file.Tracked && !file.HasStagedChanges {
trackedArg = "--no-index /dev/null" 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 // for now we assume an error means the file was deleted
s, _ := c.OSCommand.RunCommandWithOutput(command) s, _ := c.OSCommand.RunCommandWithOutput(command)