Просмотр исходного кода

commitTime 转换为 ms 时间戳

reghao 2 лет назад
Родитель
Сommit
512fe3166d

+ 2 - 2
common/src/main/java/cn/reghao/devops/common/build/tool/repo/GitImpl.java

@@ -150,13 +150,13 @@ public class GitImpl implements CodeUpdater {
         try (RevWalk walk = new RevWalk(repo)) {
             // 最近一次提交的信息
             RevCommit lastCommit = walk.parseCommit(objectId);
-            long commitTime = lastCommit.getCommitTime();
+            long commitTime = lastCommit.getCommitTime()*1000L;
             String commitAuthor = lastCommit.getAuthorIdent().getName();
             String commitMsg = lastCommit.getFullMessage();
 
             CommitInfo commitInfo = new CommitInfo();
             commitInfo.setCommitId(objectId.name().substring(0, 8));
-            commitInfo.setMsCommitTime(commitTime*1000);
+            commitInfo.setMsCommitTime(commitTime);
             commitInfo.setCommitAuthor(commitAuthor);
             if (commitMsg.length() > 1000) {
                 commitInfo.setCommitMsg(commitMsg.substring(0, 1000));