mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-15 05:41:51 +08:00
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.
This commit is contained in:
parent
dc8b1c5a3a
commit
4258e27a66
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user