summaryrefslogtreecommitdiff
path: root/pretty.c
diff options
context:
space:
mode:
authorJaydeep Das <jaydeepjd.8914@gmail.com>2022-07-11 05:00:50 +0000
committerJunio C Hamano <gitster@pobox.com>2022-07-10 22:10:23 -0700
commit803978da494bf88ee60fb9598c94e25d601c5c32 (patch)
tree4ec50d9478d223bc31f4204eec256279cc18d3eb /pretty.c
parente4a4b31577c7419497ac30cebe30d755b97752c5 (diff)
downloadgit-803978da494bf88ee60fb9598c94e25d601c5c32.tar.gz
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 <chriscool@tuxfamily.org> Mentored-by: Hariom Verma <hariom18599@gmail.com> Signed-off-by: Jaydeep Das <jaydeepjd.8914@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pretty.c')
-rw-r--r--pretty.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/pretty.c b/pretty.c
index ee6114e3f0..6d819103fb 100644
--- a/pretty.c
+++ b/pretty.c
@@ -1575,23 +1575,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
strbuf_addstr(sb, c->signature_check.primary_key_fingerprint);
break;
case 'T':
- switch (c->signature_check.trust_level) {
- case TRUST_UNDEFINED:
- strbuf_addstr(sb, "undefined");
- break;
- case TRUST_NEVER:
- strbuf_addstr(sb, "never");
- break;
- case TRUST_MARGINAL:
- strbuf_addstr(sb, "marginal");
- break;
- case TRUST_FULLY:
- strbuf_addstr(sb, "fully");
- break;
- case TRUST_ULTIMATE:
- strbuf_addstr(sb, "ultimate");
- break;
- }
+ strbuf_addstr(sb, gpg_trust_level_to_str(c->signature_check.trust_level));
break;
default:
return 0;