Skip to content

Commit 1a69bd9

Browse files
author
Devon Stewart
committed
Adding GitAlg.diff
1 parent 21c5160 commit 1a69bd9

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ final class FileGitAlg[F[_]](config: GitCfg)(implicit
138138
override def version: F[String] =
139139
workspaceAlg.rootDir.flatMap(git("--version")).map(_.mkString.trim)
140140

141+
override def diff(repo: File, branch: Branch): F[List[String]] =
142+
git("diff", branch.name)(repo)
143+
141144
private def git(args: String*)(repo: File): F[List[String]] =
142145
processAlg.exec(Nel.of("git", args: _*), repo, "GIT_ASKPASS" -> config.gitAskPass.pathAsString)
143146

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ trait GenGitAlg[F[_], Repo] {
6969

7070
def version: F[String]
7171

72+
def diff(repo: Repo, branch: Branch): F[List[String]]
73+
7274
final def commitAllIfDirty(repo: Repo, message: String, messages: String*)(implicit
7375
F: Monad[F]
7476
): F[Option[Commit]] =
@@ -142,6 +144,9 @@ trait GenGitAlg[F[_], Repo] {
142144

143145
override def version: F[String] =
144146
self.version
147+
148+
override def diff(repo: A, branch: Branch): F[List[String]] =
149+
f(repo).flatMap(self.diff(_, branch))
145150
}
146151
}
147152
}

0 commit comments

Comments
 (0)