Skip to content

Commit f1b4935

Browse files
authored
Merge pull request #3284 from Dwolla/docs
Improve documentation for workspace ownership mismatches
2 parents 80f794b + 5bfb8b4 commit f1b4935

File tree

3 files changed

+32
-5
lines changed

3 files changed

+32
-5
lines changed

docs/running.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,16 @@ More information about using the `--scalafix-migrations` and `--artifact-migrati
5151
The workspace directory (specified with `--workspace`) provides a location for cache and temporary files.
5252

5353
It is important to persist this workspace between runs. Without this, Scala Steward will be unable to observe
54-
repo-specific preferences (such as [pullRequests.frequency](repo-specific-configuration.md)) correctly.
54+
repo-specific preferences (such as [pullRequests.frequency](repo-specific-configuration.md)) correctly.
55+
56+
Furthermore, `git` requires the workspace directory to be owned by the same user that will run Scala Steward.
57+
If there is an ownership mismatch, `git` may print error messages like
58+
59+
> fatal: detected dubious ownership in repository …
60+
61+
or
62+
63+
> fatal: not in a git directory
5564
5665
### Private repositories
5766

@@ -203,7 +212,6 @@ pipelines:
203212
There is multiple articles on how to run Scala Steward on-premise:
204213

205214
* [Running Scala Steward On-premise](https://engineering.avast.io/running-scala-steward-on-premise)
206-
* [Running scala-steward periodically on AWS Fargate](https://medium.com/@tanishiking/running-scala-steward-periodically-on-aws-fargate-3d3d202f0f7)
207215
* [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)
208216
* [Centralized Scala Steward with GitHub Actions](https://hector.dev/2020/11/18/centralized-scala-steward-with-github-actions)
209217
* [Big Timesavers for Busy Scala Developers](https://speakerdeck.com/exoego/big-timesavers-for-busy-scala-developers)

modules/core/src/main/scala/org/scalasteward/core/git/FileGitAlg.scala

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,18 @@ final class FileGitAlg[F[_]](config: GitCfg)(implicit
151151
slurpOptions: SlurpOptions = Set.empty
152152
): F[List[String]] = {
153153
val extraEnv = List("GIT_ASKPASS" -> config.gitAskPass.pathAsString)
154-
processAlg.exec(gitCmd ++ args.toList, repo, extraEnv, slurpOptions)
154+
processAlg
155+
.exec(gitCmd ++ args.toList, repo, extraEnv, slurpOptions)
156+
.recoverWith {
157+
case ex: ProcessFailedException
158+
if ex.getMessage.contains("fatal: not in a git directory") =>
159+
// `git status` prints a more informative error message than some other git commands, like `git config`
160+
// this will hopefully print that error message to the logs in addition to the actual failure
161+
processAlg
162+
.exec(Nel.of("git", "status"), repo, List.empty, slurpOptions)
163+
.attempt
164+
.void >> ex.raiseError
165+
}
155166
}
156167

157168
private def git_(args: String*)(repo: File): F[List[String]] =

modules/docs/mdoc/running.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,16 @@ More information about using the `--scalafix-migrations` and `--artifact-migrati
5151
The workspace directory (specified with `--workspace`) provides a location for cache and temporary files.
5252

5353
It is important to persist this workspace between runs. Without this, Scala Steward will be unable to observe
54-
repo-specific preferences (such as [pullRequests.frequency](repo-specific-configuration.md)) correctly.
54+
repo-specific preferences (such as [pullRequests.frequency](repo-specific-configuration.md)) correctly.
55+
56+
Furthermore, `git` requires the workspace directory to be owned by the same user that will run Scala Steward.
57+
If there is an ownership mismatch, `git` may print error messages like
58+
59+
> fatal: detected dubious ownership in repository …
60+
61+
or
62+
63+
> fatal: not in a git directory
5564
5665
### Private repositories
5766

@@ -203,7 +212,6 @@ pipelines:
203212
There is multiple articles on how to run Scala Steward on-premise:
204213

205214
* [Running Scala Steward On-premise](https://engineering.avast.io/running-scala-steward-on-premise)
206-
* [Running scala-steward periodically on AWS Fargate](https://medium.com/@tanishiking/running-scala-steward-periodically-on-aws-fargate-3d3d202f0f7)
207215
* [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)
208216
* [Centralized Scala Steward with GitHub Actions](https://hector.dev/2020/11/18/centralized-scala-steward-with-github-actions)
209217
* [Big Timesavers for Busy Scala Developers](https://speakerdeck.com/exoego/big-timesavers-for-busy-scala-developers)

0 commit comments

Comments
 (0)