diff options
author | Ryooooooga <eial5q265e5@gmail.com> | 2021-10-06 22:38:41 +0900 |
---|---|---|
committer | Ryooooooga <eial5q265e5@gmail.com> | 2021-10-06 22:43:30 +0900 |
commit | f1fbf1e9f5ae22508c702c30ab59bf5e7af513d3 (patch) | |
tree | 089cd968754b311e5ee4e53a4978170829f3ccc9 /pkg/commands/files.go | |
parent | 2c72990838296be85f150117b77c27194ebc3592 (diff) |
Fix crash when try to ignore tracked files
Diffstat (limited to 'pkg/commands/files.go')
-rw-r--r-- | pkg/commands/files.go | 6 |
1 files 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` |