diff --git a/docs/running.md b/docs/running.md index 271a690afa..12ae611c51 100644 --- a/docs/running.md +++ b/docs/running.md @@ -51,7 +51,16 @@ More information about using the `--scalafix-migrations` and `--artifact-migrati The workspace directory (specified with `--workspace`) provides a location for cache and temporary files. It is important to persist this workspace between runs. Without this, Scala Steward will be unable to observe -repo-specific preferences (such as [pullRequests.frequency](repo-specific-configuration.md)) correctly. +repo-specific preferences (such as [pullRequests.frequency](repo-specific-configuration.md)) correctly. + +Furthermore, `git` requires the workspace directory to be owned by the same user that will run Scala Steward. +If there is an ownership mismatch, `git` may print error messages like + +> fatal: detected dubious ownership in repository … + +or + +> fatal: not in a git directory ### Private repositories @@ -203,7 +212,6 @@ pipelines: There is multiple articles on how to run Scala Steward on-premise: * [Running Scala Steward On-premise](https://engineering.avast.io/running-scala-steward-on-premise) -* [Running scala-steward periodically on AWS Fargate](https://medium.com/@tanishiking/running-scala-steward-periodically-on-aws-fargate-3d3d202f0f7) * [Scala StewardとGitHub Actionsで依存ライブラリの更新を自動化する](https://scalapedia.com/articles/145/Scala+Steward%E3%81%A8GitHub+Actions%E3%81%A7%E4%BE%9D%E5%AD%98%E3%83%A9%E3%82%A4%E3%83%96%E3%83%A9%E3%83%AA%E3%81%AE%E6%9B%B4%E6%96%B0%E3%82%92%E8%87%AA%E5%8B%95%E5%8C%96%E3%81%99%E3%82%8B) * [Centralized Scala Steward with GitHub Actions](https://hector.dev/2020/11/18/centralized-scala-steward-with-github-actions) * [Big Timesavers for Busy Scala Developers](https://speakerdeck.com/exoego/big-timesavers-for-busy-scala-developers) diff --git a/modules/core/src/main/scala/org/scalasteward/core/git/FileGitAlg.scala b/modules/core/src/main/scala/org/scalasteward/core/git/FileGitAlg.scala index a82182024a..49138b8001 100644 --- a/modules/core/src/main/scala/org/scalasteward/core/git/FileGitAlg.scala +++ b/modules/core/src/main/scala/org/scalasteward/core/git/FileGitAlg.scala @@ -151,7 +151,18 @@ final class FileGitAlg[F[_]](config: GitCfg)(implicit slurpOptions: SlurpOptions = Set.empty ): F[List[String]] = { val extraEnv = List("GIT_ASKPASS" -> config.gitAskPass.pathAsString) - processAlg.exec(gitCmd ++ args.toList, repo, extraEnv, slurpOptions) + processAlg + .exec(gitCmd ++ args.toList, repo, extraEnv, slurpOptions) + .recoverWith { + case ex: ProcessFailedException + if ex.getMessage.contains("fatal: not in a git directory") => + // `git status` prints a more informative error message than some other git commands, like `git config` + // this will hopefully print that error message to the logs in addition to the actual failure + processAlg + .exec(Nel.of("git", "status"), repo, List.empty, slurpOptions) + .attempt + .void >> ex.raiseError + } } private def git_(args: String*)(repo: File): F[List[String]] = diff --git a/modules/docs/mdoc/running.md b/modules/docs/mdoc/running.md index 1dc074b342..51af5e88bf 100644 --- a/modules/docs/mdoc/running.md +++ b/modules/docs/mdoc/running.md @@ -51,7 +51,16 @@ More information about using the `--scalafix-migrations` and `--artifact-migrati The workspace directory (specified with `--workspace`) provides a location for cache and temporary files. It is important to persist this workspace between runs. Without this, Scala Steward will be unable to observe -repo-specific preferences (such as [pullRequests.frequency](repo-specific-configuration.md)) correctly. +repo-specific preferences (such as [pullRequests.frequency](repo-specific-configuration.md)) correctly. + +Furthermore, `git` requires the workspace directory to be owned by the same user that will run Scala Steward. +If there is an ownership mismatch, `git` may print error messages like + +> fatal: detected dubious ownership in repository … + +or + +> fatal: not in a git directory ### Private repositories @@ -203,7 +212,6 @@ pipelines: There is multiple articles on how to run Scala Steward on-premise: * [Running Scala Steward On-premise](https://engineering.avast.io/running-scala-steward-on-premise) -* [Running scala-steward periodically on AWS Fargate](https://medium.com/@tanishiking/running-scala-steward-periodically-on-aws-fargate-3d3d202f0f7) * [Scala StewardとGitHub Actionsで依存ライブラリの更新を自動化する](https://scalapedia.com/articles/145/Scala+Steward%E3%81%A8GitHub+Actions%E3%81%A7%E4%BE%9D%E5%AD%98%E3%83%A9%E3%82%A4%E3%83%96%E3%83%A9%E3%83%AA%E3%81%AE%E6%9B%B4%E6%96%B0%E3%82%92%E8%87%AA%E5%8B%95%E5%8C%96%E3%81%99%E3%82%8B) * [Centralized Scala Steward with GitHub Actions](https://hector.dev/2020/11/18/centralized-scala-steward-with-github-actions) * [Big Timesavers for Busy Scala Developers](https://speakerdeck.com/exoego/big-timesavers-for-busy-scala-developers)