in modules/core/src/main/scala/org/scalasteward/core/git/FileGitAlg.scala [156:181]
private def git(args: String*)(
repo: File,
slurpOptions: SlurpOptions = Set.empty
): F[List[String]] = {
val extraEnv = (config.forgeCfg.tpe match {
case AzureRepos => Some(config.gitCfg.gitAskPass)
case Bitbucket => Some(config.gitCfg.gitAskPass)
case BitbucketServer => Some(config.gitCfg.gitAskPass)
case GitHub => None
case GitLab => Some(config.gitCfg.gitAskPass)
case Gitea => Some(config.gitCfg.gitAskPass)
}).map("GIT_ASKPASS" -> _.pathAsString).toList
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
}
}