]> source.dussan.org Git - jgit.git/commit
PersonIdent: Use java.time instead of older Date and milliseconds 42/1204142/9
authorIvan Frade <ifrade@google.com>
Fri, 15 Nov 2024 18:26:21 +0000 (10:26 -0800)
committerMatthias Sohn <matthias.sohn@sap.com>
Tue, 19 Nov 2024 12:00:58 +0000 (13:00 +0100)
commit92b35db291b5c661037b2724ac40488dbb44f52d
tree403ae4afa1bc9478aa1bdfce958214fb4c7fdfc0
parent307ef6b4b51f5f9266f6212015a9b5a1f1e75df4
PersonIdent: Use java.time instead of older Date and milliseconds

From errorprone: Date has a bad API that leads to bugs; prefer
java.time.Instant or LocalDate.

Replace the long with milliseconds and int with minutes offset with an
Instant and a ZoneOffset. Create new constructors and deprecate
variants with Date, milliseconds and minute offsets.

When comparing instances of PersonIdent truncate the timestamp precision
to 1 second since git commit timestamps are persisted with 1 second
precision [1].

[1] https://git-scm.com/docs/git-commit#Documentation/git-commit.txt-Gitinternalformat

Change-Id: Id4ba1f108e1ba0bfcdd87ba37c67e2d3cc7d254f
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/PersonIdentTest.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java