diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2025-03-04 15:14:53 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2025-03-04 15:14:53 +0100 |
commit | 2c90335a9d70d1a7b175b592e3a6582431e827f2 (patch) | |
tree | 4654d0bfae927e0ab87912b22ed6b4e600cdbef3 /org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java | |
parent | 026d46de13eb2321c18045469f27b065ba107ff5 (diff) | |
parent | 2a3e1191ea8062038a3d11de99d1549678c35d61 (diff) | |
download | jgit-next.tar.gz jgit-next.zip |
Merge branch 'master' into nextnext
* master: (497 commits)
Prepare 7.3.0-SNAPSHOT builds
Prepare 7.2.1-SNAPSHOT builds
JGit v7.2.0.202503040940-r
JGit v7.2.0.202503040805-r
CacheRegion: fix non translatable text warnings
Ensure access to autoRefresh is thread-safe
FileReftableStack: use FileSnapshot to detect modification
FileReftableDatabase: consider ref updates by another process
BlameRegionMerger: report invalid regions with checked exception.
Prepare 7.2.0-SNAPSHOT builds
[ssh known_hosts] Handle unknown keys better
[releng] Remove unused target platform definitions
JGit v7.2.0.202502261823-rc1
[ssh known_hosts] Handle host certificates
[ssh known_hosts] Improve updating modified keys
[ssh known_hosts] Add tests and fix problems
[ssh, releng] Remove net.i2p.crypto.eddsa
AddCommand: Use parenthesis to make the operator precedence explicit
AddCommand: implement --all/--no-all
Do not load bitmap indexes during directory scans
...
Change-Id: I619c89071f5f7a05bcd0218840f7f47bd19b779d
Diffstat (limited to 'org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java')
-rw-r--r-- | org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java | 57 |
1 files changed, 25 insertions, 32 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java index 4feb090032..a3a6782a71 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java @@ -14,11 +14,10 @@ package org.eclipse.jgit.pgm; import java.io.BufferedOutputStream; import java.io.IOException; -import java.text.DateFormat; import java.text.MessageFormat; -import java.text.SimpleDateFormat; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; import java.util.Locale; -import java.util.TimeZone; import org.eclipse.jgit.diff.DiffFormatter; import org.eclipse.jgit.diff.RawTextComparator; @@ -30,12 +29,11 @@ import org.eclipse.jgit.errors.RevisionSyntaxException; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.FileMode; import org.eclipse.jgit.lib.GpgConfig; -import org.eclipse.jgit.lib.GpgSignatureVerifier; -import org.eclipse.jgit.lib.GpgSignatureVerifierFactory; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.PersonIdent; import org.eclipse.jgit.lib.Repository; -import org.eclipse.jgit.lib.GpgSignatureVerifier.SignatureVerification; +import org.eclipse.jgit.lib.SignatureVerifier.SignatureVerification; +import org.eclipse.jgit.lib.SignatureVerifiers; import org.eclipse.jgit.pgm.internal.CLIText; import org.eclipse.jgit.pgm.internal.VerificationUtils; import org.eclipse.jgit.pgm.opt.PathTreeFilterHandler; @@ -52,9 +50,9 @@ import org.kohsuke.args4j.Option; @Command(common = true, usage = "usage_show") class Show extends TextBuiltin { - private final TimeZone myTZ = TimeZone.getDefault(); + private final ZoneId myTZ = ZoneId.systemDefault(); - private final DateFormat fmt; + private final DateTimeFormatter fmt; private DiffFormatter diffFmt; @@ -158,7 +156,8 @@ class Show extends TextBuiltin { // END -- Options shared with Diff Show() { - fmt = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy ZZZZZ", Locale.US); //$NON-NLS-1$ + fmt = DateTimeFormatter.ofPattern("EEE MMM dd HH:mm:ss yyyy ZZ", //$NON-NLS-1$ + Locale.US); } @Override @@ -233,15 +232,17 @@ class Show extends TextBuiltin { outw.print(tag.getTagName()); outw.println(); - final PersonIdent tagger = tag.getTaggerIdent(); + PersonIdent tagger = tag.getTaggerIdent(); if (tagger != null) { outw.println(MessageFormat.format(CLIText.get().taggerInfo, tagger.getName(), tagger.getEmailAddress())); - final TimeZone taggerTZ = tagger.getTimeZone(); - fmt.setTimeZone(taggerTZ != null ? taggerTZ : myTZ); + ZoneId taggerTZ = tagger.getZoneId(); + String formattedTaggerTime = fmt + .withZone(taggerTZ != null ? taggerTZ : myTZ) + .format(tagger.getWhenAsInstant()); outw.println(MessageFormat.format(CLIText.get().dateInfo, - fmt.format(tagger.getWhen()))); + formattedTaggerTime)); } outw.println(); @@ -294,10 +295,12 @@ class Show extends TextBuiltin { outw.println(MessageFormat.format(CLIText.get().authorInfo, author.getName(), author.getEmailAddress())); - final TimeZone authorTZ = author.getTimeZone(); - fmt.setTimeZone(authorTZ != null ? authorTZ : myTZ); + final ZoneId authorTZ = author.getZoneId(); + String formattedAuthorTime = fmt + .withZone(authorTZ != null ? authorTZ : myTZ) + .format(author.getWhenAsInstant()); outw.println(MessageFormat.format(CLIText.get().dateInfo, - fmt.format(author.getWhen()))); + formattedAuthorTime)); outw.println(); final String[] lines = c.getFullMessage().split("\n"); //$NON-NLS-1$ @@ -335,23 +338,13 @@ class Show extends TextBuiltin { if (c.getRawGpgSignature() == null) { return; } - GpgSignatureVerifierFactory factory = GpgSignatureVerifierFactory - .getDefault(); - if (factory == null) { - throw die(CLIText.get().logNoSignatureVerifier, null); - } - GpgSignatureVerifier verifier = factory.getVerifier(); GpgConfig config = new GpgConfig(db.getConfig()); - try { - SignatureVerification verification = verifier.verifySignature(c, - config); - if (verification == null) { - return; - } - VerificationUtils.writeVerification(outw, verification, - verifier.getName(), c.getCommitterIdent()); - } finally { - verifier.clear(); + SignatureVerification verification = SignatureVerifiers.verify(db, + config, c); + if (verification == null) { + throw die(CLIText.get().logNoSignatureVerifier, null); } + VerificationUtils.writeVerification(outw, verification, + verification.verifierName(), c.getCommitterIdent()); } } |