Subject: [PATCH 3/4] verify_tag: use repo_dwim_ref() to get ref fullname and ref_flags

From: "ZheNing Hu via GitGitGadget" <[email-masked]>
Date: Mon, 20 Sep 2021 07:37:55 +0000

From: ZheNing Hu <[email-masked]>

Since verify-tag cannot currently use %(symref) correctly, we need
to get the ref flags from pretty_print_ref() caller. So use
repo_dwim_ref() in cmd_verify_tag() to get fullref name and ref flags
and pass to pretty_print_ref(), which can help us fix %(symref)
feature.

Signed-off-by: ZheNing Hu <[email-masked]>
---
 builtin/verify-tag.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/builtin/verify-tag.c b/builtin/verify-tag.c
index 403f2080efa..efc8282782a 100644
--- a/builtin/verify-tag.c
+++ b/builtin/verify-tag.c
@@ -59,6 +59,8 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix)
 	while (i < argc) {
 		struct object_id oid;
 		const char *name = argv[i++];
+		char *refname;
+		int ref_flags;
 
 		if (get_oid(name, &oid)) {
 			had_error = !!error("tag '%s' not found.", name);
@@ -70,8 +72,10 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix)
 			continue;
 		}
 
+		if (repo_dwim_ref(the_repository, name, strlen(name), &oid, &refname, 0, &ref_flags, 1))
+			name = refname;
 		if (format.format)
-			pretty_print_ref(name, &oid, &format, 0);
+			pretty_print_ref(name, &oid, &format, ref_flags);
 	}
 	return had_error;
 }
-- 
gitgitgadget