From 960ba3a11bd5a5f7998a3ef1e4c8ebb45ac16d22 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 20 May 2023 13:58:17 -0700 Subject: [PATCH 1/2] Update VcsVersion.scala --- core/src/de/tobiasroeser/mill/vcs/version/VcsVersion.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/de/tobiasroeser/mill/vcs/version/VcsVersion.scala b/core/src/de/tobiasroeser/mill/vcs/version/VcsVersion.scala index d628bb9..323aeb1 100644 --- a/core/src/de/tobiasroeser/mill/vcs/version/VcsVersion.scala +++ b/core/src/de/tobiasroeser/mill/vcs/version/VcsVersion.scala @@ -21,7 +21,7 @@ trait VcsVersion extends Module { private[this] def calcVcsState(logger: Logger): VcsState = { val curHeadRaw = try { - Option(os.proc("git", "rev-parse", "HEAD").call(cwd = vcsBasePath).out.trim()) + Option(os.proc("git", "rev-parse", "HEAD").call(cwd = vcsBasePath, stderr = os.Pipe).out.trim()) } catch { case e: SubprocessException => logger.error(s"${vcsBasePath} is not a git repository.") From 4afc78e3c18691e98c9e80f66792117dcc0cfa73 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 20 May 2023 13:59:24 -0700 Subject: [PATCH 2/2] Update VcsVersion.scala --- .../src/de/tobiasroeser/mill/vcs/version/VcsVersion.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/de/tobiasroeser/mill/vcs/version/VcsVersion.scala b/core/src/de/tobiasroeser/mill/vcs/version/VcsVersion.scala index 323aeb1..a6f2566 100644 --- a/core/src/de/tobiasroeser/mill/vcs/version/VcsVersion.scala +++ b/core/src/de/tobiasroeser/mill/vcs/version/VcsVersion.scala @@ -40,7 +40,7 @@ trait VcsVersion extends Module { curHead .map(curHead => os.proc("git", "describe", "--exact-match", "--tags", "--always", curHead) - .call(cwd = vcsBasePath) + .call(cwd = vcsBasePath, stderr = os.Pipe) .out .text() .trim @@ -54,7 +54,7 @@ trait VcsVersion extends Module { try { Option( os.proc("git", "describe", "--abbrev=0", "--tags") - .call() + .call(stderr = os.Pipe) .out .text() .trim() @@ -79,7 +79,7 @@ trait VcsVersion extends Module { case _ => Seq() }, "--count" - ).call() + ).call(stderr = os.Pipe) .out .trim() .toInt @@ -87,7 +87,7 @@ trait VcsVersion extends Module { .getOrElse(0) } - val dirtyHashCode: Option[String] = Option(os.proc("git", "diff").call().out.text().trim()).flatMap { + val dirtyHashCode: Option[String] = Option(os.proc("git", "diff").call(stderr = os.Pipe).out.text().trim()).flatMap { case "" => None case s => Some(Integer.toHexString(s.hashCode)) }