1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-28 16:02:01 +03:00

allow ignoring directories

This commit is contained in:
Jesse Duffield
2021-03-16 09:07:00 +11:00
parent c9de6c003b
commit cd0532b4d6
4 changed files with 57 additions and 12 deletions

View File

@ -31,7 +31,7 @@ func (c *GitCommand) StageAll() error {
return c.OSCommand.RunCommand("git add -A")
}
// UnstageAll stages all files
// UnstageAll unstages all files
func (c *GitCommand) UnstageAll() error {
return c.OSCommand.RunCommand("git reset")
}

View File

@ -144,13 +144,19 @@ func (s *StatusLineNode) sortChildren() {
s.Children = sortedChildren
}
// returns true if any descendant file is tracked
func (s *StatusLineNode) GetIsTracked() bool {
if s.File != nil {
return s.File.GetIsTracked()
}
// pretty sure I'm allowed to do this
return true
for _, child := range s.Children {
if child.GetIsTracked() {
return true
}
}
return false
}
func (s *StatusLineNode) GetPath() string {
@ -211,3 +217,19 @@ func (s *StatusLineNode) ID() string {
func (s *StatusLineNode) Description() string {
return s.GetPath()
}
func (s *StatusLineNode) ForEachFile(cb func(*File) error) error {
if s.File != nil {
if err := cb(s.File); err != nil {
return err
}
}
for _, child := range s.Children {
if err := child.ForEachFile(cb); err != nil {
return err
}
}
return nil
}