mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-08 23:56:15 +02:00
safer code
This commit is contained in:
parent
040c1fc302
commit
fe4e305410
@ -252,7 +252,7 @@ func (s *StatusLineNode) NameAtDepth(depth int) string {
|
|||||||
prevName := s.File.PreviousName
|
prevName := s.File.PreviousName
|
||||||
// if the file has just been renamed inside the same directory, we can shave off
|
// if the file has just been renamed inside the same directory, we can shave off
|
||||||
// the prefix for the previous path too. Otherwise we'll keep it unchanged
|
// the prefix for the previous path too. Otherwise we'll keep it unchanged
|
||||||
sameParentDir := filepath.Join(splitName[0:depth]...) == filepath.Join(splitPrevName[0:depth]...)
|
sameParentDir := len(splitName) == len(splitPrevName) && filepath.Join(splitName[0:depth]...) == filepath.Join(splitPrevName[0:depth]...)
|
||||||
if sameParentDir {
|
if sameParentDir {
|
||||||
prevName = filepath.Join(splitPrevName[depth:]...)
|
prevName = filepath.Join(splitPrevName[depth:]...)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user