From 307f36d173f06da97bc04542a0a022eb4b9276fb Mon Sep 17 00:00:00 2001 From: jang whoemoon Date: Thu, 15 Feb 2024 12:58:39 +0900 Subject: [PATCH 1/2] Replace commitDate format to ISO8601 --- README.md | 2 +- lib/common-git.gradle | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5bbdde1..d6bf8c9 100644 --- a/README.md +++ b/README.md @@ -489,7 +489,7 @@ $ ./gradlew test -PbuildJdkVersion=15 -PtestJavaVersion=8 useful build information: ``` - myproject-foo.commitDate=2018-01-23 19\:14\:12 +0900 + myproject-foo.commitDate=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..f3208f2 100644 --- a/lib/common-git.gradle +++ b/lib/common-git.gradle @@ -48,7 +48,7 @@ private def getRepoStatus() { version : project.version, longCommitHash : '0000000000000000000000000000000000000000', shortCommitHash : '0000000', - commitDate : '1970-01-01 00:00:00 +0000', + commitDate : '1970-01-01T00:00:00+00:00', repoStatus : 'unknown' ] @@ -64,13 +64,13 @@ 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%cd', '--date=iso-strict', '--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.commitDate = tokens[2] } def gitStatusOut = project.ext.executeGit('status', '--porcelain') From 6b12c4edbc82b2b7b2e0e2c96558f023cfa02a3d Mon Sep 17 00:00:00 2001 From: jang whoemoon Date: Mon, 11 Mar 2024 17:56:28 +0900 Subject: [PATCH 2/2] Revert commitDate property format and add commitISODate property --- README.md | 3 ++- lib/common-git.gradle | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d6bf8c9..72a0624 100644 --- a/README.md +++ b/README.md @@ -489,7 +489,8 @@ $ ./gradlew test -PbuildJdkVersion=15 -PtestJavaVersion=8 useful build information: ``` - myproject-foo.commitDate=2018-01-23T19:14:12+09:00 + 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 f3208f2..c403d25 100644 --- a/lib/common-git.gradle +++ b/lib/common-git.gradle @@ -48,7 +48,8 @@ private def getRepoStatus() { version : project.version, longCommitHash : '0000000000000000000000000000000000000000', shortCommitHash : '0000000', - commitDate : '1970-01-01T00:00:00+00:00', + 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-strict', '--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] + result.commitISODate = tokens[2] + result.commitDate = tokens[3..5].join(' ') } def gitStatusOut = project.ext.executeGit('status', '--porcelain')