summaryrefslogtreecommitdiffstats
path: root/pkg/commands
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2021-03-20 13:49:43 +1100
committerJesse Duffield <jessedduffield@gmail.com>2021-03-30 21:57:00 +1100
commitc27cea6f30c35328a24bb4fb7db4f002ab544ad3 (patch)
treeef9f74c757d80651e4229266f54918915478febd /pkg/commands
parentcd0532b4d6e9dcb846c6ce5ad88be7e0cf671a40 (diff)
more file tree improvements
Diffstat (limited to 'pkg/commands')
-rw-r--r--pkg/commands/files.go12
-rw-r--r--pkg/commands/models/status_line_node.go18
2 files changed, 2 insertions, 28 deletions
diff --git a/pkg/commands/files.go b/pkg/commands/files.go
index e7332dbbe..8244408cc 100644
--- a/pkg/commands/files.go
+++ b/pkg/commands/files.go
@@ -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 {
diff --git a/pkg/commands/models/status_line_node.go b/pkg/commands/models/status_line_node.go
index ce85cfec8..3962e0c42 100644
--- a/pkg/commands/models/status_line_node.go
+++ b/pkg/commands/models/status_line_node.go
@@ -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