From d3ff5b4e3e52e396d89aa9622aeff8aced61dc77 Mon Sep 17 00:00:00 2001 From: Luca Milanesio Date: Fri, 26 Apr 2024 01:20:25 +0100 Subject: [PATCH] Introduce GPG_SIGNATURE_PREFIX constant Change-Id: If6cabae76d7b38ce26fca534da6fe13973ebbf4f --- org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java | 7 +++++++ org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevTag.java | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java index 60a23dde05..1835dc76a2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java @@ -493,6 +493,13 @@ public final class Constants { */ public static final String ATTR_BUILTIN_BINARY_MERGER = "binary"; //$NON-NLS-1$ + /** + * Prefix of a GPG signature. + * + * @since 7.0 + */ + public static final String GPG_SIGNATURE_PREFIX = "-----BEGIN PGP SIGNATURE-----"; //$NON-NLS-1$ + /** * Create a new digest function for objects. * diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevTag.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevTag.java index 75dbd57740..5b50c2afd7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevTag.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevTag.java @@ -13,6 +13,7 @@ package org.eclipse.jgit.revwalk; import static java.nio.charset.StandardCharsets.UTF_8; +import static org.eclipse.jgit.lib.Constants.GPG_SIGNATURE_PREFIX; import java.io.IOException; import java.nio.charset.Charset; @@ -39,7 +40,7 @@ import org.eclipse.jgit.util.StringUtils; public class RevTag extends RevObject { private static final byte[] hSignature = Constants - .encodeASCII("-----BEGIN PGP SIGNATURE-----"); //$NON-NLS-1$ + .encodeASCII(GPG_SIGNATURE_PREFIX); /** * Parse an annotated tag from its canonical format. -- 2.39.5