From 797a5de7d4a97b7fe9fa38186c49795bf2ba2ee3 Mon Sep 17 00:00:00 2001 From: patrick brisbin Date: Tue, 15 Oct 2024 07:48:10 -0400 Subject: [PATCH 1/2] Ignore git-clean failures Some restylers create files that we do not have permission to clean up. I might've expected that to always be the case, since they run in a container as `root`, but many restylers create files we can and do clean up. Attempting it and ignoring permissions errors seems fine; it was best-effort anyway. --- src/Restyler/Monad/Git.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Restyler/Monad/Git.hs b/src/Restyler/Monad/Git.hs index 8180ba18..6aaf6ef8 100644 --- a/src/Restyler/Monad/Git.hs +++ b/src/Restyler/Monad/Git.hs @@ -52,7 +52,12 @@ instance gitCommit msg paths = do runGit_ $ ["commit", "--message", msg, "--"] <> toList paths readGitChomp ["rev-parse", "HEAD"] - gitClean = runGit_ ["clean", "-d", "--force"] + gitClean = do + ec <- runGitExitCode ["clean", "-d", "--force"] + when (ec /= ExitSuccess) + $ logWarn + $ "git clean not successful" + :# ["exitCode" .= show @Text ec] gitResetHard ref = runGit_ ["reset", "--hard", ref] runGit_ From 6eb715f1f6c0d5616b54ba7ef213de64bfa3d955 Mon Sep 17 00:00:00 2001 From: patrick brisbin Date: Tue, 15 Oct 2024 07:50:43 -0400 Subject: [PATCH 2/2] Version bump --- package.yaml | 2 +- restyler.cabal | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.yaml b/package.yaml index b224c3f6..5e87615b 100644 --- a/package.yaml +++ b/package.yaml @@ -1,5 +1,5 @@ name: restyler -version: 0.5.2.0 +version: 0.5.2.1 license: AGPL-3 language: GHC2021 diff --git a/restyler.cabal b/restyler.cabal index d6d8e3c7..a33da04d 100644 --- a/restyler.cabal +++ b/restyler.cabal @@ -5,7 +5,7 @@ cabal-version: 1.12 -- see: https://github.com/sol/hpack name: restyler -version: 0.5.2.0 +version: 0.5.2.1 license: AGPL-3 build-type: Simple