From 5b6caf05770aca3771f0136586b7d809cbc1286d Mon Sep 17 00:00:00 2001 From: logical-1985516 Date: Sat, 6 Jul 2024 23:51:58 +0800 Subject: [PATCH] Change milliseconds to seconds --- src/main/java/reposense/authorship/FileInfoAnalyzer.java | 5 ++--- .../reposense/authorship/analyzer/AuthorshipAnalyzer.java | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/reposense/authorship/FileInfoAnalyzer.java b/src/main/java/reposense/authorship/FileInfoAnalyzer.java index c85de08236..df61805523 100644 --- a/src/main/java/reposense/authorship/FileInfoAnalyzer.java +++ b/src/main/java/reposense/authorship/FileInfoAnalyzer.java @@ -163,9 +163,8 @@ private void aggregateBlameAuthorModifiedAndDateInfo(RepoConfiguration config, F GitBlameLineInfo blameLineInfo = GitBlame.blameLine(config.getRepoRoot(), "", fileInfo.getPath(), lineNumber + 1); // line numbers in git are 1-indexed String commitHash = blameLineInfo.getCommitHash(); - long commitDateInMs = blameLineInfo.getTimestampInSeconds() * 1000; - LocalDateTime commitDate = LocalDateTime.ofInstant(Instant.ofEpochMilli(commitDateInMs), - config.getZoneId()); + LocalDateTime commitDate = LocalDateTime.ofInstant( + Instant.ofEpochSecond(blameLineInfo.getTimestampInSeconds()), config.getZoneId()); Author author = config.getAuthor(blameLineInfo.getAuthorName(), blameLineInfo.getAuthorEmail()); if (!fileInfo.isFileLineTracked(lineNumber) || author.isIgnoringFile(filePath) diff --git a/src/main/java/reposense/authorship/analyzer/AuthorshipAnalyzer.java b/src/main/java/reposense/authorship/analyzer/AuthorshipAnalyzer.java index 83568373b6..736ba7985d 100644 --- a/src/main/java/reposense/authorship/analyzer/AuthorshipAnalyzer.java +++ b/src/main/java/reposense/authorship/analyzer/AuthorshipAnalyzer.java @@ -73,11 +73,11 @@ public static boolean analyzeAuthorship(RepoConfiguration config, String filePat GitBlameLineInfo deletedLineInfo = GitBlame.blameLine(config.getRepoRoot(), deletedLine.getGitBlameCommitHash(), deletedLine.getFilePath(), deletedLine.getLineNumber()); Author previousAuthor = config.getAuthor(deletedLineInfo.getAuthorName(), deletedLineInfo.getAuthorEmail()); - long sinceDateInMilliseconds = ZonedDateTime.of(config.getSinceDate(), config.getZoneId()).toEpochSecond(); + long sinceDateInSeconds = ZonedDateTime.of(config.getSinceDate(), config.getZoneId()).toEpochSecond(); // Give full credit if author is unknown, is before since date, is in ignored list, or is an ignored file if (previousAuthor.equals(Author.UNKNOWN_AUTHOR) - || deletedLineInfo.getTimestampInSeconds() < sinceDateInMilliseconds + || deletedLineInfo.getTimestampInSeconds() < sinceDateInSeconds || CommitHash.isInsideCommitList(deletedLineInfo.getCommitHash(), config.getIgnoreCommitList()) || previousAuthor.isIgnoringFile(Paths.get(deletedLine.getFilePath()))) { return true;