]> source.dussan.org Git - jgit.git/commitdiff
PersonIdent: Preserve the timezone when copying with new time 08/1204408/1
authorIvan Frade <ifrade@google.com>
Wed, 20 Nov 2024 21:09:24 +0000 (13:09 -0800)
committerIvan Frade <ifrade@google.com>
Wed, 20 Nov 2024 21:09:24 +0000 (13:09 -0800)
The PersonIdent(PersonIdent,Date) constructor must create a copy with
the same author/email/timezone but different time.  When we changed
the implementation to the new Instant/ZoneId version, we forgot to
pass the timezone. This made fail some tests downstream.

Pass the timezone when constructing the copy.

Change-Id: Iaa979e6dbaa3c55d4c4d2040068ab8b03163cd4e

org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java

index 600fec42ca7fc2db10a9773a7fdb9739bb9acd10..5d3db9e6eed34fc49aba8566ff6eea7f1ff43ea4 100644 (file)
@@ -240,7 +240,8 @@ public class PersonIdent implements Serializable {
         */
        @Deprecated(since = "7.1")
        public PersonIdent(PersonIdent pi, Date aWhen) {
-               this(pi.getName(), pi.getEmailAddress(), aWhen.toInstant());
+               this(pi.getName(), pi.getEmailAddress(), aWhen.toInstant(),
+                               pi.tzOffset);
        }
 
        /**