diff options
author | Mark Kopenga <mkopenga@gmail.com> | 2021-09-21 12:18:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-21 12:18:28 +0200 |
commit | a5719c530a3094aa7f7377f24f3aa5989ffddf6a (patch) | |
tree | 13034750bf102b93ae3333a81a398e62ad3f6de6 | |
parent | 60c87b3e70f077ab2f222ddb1a77cf0e5ccf3db4 (diff) | |
parent | add3e8783eaf844f39177ffacb4b3533e31d9e1d (diff) |
Merge pull request #1481 from Ryooooooga/feature/fix-remove-tracked-files
Fix crash on remove tracked files #1480
-rw-r--r-- | pkg/commands/files.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/commands/files.go b/pkg/commands/files.go index c66ffc5cf..5ad6eeb66 100644 --- a/pkg/commands/files.go +++ b/pkg/commands/files.go @@ -205,7 +205,7 @@ func (c *GitCommand) WorktreeFileDiffCmdStr(node models.IFile, plain bool, cache cachedArg := "" trackedArg := "--" colorArg := c.colorArg() - path := c.OSCommand.Quote(node.GetPath()) + quotedPath := c.OSCommand.Quote(node.GetPath()) ignoreWhitespaceArg := "" if cached { cachedArg = "--cached" @@ -220,7 +220,7 @@ func (c *GitCommand) WorktreeFileDiffCmdStr(node models.IFile, plain bool, cache ignoreWhitespaceArg = "--ignore-all-space" } - return fmt.Sprintf("git diff --submodule --no-ext-diff --color=%s %s %s %s %s", colorArg, ignoreWhitespaceArg, cachedArg, trackedArg, path) + return fmt.Sprintf("git diff --submodule --no-ext-diff --color=%s %s %s %s %s", colorArg, ignoreWhitespaceArg, cachedArg, trackedArg, quotedPath) } func (c *GitCommand) ApplyPatch(patch string, flags ...string) error { @@ -271,7 +271,7 @@ func (c *GitCommand) DiscardOldFileChanges(commits []*models.Commit, commitIndex } // check if file exists in previous commit (this command returns an error if the file doesn't exist) - if err := c.RunCommand("git cat-file -e HEAD^:%s", fileName); err != nil { + if err := c.RunCommand("git cat-file -e HEAD^:%s", c.OSCommand.Quote(fileName)); err != nil { if err := c.OSCommand.Remove(fileName); err != nil { return err } @@ -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", name) + return c.RunCommand("git rm -r --cached %s", c.OSCommand.Quote(name)) } // RemoveUntrackedFiles runs `git clean -fd` |