From 4258e27a6616180021f0beb79365a9493ed61f7a Mon Sep 17 00:00:00 2001 From: Risto Lahtela <24460436+AuroraLS3@users.noreply.github.com> Date: Sun, 26 Sep 2021 14:00:54 +0300 Subject: [PATCH] Fixed corner case of determineWebAssetModifications step git log would return empty line for files with no git history. Added a check that uses current time instead of git log if file is not in git history. --- Plan/common/build.gradle | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Plan/common/build.gradle b/Plan/common/build.gradle index 668e9d00b..cb3abe2eb 100644 --- a/Plan/common/build.gradle +++ b/Plan/common/build.gradle @@ -43,8 +43,9 @@ task determineWebAssetModifications { commandLine 'git', 'log', '-1', '--pretty=%ct', f.toString() standardOutput = gitModified } + def gitModifiedAsString = gitModified.toString().strip() // git returns UNIX time in seconds, but most things in Java use UNIX time in milliseconds - def modified = Long.parseLong(gitModified.toString().strip()) * 1000 + def modified = gitModifiedAsString.isEmpty() ? System.currentTimeMillis() : Long.parseLong(gitModifiedAsString) * 1000 def relativePath = tree.getDir().toPath().relativize(f.toPath()) // File path relative to the tree versionFile.text += String.format( // writing YAML as raw text probably isn't the best idea "%s: %s\n", relativePath.toString().replace('.', ','), modified