1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-02-09 13:47:11 +02:00

Fix crash when try to ignore tracked files

This commit is contained in:
Ryooooooga 2021-10-06 22:38:41 +09:00
parent 2c72990838
commit f1fbf1e9f5
No known key found for this signature in database
GPG Key ID: 07CF200DFCC20C25

View File

@ -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`