mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 07:36:27 -04:00
Fix multi-selection of files with common prefix not working in commit files panel
Equivalent to the change that was made to isDescendentOfSelectedNodes in
files_controller.go in a5eec48b4b.
This commit is contained in:
parent
c7acf38399
commit
1d107721f2
|
|
@ -645,9 +645,13 @@ func isDescendentOfSelectedCommitFileNodes(node *filetree.CommitFileNode, select
|
|||
nodePath := node.GetInternalPath()
|
||||
|
||||
for _, selectedNode := range selectedNodes {
|
||||
if selectedNode.IsFile() {
|
||||
continue
|
||||
}
|
||||
|
||||
selectedNodePath := selectedNode.GetInternalPath()
|
||||
|
||||
if strings.HasPrefix(nodePath, selectedNodePath) && nodePath != selectedNodePath {
|
||||
if strings.HasPrefix(nodePath, selectedNodePath+"/") {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1552,6 +1552,8 @@ func normalisedSelectedNodes(selectedNodes []*filetree.FileNode) []*filetree.Fil
|
|||
})
|
||||
}
|
||||
|
||||
// NOTE: there's a duplicate of this function in commits_files_controller.go; if you make
|
||||
// changes here, make them there, too. (We should unify them using generics.)
|
||||
func isDescendentOfSelectedNodes(node *filetree.FileNode, selectedNodes []*filetree.FileNode) bool {
|
||||
nodePath := node.GetInternalPath()
|
||||
|
||||
|
|
|
|||
|
|
@ -41,19 +41,13 @@ var SelectDirecoriesSharingPrefix = NewIntegrationTest(NewIntegrationTestArgs{
|
|||
Equals(" ▼ foo").IsSelected(),
|
||||
Equals(" ● file").IsSelected(),
|
||||
Equals(" ▼ foobar").IsSelected(),
|
||||
/* EXPECTED:
|
||||
Equals(" ● file"),
|
||||
ACTUAL: */
|
||||
Equals(" A file"),
|
||||
)
|
||||
|
||||
t.Views().Information().Content(Contains("Building patch"))
|
||||
|
||||
t.Views().Secondary().Content(
|
||||
/* EXPECTED:
|
||||
Contains("foo/file").Contains("foobar/file"),
|
||||
ACTUAL: */
|
||||
Contains("foo/file").DoesNotContain("foobar/file"),
|
||||
)
|
||||
},
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue