From 18f09fd89df0b334b9d57e7566d256cd6a1296bb Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Mon, 23 Oct 2023 13:45:37 -0400 Subject: [PATCH] fix: don't git clean automatically (#885) --- scripts/git_clean.R | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/git_clean.R b/scripts/git_clean.R index 350f3e885..b758d2cff 100644 --- a/scripts/git_clean.R +++ b/scripts/git_clean.R @@ -1,2 +1,10 @@ -# run without --dry-run -system("git clean -xfd -e node_modules -e revdep") +# Check files that should be cleaned (ignoring directories) +needs_cleaned <- system("git clean -xf --dry-run") + +if (length(needs_cleaned)) { + stop( + "There are untracked files in the repo. Please run", + "`git clean -xf --dry-run` to see what will be removed. ", + "Add --force to force removal of untracked files." + ) +}