summaryrefslogtreecommitdiffstats
path: root/pkg/commands/files.go
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/files.go
parentcd0532b4d6e9dcb846c6ce5ad88be7e0cf671a40 (diff)
more file tree improvements
Diffstat (limited to 'pkg/commands/files.go')
-rw-r--r--pkg/commands/files.go12
1 files changed, 2 insertions, 10 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 {