mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-28 16:02:01 +03:00
more file tree improvements
This commit is contained in:
@ -142,16 +142,8 @@ func (c *GitCommand) DiscardAllFileChanges(file *models.File) error {
|
||||
}
|
||||
|
||||
func (c *GitCommand) DiscardAllDirChanges(node *models.StatusLineNode) error {
|
||||
if err := c.RemoveUntrackedDirFiles(node); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
quotedPath := c.OSCommand.Quote(node.GetPath())
|
||||
if err := c.OSCommand.RunCommand("git checkout HEAD -- %s", quotedPath); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
// this could be more efficient but we would need to handle all the edge cases
|
||||
return node.ForEachFile(c.DiscardAllFileChanges)
|
||||
}
|
||||
|
||||
func (c *GitCommand) DiscardUnstagedDirChanges(node *models.StatusLineNode) error {
|
||||
|
@ -13,24 +13,6 @@ type StatusLineNode struct {
|
||||
Collapsed bool
|
||||
}
|
||||
|
||||
func (s *StatusLineNode) GetShortStatus() string {
|
||||
// need to see if any child has unstaged changes.
|
||||
if s.IsLeaf() {
|
||||
return s.File.ShortStatus
|
||||
}
|
||||
|
||||
firstChar := " "
|
||||
secondChar := " "
|
||||
if s.GetHasStagedChanges() {
|
||||
firstChar = "M"
|
||||
}
|
||||
if s.GetHasUnstagedChanges() {
|
||||
secondChar = "M"
|
||||
}
|
||||
|
||||
return firstChar + secondChar
|
||||
}
|
||||
|
||||
func (s *StatusLineNode) GetHasUnstagedChanges() bool {
|
||||
if s.IsLeaf() {
|
||||
return s.File.HasUnstagedChanges
|
||||
|
Reference in New Issue
Block a user