Skip to content

Commit 915ea20

Browse files
committed
Add ability to customize Git root dir
Fixes #120
1 parent 44c00c1 commit 915ea20

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

mill-git/src/com/goyeau/mill/git/GitVersionModule.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@ object GitVersionModule extends ExternalModule {
1717

1818
/** Version derived from git.
1919
*/
20-
def version(hashLength: Int = 7, withSnapshotSuffix: Boolean = false): Command[String] =
20+
def version(
21+
hashLength: Int = 7,
22+
withSnapshotSuffix: Boolean = false,
23+
gitRoot: Path = workspaceRoot
24+
): Command[String] =
2125
Task.Command {
22-
val git = Git.open(workspaceRoot.toIO)
26+
val git = Git.open(gitRoot.toIO)
2327
val status = git.status().call()
2428
val isDirty = status.hasUncommittedChanges || !status.getUntracked.isEmpty
2529
val snapshotSuffix = if (withSnapshotSuffix) "-SNAPSHOT" else ""

0 commit comments

Comments
 (0)