mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-28 16:02:01 +03:00
fix: fix diff of renamed files
This commit is contained in:
committed by
Jesse Duffield
parent
954d1a8147
commit
53257db99d
@ -230,6 +230,7 @@ func (self *WorkingTreeCommands) WorktreeFileDiffCmdObj(node models.IFile, plain
|
|||||||
trackedArg := "--"
|
trackedArg := "--"
|
||||||
colorArg := self.UserConfig.Git.Paging.ColorArg
|
colorArg := self.UserConfig.Git.Paging.ColorArg
|
||||||
quotedPath := self.cmd.Quote(node.GetPath())
|
quotedPath := self.cmd.Quote(node.GetPath())
|
||||||
|
quotedPrevPath := ""
|
||||||
ignoreWhitespaceArg := ""
|
ignoreWhitespaceArg := ""
|
||||||
contextSize := self.UserConfig.Git.DiffContextSize
|
contextSize := self.UserConfig.Git.DiffContextSize
|
||||||
if cached {
|
if cached {
|
||||||
@ -244,8 +245,11 @@ func (self *WorkingTreeCommands) WorktreeFileDiffCmdObj(node models.IFile, plain
|
|||||||
if ignoreWhitespace {
|
if ignoreWhitespace {
|
||||||
ignoreWhitespaceArg = " --ignore-all-space"
|
ignoreWhitespaceArg = " --ignore-all-space"
|
||||||
}
|
}
|
||||||
|
if prevPath := node.GetPreviousPath(); prevPath != "" {
|
||||||
|
quotedPrevPath = " " + self.cmd.Quote(prevPath)
|
||||||
|
}
|
||||||
|
|
||||||
cmdStr := fmt.Sprintf("git diff --submodule --no-ext-diff --unified=%d --color=%s%s%s %s %s", contextSize, colorArg, ignoreWhitespaceArg, cachedArg, trackedArg, quotedPath)
|
cmdStr := fmt.Sprintf("git diff --submodule --no-ext-diff --unified=%d --color=%s%s%s %s %s%s", contextSize, colorArg, ignoreWhitespaceArg, cachedArg, trackedArg, quotedPath, quotedPrevPath)
|
||||||
|
|
||||||
return self.cmd.New(cmdStr).DontLog()
|
return self.cmd.New(cmdStr).DontLog()
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ type IFile interface {
|
|||||||
GetHasStagedChanges() bool
|
GetHasStagedChanges() bool
|
||||||
GetIsTracked() bool
|
GetIsTracked() bool
|
||||||
GetPath() string
|
GetPath() string
|
||||||
|
GetPreviousPath() string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *File) IsRename() bool {
|
func (f *File) IsRename() bool {
|
||||||
@ -85,3 +86,7 @@ func (f *File) GetPath() string {
|
|||||||
// TODO: remove concept of name; just use path
|
// TODO: remove concept of name; just use path
|
||||||
return f.Name
|
return f.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (f *File) GetPreviousPath() string {
|
||||||
|
return f.PreviousName
|
||||||
|
}
|
||||||
|
@ -42,6 +42,13 @@ func (s *FileNode) GetPath() string {
|
|||||||
return s.Path
|
return s.Path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *FileNode) GetPreviousPath() string {
|
||||||
|
if s.File != nil {
|
||||||
|
return s.File.GetPreviousPath()
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func (s *FileNode) GetChildren() []INode {
|
func (s *FileNode) GetChildren() []INode {
|
||||||
return slices.Map(s.Children, func(child *FileNode) INode {
|
return slices.Map(s.Children, func(child *FileNode) INode {
|
||||||
return child
|
return child
|
||||||
|
Reference in New Issue
Block a user