From 803978da494bf88ee60fb9598c94e25d601c5c32 Mon Sep 17 00:00:00 2001 From: Jaydeep Das Date: Mon, 11 Jul 2022 05:00:50 +0000 Subject: gpg-interface: add function for converting trust level to string Add new helper function `gpg_trust_level_to_str()` which will convert a given member of `enum signature_trust_level` to its corresponding string (in lowercase). For example, `TRUST_ULTIMATE` will yield the string "ultimate". This will abstract out some code in `pretty.c` relating to gpg signature trust levels. Mentored-by: Christian Couder Mentored-by: Hariom Verma Signed-off-by: Jaydeep Das Signed-off-by: Junio C Hamano --- gpg-interface.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gpg-interface.h') diff --git a/gpg-interface.h b/gpg-interface.h index b30cbdcd3d..8a9ef41779 100644 --- a/gpg-interface.h +++ b/gpg-interface.h @@ -71,6 +71,14 @@ size_t parse_signed_buffer(const char *buf, size_t size); int sign_buffer(struct strbuf *buffer, struct strbuf *signature, const char *signing_key); + +/* + * Returns corresponding string in lowercase for a given member of + * enum signature_trust_level. For example, `TRUST_ULTIMATE` will + * return "ultimate". + */ +const char *gpg_trust_level_to_str(enum signature_trust_level level); + int git_gpg_config(const char *, const char *, void *); void set_signing_key(const char *); const char *get_signing_key(void); -- cgit v1.2.3