Skip to content

Commit

Permalink
PersonIdent: Preserve the timezone when copying with new time
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ifradeo committed Nov 20, 2024
1 parent f072d2e commit ee8a414
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ public PersonIdent(PersonIdent pi, Instant when, ZoneId tz) {
*/
@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);
}

/**
Expand Down

0 comments on commit ee8a414

Please sign in to comment.