diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2021-03-20 13:49:43 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2021-03-30 21:57:00 +1100 |
commit | c27cea6f30c35328a24bb4fb7db4f002ab544ad3 (patch) | |
tree | ef9f74c757d80651e4229266f54918915478febd /pkg/commands/files.go | |
parent | cd0532b4d6e9dcb846c6ce5ad88be7e0cf671a40 (diff) |
more file tree improvements
Diffstat (limited to 'pkg/commands/files.go')
-rw-r--r-- | pkg/commands/files.go | 12 |
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 { |