all repos — website @ 32a2145ee44cc301551ce2e4d24ed34361ebd4b2

My website

run `git clean` after updating
Alan Pearce alan@alanpearce.eu
Fri, 28 Jun 2024 14:36:33 +0200
commit

32a2145ee44cc301551ce2e4d24ed34361ebd4b2

parent

0fbf10f9d7bc4991084a2405ba7c3816b3a49e9e

1 files changed, 19 insertions(+), 1 deletions(-)

jump to
M internal/vcs/repository.gointernal/vcs/repository.go
@@ -81,5 +81,23 @@ return false, err 	}
 	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
 }