diff --git a/README.md b/README.md index 5bbdde1..72a0624 100644 --- a/README.md +++ b/README.md @@ -490,6 +490,7 @@ $ ./gradlew test -PbuildJdkVersion=15 -PtestJavaVersion=8 ``` myproject-foo.commitDate=2018-01-23 19\:14\:12 +0900 + myproject-foo.commitISODate=2018-01-23T19:14:12+09:00 myproject-foo.repoStatus=dirty myproject-foo.longCommitHash=2efe73d595a4687c9f8ad3d153ca8fe52604e20f myproject-foo.shortCommitHash=2efe73d5 diff --git a/lib/common-git.gradle b/lib/common-git.gradle index a5dbf64..c403d25 100644 --- a/lib/common-git.gradle +++ b/lib/common-git.gradle @@ -48,6 +48,7 @@ private def getRepoStatus() { version : project.version, longCommitHash : '0000000000000000000000000000000000000000', shortCommitHash : '0000000', + commitISODate : '1970-01-01T00:00:00+00:00', commitDate : '1970-01-01 00:00:00 +0000', repoStatus : 'unknown' ] @@ -64,13 +65,14 @@ private def getRepoStatus() { // Retrieve the repository status from the Git repository. try { - def gitLogOut = project.ext.executeGit('log', '-1', '--format=format:%h%x20%H%x20%cd', '--date=iso', '--abbrev=9') + def gitLogOut = project.ext.executeGit('log', '-1', '--format=format:%h%x20%H%x20%cI%x20%ci', '--abbrev=9') if (gitLogOut) { logger.info("Latest commit: ${gitLogOut}") def tokens = gitLogOut.tokenize(' ') result.shortCommitHash = tokens[0] result.longCommitHash = tokens[1] - result.commitDate = tokens[2..4].join(' ') + result.commitISODate = tokens[2] + result.commitDate = tokens[3..5].join(' ') } def gitStatusOut = project.ext.executeGit('status', '--porcelain')