1
1
mirror of https://github.com/orhun/git-cliff.git synced 2024-12-01 21:05:17 +03:00

feat(changelog): skip ssh and x509 signatures in tag messages (#748)

Git supports SSH and x509 signatures in addition to GPG signatures.
See <https://git-scm.com/docs/gitformat-signature#_description>.

The regex is not 100% accurate (e.g. this would allow `SSH MESSAGE`,
which is not part of the gitformat-signature description), but I
prioritized readability over correctness in this case (since the code is
for replacing text, not verifying the signature).
This commit is contained in:
Jonas Fierlings 2024-07-27 21:11:20 +02:00 committed by GitHub
parent 61a59c6ba1
commit ecbabbfb39
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -25,7 +25,8 @@ use url::Url;
/// Regex for replacing the signature part of a tag message.
static TAG_SIGNATURE_REGEX: Lazy<Regex> = lazy_regex!(
r"(?s)-----BEGIN PGP SIGNATURE-----(.*?)-----END PGP SIGNATURE-----"
// https://git-scm.com/docs/gitformat-signature#_description
r"(?s)-----BEGIN (PGP|SSH|SIGNED) (SIGNATURE|MESSAGE)-----(.*?)-----END (PGP|SSH|SIGNED) (SIGNATURE|MESSAGE)-----"
);
/// Wrapper for [`Repository`] type from git2.