@@ -71,7 +71,6 @@ trait GitAlg[F[_]] {
7171}
7272
7373object GitAlg {
74- val gitCmd : String = " git"
7574
7675 def create [F [_]](implicit
7776 config : Config ,
@@ -81,6 +80,9 @@ object GitAlg {
8180 F : BracketThrowable [F ]
8281 ): GitAlg [F ] =
8382 new GitAlg [F ] {
83+ private val sign : String =
84+ if (config.signCommits) " --gpg-sign" else " --no-gpg-sign"
85+
8486 override def branchAuthors (repo : Repo , branch : Branch , base : Branch ): F [List [String ]] =
8587 workspaceAlg.repoDir(repo).flatMap { repoDir =>
8688 exec(Nel .of(" log" , " --pretty=format:'%an'" , dotdot(base, branch)), repoDir)
@@ -108,8 +110,7 @@ object GitAlg {
108110 override def commitAll (repo : Repo , message : String ): F [Commit ] =
109111 for {
110112 repoDir <- workspaceAlg.repoDir(repo)
111- sign = if (config.signCommits) List (" --gpg-sign" ) else List (" --no-gpg-sign" )
112- _ <- exec(Nel .of(" commit" , " --all" , " -m" , message) ++ sign, repoDir)
113+ _ <- exec(Nel .of(" commit" , " --all" , sign, " -m" , message), repoDir)
113114 } yield Commit ()
114115
115116 override def containsChanges (repo : Repo ): F [Boolean ] =
@@ -163,8 +164,7 @@ object GitAlg {
163164 for {
164165 before <- latestSha1(repo, Branch .head)
165166 repoDir <- workspaceAlg.repoDir(repo)
166- sign = if (config.signCommits) List (" --gpg-sign" ) else List .empty
167- _ <- exec(Nel .of(" merge" , " --strategy-option=theirs" ) ++ (sign :+ branch.name), repoDir)
167+ _ <- exec(Nel .of(" merge" , " --strategy-option=theirs" , sign, branch.name), repoDir)
168168 .handleErrorWith { throwable =>
169169 // Resolve CONFLICT (modify/delete) by deleting unmerged files:
170170 for {
@@ -173,7 +173,7 @@ object GitAlg {
173173 case Some (files) => files.traverse(file => exec(Nel .of(" rm" , file), repoDir))
174174 case None => F .raiseError(throwable)
175175 }
176- _ <- exec(Nel .of(" commit" , " --all" , " --no-edit" ) ++ sign, repoDir)
176+ _ <- exec(Nel .of(" commit" , " --all" , " --no-edit" , sign) , repoDir)
177177 } yield List .empty
178178 }
179179 after <- latestSha1(repo, Branch .head)
@@ -208,7 +208,7 @@ object GitAlg {
208208 _ <- push(repo, defaultBranch)
209209 } yield ()
210210
211- def exec (command : Nel [String ], cwd : File ): F [List [String ]] =
212- processAlg.exec(gitCmd :: command, cwd, " GIT_ASKPASS" -> config.gitAskPass.pathAsString)
211+ private def exec (command : Nel [String ], cwd : File ): F [List [String ]] =
212+ processAlg.exec(" git " :: command, cwd, " GIT_ASKPASS" -> config.gitAskPass.pathAsString)
213213 }
214214}
0 commit comments