Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/gui/presentation/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ func fileNameAtDepth(node *filetree.Node[models.File], depth int) string {
name := join(splitName[depth:])

if node.File != nil && node.File.IsRename() {
splitPrevName := split(node.File.PreviousPath)
splitPrevName := split("./" + node.File.PreviousPath)

prevName := node.File.PreviousPath
// if the file has just been renamed inside the same directory, we can shave off
Expand Down
36 changes: 36 additions & 0 deletions pkg/integration/tests/file/renamed_files.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package file

import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)

var RenamedFiles = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Regression test for the display of renamed files in the file tree",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
},
SetupRepo: func(shell *Shell) {
shell.CreateDir("dir")
shell.CreateDir("dir/nested")
shell.CreateFileAndAdd("file1", "file1 content\n")
shell.CreateFileAndAdd("dir/file2", "file2 content\n")
shell.CreateFileAndAdd("dir/nested/file3", "file3 content\n")
shell.Commit("initial commit")
shell.RunCommand([]string{"git", "mv", "file1", "dir/file1"})
shell.RunCommand([]string{"git", "mv", "dir/file2", "dir/file2-renamed"})
shell.RunCommand([]string{"git", "mv", "dir/nested/file3", "file3"})
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
Lines(
Equals("▼ /"),
Equals(" ▼ dir"),
Equals(" R file1 → file1"),
Equals(" R file2 → file2-renamed"),
Equals(" R dir/nested/file3 → file3"),
)
},
})
1 change: 1 addition & 0 deletions pkg/integration/tests/test_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ var tests = []*components.IntegrationTest{
file.Gitignore,
file.RememberCommitMessageAfterFail,
file.RenameSimilarityThresholdChange,
file.RenamedFiles,
file.StageChildrenRangeSelect,
file.StageDeletedRangeSelect,
file.StageRangeSelect,
Expand Down