Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions mill-git/src/com/goyeau/mill/git/GitVersionModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ object GitVersionModule extends ExternalModule {

/** Version derived from git.
*/
def version(hashLength: Int = 7, withSnapshotSuffix: Boolean = false): Command[String] =
def version(
hashLength: Int = 7,
withSnapshotSuffix: Boolean = false,
gitRoot: Path = workspaceRoot
): Command[String] =
Task.Command {
val git = Git.open(workspaceRoot.toIO)
val git = Git.open(gitRoot.toIO)
val status = git.status().call()
val isDirty = status.hasUncommittedChanges || !status.getUntracked.isEmpty
val snapshotSuffix = if (withSnapshotSuffix) "-SNAPSHOT" else ""
Expand Down