1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-31 14:24:25 +03:00

support discarding changes in dir

This commit is contained in:
Jesse Duffield
2021-03-15 22:29:34 +11:00
parent f871724ae6
commit 418621a9ff
4 changed files with 106 additions and 26 deletions

View File

@ -188,3 +188,18 @@ func (s *StatusLineNode) compressAux() *StatusLineNode {
func (s *StatusLineNode) HasExactlyOneChild() bool {
return len(s.Children) == 1
}
// This ignores the root
func (s *StatusLineNode) GetPathsMatching(test func(*StatusLineNode) bool) []string {
paths := []string{}
if test(s) {
paths = append(paths, s.GetPath())
}
for _, child := range s.Children {
paths = append(paths, child.GetPathsMatching(test)...)
}
return paths
}