From f1fbf1e9f5ae22508c702c30ab59bf5e7af513d3 Mon Sep 17 00:00:00 2001 From: Ryooooooga Date: Wed, 6 Oct 2021 22:38:41 +0900 Subject: [PATCH] Fix crash when try to ignore tracked files --- pkg/commands/files.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/commands/files.go b/pkg/commands/files.go index 74beb9fb7..462b5b899 100644 --- a/pkg/commands/files.go +++ b/pkg/commands/files.go @@ -123,14 +123,14 @@ func (c *GitCommand) DiscardAllFileChanges(file *models.File) error { if err := c.RunCommand("git checkout --ours -- %s", quotedFileName); err != nil { return err } - if err := c.RunCommand("git add %s", quotedFileName); err != nil { + if err := c.RunCommand("git add -- %s", quotedFileName); err != nil { return err } return nil } if file.ShortStatus == "DU" { - return c.RunCommand("git rm %s", quotedFileName) + return c.RunCommand("git rm -- %s", quotedFileName) } // if the file isn't tracked, we assume you want to delete it @@ -299,7 +299,7 @@ func (c *GitCommand) DiscardAnyUnstagedFileChanges() error { // RemoveTrackedFiles will delete the given file(s) even if they are currently tracked func (c *GitCommand) RemoveTrackedFiles(name string) error { - return c.RunCommand("git rm -r --cached %s", c.OSCommand.Quote(name)) + return c.RunCommand("git rm -r --cached -- %s", c.OSCommand.Quote(name)) } // RemoveUntrackedFiles runs `git clean -fd`