1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-11-26 09:00:57 +02:00

Moved function to git.go

Signed-off-by: Glenn Vriesman <glenn.vriesman@gmail.com>
This commit is contained in:
Glenn Vriesman 2020-02-04 12:50:13 +01:00 committed by Jesse Duffield
parent 0164abbd4a
commit 9f5397a2d4
2 changed files with 6 additions and 1 deletions

View File

@ -940,6 +940,11 @@ func (c *GitCommand) DiscardAnyUnstagedFileChanges() error {
return c.OSCommand.RunCommand("git checkout -- .") return c.OSCommand.RunCommand("git checkout -- .")
} }
// RemoveTrackedFiles will delete the given file(s) even if they are currently tracked
func (c *GitCommand) RemoveTrackedFiles(name string) error {
return c.OSCommand.RunCommand("git rm -r --cached %s", name)
}
// RemoveUntrackedFiles runs `git clean -fd` // RemoveUntrackedFiles runs `git clean -fd`
func (c *GitCommand) RemoveUntrackedFiles() error { func (c *GitCommand) RemoveUntrackedFiles() error {
return c.OSCommand.RunCommand("git clean -fd") return c.OSCommand.RunCommand("git clean -fd")

View File

@ -254,7 +254,7 @@ func (gui *Gui) handleIgnoreFile(g *gocui.Gui, v *gocui.View) error {
if err := gui.GitCommand.Ignore(file.Name); err != nil { if err := gui.GitCommand.Ignore(file.Name); err != nil {
return err return err
} }
if err := gui.GitCommand.OSCommand.RunCommand("git rm -r --cached %s", file.Name); err != nil { if err := gui.GitCommand.RemoveTrackedFiles(file.Name); err != nil {
return err return err
} }
return gui.refreshFiles() return gui.refreshFiles()