]> git.frustrated-labs.net Git - gradle-changelog-plugin.git/blob
975b4481740341a7b65284ede97a1ca333872c83
[gradle-changelog-plugin.git] /
1 package io.github.aloussase.changelog.git.commands
2
3 import io.github.aloussase.changelog.git.RawCommit
4
5 class GetCurrentBranchCommitsCommand(
6     val baseBranch: String
7 ) : AbstractGitCommand<List<RawCommit>>() {
8
9     override val commandLine: String
10         get() = "git log $baseBranch..HEAD --no-merges --oneline --pretty=format:\"%an|%s\""
11
12     override fun transform(rawOutput: String): List<RawCommit> =
13         rawOutput
14             .split("\n")
15             .map { it.split("|") }
16             .map { RawCommit(it[0], it[1]) }
17 }