mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-12 12:55:47 +02: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:
commit
60fc24eada
11 changed files with 215 additions and 6 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue