diff options
Diffstat (limited to 'internal')
-rw-r--r-- | internal/vcs/repository.go | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/internal/vcs/repository.go b/internal/vcs/repository.go index 8ee08b2..625fbd2 100644 --- a/internal/vcs/repository.go +++ b/internal/vcs/repository.go @@ -81,5 +81,23 @@ func (r *Repository) Update(cfg *Config) (bool, error) { } log.Info("updated to", "rev", head.Hash().String()) - return true, nil + return true, r.Clean(wt) +} + +func (r *Repository) Clean(wt *git.Worktree) error { + st, err := wt.Status() + if err != nil { + return err + } + + if !st.IsClean() { + err = wt.Clean(&git.CleanOptions{ + Dir: true, + }) + if err != nil { + return err + } + } + + return nil } |