Skip to content

Commit

Permalink
pkg/vcs: reset state even more
Browse files Browse the repository at this point in the history
"git clean -fd" does not remove ignored files,
while can mess state when .gitignore changes across commits.
Use "git clean -fdx" to delete ignored files as well.
  • Loading branch information
dvyukov committed Jul 4, 2020
1 parent 5109519 commit 0bb1970
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/vcs/git.go
Expand Up @@ -123,6 +123,7 @@ func (git *git) fetchRemote(repo string) error {

func (git *git) SwitchCommit(commit string) (*Commit, error) {
git.git("reset", "--hard")
git.git("clean", "-fdx")
if _, err := git.git("checkout", commit); err != nil {
return nil, err
}
Expand All @@ -145,7 +146,7 @@ func (git *git) clone(repo, branch string) error {
func (git *git) reset() {
// This function tries to reset git repo state to a known clean state.
git.git("reset", "--hard")
git.git("clean", "-fd")
git.git("clean", "-fdx")
git.git("bisect", "reset")
git.git("reset", "--hard")
}
Expand Down

0 comments on commit 0bb1970

Please sign in to comment.