From ee8a4149135284e2319cb5c64de8387a3334bcdd Mon Sep 17 00:00:00 2001
From: Ivan Frade <ifrade@google.com>
Date: Wed, 20 Nov 2024 13:09:24 -0800
Subject: [PATCH] PersonIdent: Preserve the timezone when copying with new time

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 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java
index 600fec42c..5d3db9e6e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java
@@ -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);
 	}
 
 	/**
-- 
GitLab