{"thread":{"id":"44887","subject":"[PATCH v5 0/7] Add --format to tag verification","startedAt":"2017-01-15T18:47:29Z","lastAt":"2017-01-17T17:43:13Z","messageCount":21,"participants":["santiago@nyu.edu","Jeff King","Santiago Torres"],"isPatch":true,"patchVersion":5,"patchTotal":7},"messages":[{"id":"309445","messageId":"20170115184705.10376-1-santiago@nyu.edu","threadId":"44887","inReplyTo":null,"subject":"[PATCH v5 0/7] Add --format to tag verification","fromName":"","fromEmail":"santiago@nyu.edu","sentAt":"2017-01-15T18:46:58Z","receivedAt":"2017-01-15T18:47:29Z","isPatch":true,"sender":{"key":"santiago@nyu.edu","avatar":"https://avatars.githubusercontent.com/u/3579933?v=4"},"body":"From: Santiago Torres <santiago@nyu.edu>\n\nThis is the fifth iteration of [1][2][3][4], and as a result of the\ndiscussion in [5]. The main goal of this patch series is to bring\n--format to git tag verification so that upper-layer tools can inspect\nthe content of a tag and make decisions based on it.\n\nIn this re-woll we:\n\n* Squashed Peff's first patch[6] with the second patch of the series. The commit\n  message may need work.\n\n* Applied the relevant segment's of Peff's second patch[7] on the rest of the\n  series\n\n* Rebased so these patches apply to the tip of the master branch.\n\nThanks,\n-Santiago\n\n[1] http://public-inbox.org/git/20161007210721.20437-1-santiago@nyu.edu/\n[2] http://public-inbox.org/git/20160930221806.3398-1-santiago@nyu.edu/\n[3] http://public-inbox.org/git/20160922185317.349-1-santiago@nyu.edu/\n[4] http://public-inbox.org/git/20160926224233.32702-1-santiago@nyu.edu/\n[5] http://public-inbox.org/git/20160607195608.16643-1-santiago@nyu.edu/\n[6] http://public-inbox.org/git/20161019203546.dfqmi2czcxopgj6w@sigill.intra.peff.net/\n[7] http://public-inbox.org/git/20161019203943.epjxnfci7vcqg4xv@sigill.intra.peff.net/\n\nLukas Puehringer (4):\n  gpg-interface, tag: add GPG_VERIFY_QUIET flag\n  ref-filter: add function to print single ref_array_item\n  tag: add format specifier to gpg_verify_tag\n  builtin/tag: add --format argument for tag -v\n\nSantiago Torres (3):\n  builtin/verify-tag: add --format to verify-tag\n  t/t7030-verify-tag: Add --format specifier tests\n  t/t7004-tag: Add --format specifier tests\n\n Documentation/git-tag.txt        |  2 +-\n Documentation/git-verify-tag.txt |  2 +-\n builtin/tag.c                    | 32 ++++++++++++++++++++++----------\n builtin/verify-tag.c             | 13 +++++++++++--\n gpg-interface.h                  |  1 +\n ref-filter.c                     | 27 +++++++++++++++++++++------\n ref-filter.h                     |  7 +++++++\n t/t7004-tag.sh                   | 16 ++++++++++++++++\n t/t7030-verify-tag.sh            | 16 ++++++++++++++++\n tag.c                            | 22 +++++++++++++++-------\n tag.h                            |  4 ++--\n 11 files changed, 113 insertions(+), 29 deletions(-)\n\n-- \n2.11.0\n\n"},{"id":"309446","messageId":"20170115184705.10376-2-santiago@nyu.edu","threadId":"44887","inReplyTo":"20170115184705.10376-1-santiago@nyu.edu","subject":"[PATCH v5 1/7] gpg-interface, tag: add GPG_VERIFY_QUIET flag","fromName":"","fromEmail":"santiago@nyu.edu","sentAt":"2017-01-15T18:46:59Z","receivedAt":"2017-01-15T18:47:34Z","isPatch":true,"sender":{"key":"santiago@nyu.edu","avatar":"https://avatars.githubusercontent.com/u/3579933?v=4"},"body":"From: Lukas Puehringer <luk.puehringer@gmail.com>\n\nFunctions that print git object information may require that the\ngpg-interface functions be silent. Add GPG_VERIFY_QUIET flag and prevent\nprint_signature_buffer from being called if flag is set.\n\nSigned-off-by: Lukas Puehringer <luk.puehringer@gmail.com>\n---\n gpg-interface.h | 1 +\n tag.c           | 5 ++++-\n 2 files changed, 5 insertions(+), 1 deletion(-)\n\ndiff --git a/gpg-interface.h b/gpg-interface.h\nindex ea68885ad..85dc9820d 100644\n--- a/gpg-interface.h\n+++ b/gpg-interface.h\n@@ -3,6 +3,7 @@\n \n #define GPG_VERIFY_VERBOSE\t1\n #define GPG_VERIFY_RAW\t\t2\n+#define GPG_VERIFY_QUIET\t4\n \n struct signature_check {\n \tchar *payload;\ndiff --git a/tag.c b/tag.c\nindex d1dcd18cd..291073f6e 100644\n--- a/tag.c\n+++ b/tag.c\n@@ -3,6 +3,7 @@\n #include \"commit.h\"\n #include \"tree.h\"\n #include \"blob.h\"\n+#include \"gpg-interface.h\"\n \n const char *tag_type = \"tag\";\n \n@@ -24,7 +25,9 @@ static int run_gpg_verify(const char *buf, unsigned long size, unsigned flags)\n \n \tret = check_signature(buf, payload_size, buf + payload_size,\n \t\t\t\tsize - payload_size, &sigc);\n-\tprint_signature_buffer(&sigc, flags);\n+\n+\tif (!(flags & GPG_VERIFY_QUIET))\n+\t\tprint_signature_buffer(&sigc, flags);\n \n \tsignature_check_clear(&sigc);\n \treturn ret;\n-- \n2.11.0\n\n"},{"id":"309447","messageId":"20170115184705.10376-3-santiago@nyu.edu","threadId":"44887","inReplyTo":"20170115184705.10376-1-santiago@nyu.edu","subject":"[PATCH v5 2/7] ref-filter: add function to print single ref_array_item","fromName":"","fromEmail":"santiago@nyu.edu","sentAt":"2017-01-15T18:47:00Z","receivedAt":"2017-01-15T18:47:36Z","isPatch":true,"sender":{"key":"santiago@nyu.edu","avatar":"https://avatars.githubusercontent.com/u/3579933?v=4"},"body":"From: Lukas Puehringer <luk.puehringer@gmail.com>\n\nref-filter functions are useful for printing git object information\nusing a format specifier. However, some other modules may not want to use\nthis functionality on a ref-array but only print a single item.\n\nExpose a pretty_print_ref function to create, pretty print and free\nindividual ref-items.\n\nSigned-off-by: Lukas Puehringer <luk.puehringer@gmail.com>\n---\n ref-filter.c | 27 +++++++++++++++++++++------\n ref-filter.h |  7 +++++++\n 2 files changed, 28 insertions(+), 6 deletions(-)\n\ndiff --git a/ref-filter.c b/ref-filter.c\nindex 1a978405e..5f4b08792 100644\n--- a/ref-filter.c\n+++ b/ref-filter.c\n@@ -1361,7 +1361,7 @@ static struct ref_array_item *new_ref_array_item(const char *refname,\n \treturn ref;\n }\n \n-static int filter_ref_kind(struct ref_filter *filter, const char *refname)\n+static int ref_kind_from_refname(const char *refname)\n {\n \tunsigned int i;\n \n@@ -1374,11 +1374,7 @@ static int filter_ref_kind(struct ref_filter *filter, const char *refname)\n \t\t{ \"refs/tags/\", FILTER_REFS_TAGS}\n \t};\n \n-\tif (filter->kind == FILTER_REFS_BRANCHES ||\n-\t    filter->kind == FILTER_REFS_REMOTES ||\n-\t    filter->kind == FILTER_REFS_TAGS)\n-\t\treturn filter->kind;\n-\telse if (!strcmp(refname, \"HEAD\"))\n+\tif (!strcmp(refname, \"HEAD\"))\n \t\treturn FILTER_REFS_DETACHED_HEAD;\n \n \tfor (i = 0; i < ARRAY_SIZE(ref_kind); i++) {\n@@ -1389,6 +1385,15 @@ static int filter_ref_kind(struct ref_filter *filter, const char *refname)\n \treturn FILTER_REFS_OTHERS;\n }\n \n+static int filter_ref_kind(struct ref_filter *filter, const char *refname)\n+{\n+\tif (filter->kind == FILTER_REFS_BRANCHES ||\n+\t    filter->kind == FILTER_REFS_REMOTES ||\n+\t    filter->kind == FILTER_REFS_TAGS)\n+\t\treturn filter->kind;\n+\treturn ref_kind_from_refname(refname);\n+}\n+\n /*\n  * A call-back given to for_each_ref().  Filter refs and keep them for\n  * later object processing.\n@@ -1671,6 +1676,16 @@ void show_ref_array_item(struct ref_array_item *info, const char *format, int qu\n \tputchar('\\n');\n }\n \n+void pretty_print_ref(const char *name, const unsigned char *sha1,\n+\t\tconst char *format)\n+{\n+\tstruct ref_array_item *ref_item;\n+\tref_item = new_ref_array_item(name, sha1, 0);\n+\tref_item->kind = ref_kind_from_refname(name);\n+\tshow_ref_array_item(ref_item, format, 0);\n+\tfree_array_item(ref_item);\n+}\n+\n /*  If no sorting option is given, use refname to sort as default */\n struct ref_sorting *ref_default_sorting(void)\n {\ndiff --git a/ref-filter.h b/ref-filter.h\nindex fc55fa357..7b05592ba 100644\n--- a/ref-filter.h\n+++ b/ref-filter.h\n@@ -109,4 +109,11 @@ struct ref_sorting *ref_default_sorting(void);\n /*  Function to parse --merged and --no-merged options */\n int parse_opt_merge_filter(const struct option *opt, const char *arg, int unset);\n \n+/*\n+ * Print a single ref, outside of any ref-filter. Note that the\n+ * name must be a fully qualified refname.\n+ */\n+void pretty_print_ref(const char *name, const unsigned char *sha1,\n+\t\tconst char *format);\n+\n #endif /*  REF_FILTER_H  */\n-- \n2.11.0\n\n"},{"id":"309448","messageId":"20170115184705.10376-8-santiago@nyu.edu","threadId":"44887","inReplyTo":"20170115184705.10376-1-santiago@nyu.edu","subject":"[PATCH v5 7/7] t/t7004-tag: Add --format specifier tests","fromName":"","fromEmail":"santiago@nyu.edu","sentAt":"2017-01-15T18:47:05Z","receivedAt":"2017-01-15T18:47:47Z","isPatch":true,"sender":{"key":"santiago@nyu.edu","avatar":"https://avatars.githubusercontent.com/u/3579933?v=4"},"body":"From: Santiago Torres <santiago@nyu.edu>\n\ntag -v now supports --format specifiers to inspect the contents of a tag\nupon verification. Add two tests to ensure this behavior is respected in\nfuture changes.\n\nSigned-off-by: Santiago Torres <santiago@nyu.edu>\n---\n t/t7004-tag.sh | 16 ++++++++++++++++\n 1 file changed, 16 insertions(+)\n\ndiff --git a/t/t7004-tag.sh b/t/t7004-tag.sh\nindex 07869b0c0..b2b81f203 100755\n--- a/t/t7004-tag.sh\n+++ b/t/t7004-tag.sh\n@@ -874,6 +874,22 @@ test_expect_success GPG 'verifying a forged tag should fail' '\n \ttest_must_fail git tag -v forged-tag\n '\n \n+test_expect_success 'verifying a proper tag with --format pass and format accordingly' '\n+\tcat >expect <<-\\EOF \n+\ttagname : signed-tag\n+\tEOF &&\n+\tgit tag -v --format=\"tagname : %(tag)\" \"signed-tag\" >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'verifying a forged tag with --format fail and format accordingly' '\n+\tcat >expect <<-\\EOF \n+\ttagname : forged-tag\n+\tEOF &&\n+\ttest_must_fail git tag -v --format=\"tagname : %(tag)\" \"forged-tag\" >actual &&\n+\ttest_cmp expect actual\n+'\n+\n # blank and empty messages for signed tags:\n \n get_tag_header empty-signed-tag $commit commit $time >expect\n-- \n2.11.0\n\n"},{"id":"309449","messageId":"20170115184705.10376-7-santiago@nyu.edu","threadId":"44887","inReplyTo":"20170115184705.10376-1-santiago@nyu.edu","subject":"[PATCH v5 6/7] t/t7030-verify-tag: Add --format specifier tests","fromName":"","fromEmail":"santiago@nyu.edu","sentAt":"2017-01-15T18:47:04Z","receivedAt":"2017-01-15T18:47:50Z","isPatch":true,"sender":{"key":"santiago@nyu.edu","avatar":"https://avatars.githubusercontent.com/u/3579933?v=4"},"body":"From: Santiago Torres <santiago@nyu.edu>\n\nVerify-tag now provides --format specifiers to inspect and ensure the\ncontents of the tag are proper. We add two tests to ensure this\nfunctionality works as expected: the return value should indicate if\nverification passed, and the format specifiers must be respected.\n\nSigned-off-by: Santiago Torres <santiago@nyu.edu>\n---\n t/t7030-verify-tag.sh | 16 ++++++++++++++++\n 1 file changed, 16 insertions(+)\n\ndiff --git a/t/t7030-verify-tag.sh b/t/t7030-verify-tag.sh\nindex 07079a41c..d62ccbb98 100755\n--- a/t/t7030-verify-tag.sh\n+++ b/t/t7030-verify-tag.sh\n@@ -125,4 +125,20 @@ test_expect_success GPG 'verify multiple tags' '\n \ttest_cmp expect.stderr actual.stderr\n '\n \n+test_expect_success 'verifying tag with --format' '\n+\tcat >expect <<-\\EOF\n+\ttagname : fourth-signed\n+\tEOF &&\n+\tgit verify-tag --format=\"tagname : %(tag)\" \"fourth-signed\" >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'verifying a forged tag with --format fail and format accordingly' '\n+\tcat >expect <<-\\EOF\n+\ttagname : 7th forged-signed\n+\tEOF &&\n+\ttest_must_fail git verify-tag --format=\"tagname : %(tag)\" $(cat forged1.tag) >actual-forged &&\n+\ttest_cmp expect actual-forged\n+'\n+\n test_done\n-- \n2.11.0\n\n"},{"id":"309450","messageId":"20170115184705.10376-6-santiago@nyu.edu","threadId":"44887","inReplyTo":"20170115184705.10376-1-santiago@nyu.edu","subject":"[PATCH v5 5/7] builtin/tag: add --format argument for tag -v","fromName":"","fromEmail":"santiago@nyu.edu","sentAt":"2017-01-15T18:47:03Z","receivedAt":"2017-01-15T18:47:51Z","isPatch":true,"sender":{"key":"santiago@nyu.edu","avatar":"https://avatars.githubusercontent.com/u/3579933?v=4"},"body":"From: Lukas Puehringer <luk.puehringer@gmail.com>\n\nAdding --format to git tag -v mutes the default output of the GPG\nverification and instead prints the formatted tag object.\nThis allows callers to cross-check the tagname from refs/tags with\nthe tagname from the tag object header upon GPG verification.\n\nThe callback function for for_each_tag_name() didn't allow callers to\npass custom data to their callback functions. Add a new opaque pointer\nto each_tag_name_fn's parameter to allow this.\n\nSigned-off-by: Lukas Puehringer <luk.puehringer@gmail.com>\n---\n Documentation/git-tag.txt |  2 +-\n builtin/tag.c             | 32 ++++++++++++++++++++++----------\n 2 files changed, 23 insertions(+), 11 deletions(-)\n\ndiff --git a/Documentation/git-tag.txt b/Documentation/git-tag.txt\nindex 76cfe40d9..586aaa315 100644\n--- a/Documentation/git-tag.txt\n+++ b/Documentation/git-tag.txt\n@@ -15,7 +15,7 @@ SYNOPSIS\n 'git tag' [-n[<num>]] -l [--contains <commit>] [--points-at <object>]\n \t[--column[=<options>] | --no-column] [--create-reflog] [--sort=<key>]\n \t[--format=<format>] [--[no-]merged [<commit>]] [<pattern>...]\n-'git tag' -v <tagname>...\n+'git tag' -v [--format=<format>] <tagname>...\n \n DESCRIPTION\n -----------\ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex 880677df5..9da11e0c2 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -24,7 +24,7 @@ static const char * const git_tag_usage[] = {\n \tN_(\"git tag -d <tagname>...\"),\n \tN_(\"git tag -l [-n[<num>]] [--contains <commit>] [--points-at <object>]\"\n \t\t\"\\n\\t\\t[--format=<format>] [--[no-]merged [<commit>]] [<pattern>...]\"),\n-\tN_(\"git tag -v <tagname>...\"),\n+\tN_(\"git tag -v [--format=<format>] <tagname>...\"),\n \tNULL\n };\n \n@@ -66,15 +66,17 @@ static int list_tags(struct ref_filter *filter, struct ref_sorting *sorting, con\n }\n \n typedef int (*each_tag_name_fn)(const char *name, const char *ref,\n-\t\t\t\tconst unsigned char *sha1);\n+\t\t\t\tconst unsigned char *sha1, void *cb_data);\n \n-static int for_each_tag_name(const char **argv, each_tag_name_fn fn)\n+static int for_each_tag_name(const char **argv, each_tag_name_fn fn,\n+\t\tvoid *cb_data)\n {\n \tconst char **p;\n \tchar ref[PATH_MAX];\n \tint had_error = 0;\n \tunsigned char sha1[20];\n \n+\n \tfor (p = argv; *p; p++) {\n \t\tif (snprintf(ref, sizeof(ref), \"refs/tags/%s\", *p)\n \t\t\t\t\t>= sizeof(ref)) {\n@@ -87,14 +89,14 @@ static int for_each_tag_name(const char **argv, each_tag_name_fn fn)\n \t\t\thad_error = 1;\n \t\t\tcontinue;\n \t\t}\n-\t\tif (fn(*p, ref, sha1))\n+\t\tif (fn(*p, ref, sha1, cb_data))\n \t\t\thad_error = 1;\n \t}\n \treturn had_error;\n }\n \n static int delete_tag(const char *name, const char *ref,\n-\t\t\t\tconst unsigned char *sha1)\n+\t\t\t\tconst unsigned char *sha1, void *cb_data)\n {\n \tif (delete_ref(ref, sha1, 0))\n \t\treturn 1;\n@@ -103,9 +105,16 @@ static int delete_tag(const char *name, const char *ref,\n }\n \n static int verify_tag(const char *name, const char *ref,\n-\t\t\t\tconst unsigned char *sha1)\n+\t\t\t\tconst unsigned char *sha1, void *cb_data)\n {\n-\treturn verify_and_format_tag(sha1, name, NULL, GPG_VERIFY_VERBOSE);\n+\tint flags;\n+\tchar *fmt_pretty = cb_data;\n+\tflags = GPG_VERIFY_VERBOSE;\n+\n+\tif (fmt_pretty)\n+\t\tflags = GPG_VERIFY_QUIET;\n+\n+\treturn verify_and_format_tag(sha1, ref, fmt_pretty, flags);\n }\n \n static int do_sign(struct strbuf *buffer)\n@@ -428,9 +437,12 @@ int cmd_tag(int argc, const char **argv, const char *prefix)\n \tif (filter.merge_commit)\n \t\tdie(_(\"--merged and --no-merged option are only allowed with -l\"));\n \tif (cmdmode == 'd')\n-\t\treturn for_each_tag_name(argv, delete_tag);\n-\tif (cmdmode == 'v')\n-\t\treturn for_each_tag_name(argv, verify_tag);\n+\t\treturn for_each_tag_name(argv, delete_tag, NULL);\n+\tif (cmdmode == 'v') {\n+\t\tif (format)\n+\t\t\tverify_ref_format(format);\n+\t\treturn for_each_tag_name(argv, verify_tag, format);\n+\t}\n \n \tif (msg.given || msgfile) {\n \t\tif (msg.given && msgfile)\n-- \n2.11.0\n\n"},{"id":"309451","messageId":"20170115184705.10376-4-santiago@nyu.edu","threadId":"44887","inReplyTo":"20170115184705.10376-1-santiago@nyu.edu","subject":"[PATCH v5 3/7] tag: add format specifier to gpg_verify_tag","fromName":"","fromEmail":"santiago@nyu.edu","sentAt":"2017-01-15T18:47:01Z","receivedAt":"2017-01-15T18:47:53Z","isPatch":true,"sender":{"key":"santiago@nyu.edu","avatar":"https://avatars.githubusercontent.com/u/3579933?v=4"},"body":"From: Lukas Puehringer <luk.puehringer@gmail.com>\n\nCalling functions for gpg_verify_tag() may desire to print relevant\ninformation about the header for further verification. Add an optional\nformat argument to print any desired information after GPG verification.\n\nSigned-off-by: Lukas Puehringer <luk.puehringer@gmail.com>\n---\n builtin/tag.c        |  2 +-\n builtin/verify-tag.c |  2 +-\n tag.c                | 17 +++++++++++------\n tag.h                |  4 ++--\n 4 files changed, 15 insertions(+), 10 deletions(-)\n\ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex 73df72811..880677df5 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -105,7 +105,7 @@ static int delete_tag(const char *name, const char *ref,\n static int verify_tag(const char *name, const char *ref,\n \t\t\t\tconst unsigned char *sha1)\n {\n-\treturn gpg_verify_tag(sha1, name, GPG_VERIFY_VERBOSE);\n+\treturn verify_and_format_tag(sha1, name, NULL, GPG_VERIFY_VERBOSE);\n }\n \n static int do_sign(struct strbuf *buffer)\ndiff --git a/builtin/verify-tag.c b/builtin/verify-tag.c\nindex 99f8148cf..de10198c4 100644\n--- a/builtin/verify-tag.c\n+++ b/builtin/verify-tag.c\n@@ -51,7 +51,7 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix)\n \t\tconst char *name = argv[i++];\n \t\tif (get_sha1(name, sha1))\n \t\t\thad_error = !!error(\"tag '%s' not found.\", name);\n-\t\telse if (gpg_verify_tag(sha1, name, flags))\n+\t\telse if (verify_and_format_tag(sha1, name, NULL, flags))\n \t\t\thad_error = 1;\n \t}\n \treturn had_error;\ndiff --git a/tag.c b/tag.c\nindex 291073f6e..d5a7cfb20 100644\n--- a/tag.c\n+++ b/tag.c\n@@ -4,6 +4,7 @@\n #include \"tree.h\"\n #include \"blob.h\"\n #include \"gpg-interface.h\"\n+#include \"ref-filter.h\"\n \n const char *tag_type = \"tag\";\n \n@@ -33,8 +34,8 @@ static int run_gpg_verify(const char *buf, unsigned long size, unsigned flags)\n \treturn ret;\n }\n \n-int gpg_verify_tag(const unsigned char *sha1, const char *name_to_report,\n-\t\tunsigned flags)\n+int verify_and_format_tag(const unsigned char *sha1, const char *name,\n+\t\tconst char *fmt_pretty, unsigned flags)\n {\n \tenum object_type type;\n \tchar *buf;\n@@ -44,21 +45,25 @@ int gpg_verify_tag(const unsigned char *sha1, const char *name_to_report,\n \ttype = sha1_object_info(sha1, NULL);\n \tif (type != OBJ_TAG)\n \t\treturn error(\"%s: cannot verify a non-tag object of type %s.\",\n-\t\t\t\tname_to_report ?\n-\t\t\t\tname_to_report :\n+\t\t\t\tname ?\n+\t\t\t\tname :\n \t\t\t\tfind_unique_abbrev(sha1, DEFAULT_ABBREV),\n \t\t\t\ttypename(type));\n \n \tbuf = read_sha1_file(sha1, &type, &size);\n \tif (!buf)\n \t\treturn error(\"%s: unable to read file.\",\n-\t\t\t\tname_to_report ?\n-\t\t\t\tname_to_report :\n+\t\t\t\tname ?\n+\t\t\t\tname :\n \t\t\t\tfind_unique_abbrev(sha1, DEFAULT_ABBREV));\n \n \tret = run_gpg_verify(buf, size, flags);\n \n \tfree(buf);\n+\n+\tif (fmt_pretty)\n+\t\tpretty_print_ref(name, sha1, fmt_pretty);\n+\n \treturn ret;\n }\n \ndiff --git a/tag.h b/tag.h\nindex a5721b673..896b9c2dc 100644\n--- a/tag.h\n+++ b/tag.h\n@@ -17,7 +17,7 @@ extern int parse_tag_buffer(struct tag *item, const void *data, unsigned long si\n extern int parse_tag(struct tag *item);\n extern struct object *deref_tag(struct object *, const char *, int);\n extern struct object *deref_tag_noverify(struct object *);\n-extern int gpg_verify_tag(const unsigned char *sha1,\n-\t\tconst char *name_to_report, unsigned flags);\n+extern int verify_and_format_tag(const unsigned char *sha1, const char *name,\n+\t\tconst char *fmt_pretty, unsigned flags);\n \n #endif /* TAG_H */\n-- \n2.11.0\n\n"},{"id":"309452","messageId":"20170115184705.10376-5-santiago@nyu.edu","threadId":"44887","inReplyTo":"20170115184705.10376-1-santiago@nyu.edu","subject":"[PATCH v5 4/7] builtin/verify-tag: add --format to verify-tag","fromName":"","fromEmail":"santiago@nyu.edu","sentAt":"2017-01-15T18:47:02Z","receivedAt":"2017-01-15T18:47:54Z","isPatch":true,"sender":{"key":"santiago@nyu.edu","avatar":"https://avatars.githubusercontent.com/u/3579933?v=4"},"body":"From: Santiago Torres <santiago@nyu.edu>\n\nCallers of verify-tag may want to cross-check the tagname from refs/tags\nwith the tagname from the tag object header upon GPG verification. This\nis to avoid tag refs that point to an incorrect object.\n\nAdd a --format parameter to git verify-tag to print the formatted tag\nobject header in addition to or instead of the --verbose or --raw GPG\nverification output.\n\nSigned-off-by: Santiago Torres <santiago@nyu.edu>\n---\n Documentation/git-verify-tag.txt |  2 +-\n builtin/verify-tag.c             | 13 +++++++++++--\n 2 files changed, 12 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-verify-tag.txt b/Documentation/git-verify-tag.txt\nindex d590edceb..0b8075dad 100644\n--- a/Documentation/git-verify-tag.txt\n+++ b/Documentation/git-verify-tag.txt\n@@ -8,7 +8,7 @@ git-verify-tag - Check the GPG signature of tags\n SYNOPSIS\n --------\n [verse]\n-'git verify-tag' <tag>...\n+'git verify-tag' [--format=<format>] <tag>...\n \n DESCRIPTION\n -----------\ndiff --git a/builtin/verify-tag.c b/builtin/verify-tag.c\nindex de10198c4..212449f47 100644\n--- a/builtin/verify-tag.c\n+++ b/builtin/verify-tag.c\n@@ -12,12 +12,14 @@\n #include <signal.h>\n #include \"parse-options.h\"\n #include \"gpg-interface.h\"\n+#include \"ref-filter.h\"\n \n static const char * const verify_tag_usage[] = {\n-\t\tN_(\"git verify-tag [-v | --verbose] <tag>...\"),\n+\t\tN_(\"git verify-tag [-v | --verbose] [--format=<format>] <tag>...\"),\n \t\tNULL\n };\n \n+\n static int git_verify_tag_config(const char *var, const char *value, void *cb)\n {\n \tint status = git_gpg_config(var, value, cb);\n@@ -30,9 +32,11 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix)\n {\n \tint i = 1, verbose = 0, had_error = 0;\n \tunsigned flags = 0;\n+\tchar *fmt_pretty = NULL;\n \tconst struct option verify_tag_options[] = {\n \t\tOPT__VERBOSE(&verbose, N_(\"print tag contents\")),\n \t\tOPT_BIT(0, \"raw\", &flags, N_(\"print raw gpg status output\"), GPG_VERIFY_RAW),\n+\t\tOPT_STRING(  0 , \"format\", &fmt_pretty, N_(\"format\"), N_(\"format to use for the output\")),\n \t\tOPT_END()\n \t};\n \n@@ -46,12 +50,17 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix)\n \tif (verbose)\n \t\tflags |= GPG_VERIFY_VERBOSE;\n \n+\tif (fmt_pretty) {\n+\t\tverify_ref_format(fmt_pretty);\n+\t\tflags |= GPG_VERIFY_QUIET;\n+\t}\n+\n \twhile (i < argc) {\n \t\tunsigned char sha1[20];\n \t\tconst char *name = argv[i++];\n \t\tif (get_sha1(name, sha1))\n \t\t\thad_error = !!error(\"tag '%s' not found.\", name);\n-\t\telse if (verify_and_format_tag(sha1, name, NULL, flags))\n+\t\telse if (verify_and_format_tag(sha1, name, fmt_pretty, flags))\n \t\t\thad_error = 1;\n \t}\n \treturn had_error;\n-- \n2.11.0\n\n"},{"id":"309514","messageId":"20170117152455.k6zkeclsyawzpl2n@sigill.intra.peff.net","threadId":"44887","inReplyTo":"20170115184705.10376-4-santiago@nyu.edu","subject":"Re: [PATCH v5 3/7] tag: add format specifier to gpg_verify_tag","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-01-17T15:24:55Z","receivedAt":"2017-01-17T15:25:05Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Jan 15, 2017 at 01:47:01PM -0500, santiago@nyu.edu wrote:\n\n> From: Lukas Puehringer <luk.puehringer@gmail.com>\n> \n> Calling functions for gpg_verify_tag() may desire to print relevant\n> information about the header for further verification. Add an optional\n> format argument to print any desired information after GPG verification.\n\nHrm. Maybe I am missing something, but what does:\n\n  verify_and_format_tag(sha1, name, fmt, flags);\n\nget you over:\n\n  gpg_verify_tag(sha1, name, flags);\n  pretty_print_ref(name, sha1, fmt);\n\n? The latter seems much more flexible, and I do not see how the\nverification step impacts the printing at all (or vice versa).\n\nI could understand it more if there were patches later in the series\nthat somehow used the format and verification results together. But I\ndidn't see that.\n\n-Peff\n"},{"id":"309515","messageId":"20170117153019.gujiruwghkwfklgv@sigill.intra.peff.net","threadId":"44887","inReplyTo":"20170117152455.k6zkeclsyawzpl2n@sigill.intra.peff.net","subject":"Re: [PATCH v5 3/7] tag: add format specifier to gpg_verify_tag","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-01-17T15:30:19Z","receivedAt":"2017-01-17T15:30:33Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jan 17, 2017 at 10:24:55AM -0500, Jeff King wrote:\n\n> On Sun, Jan 15, 2017 at 01:47:01PM -0500, santiago@nyu.edu wrote:\n> \n> > From: Lukas Puehringer <luk.puehringer@gmail.com>\n> > \n> > Calling functions for gpg_verify_tag() may desire to print relevant\n> > information about the header for further verification. Add an optional\n> > format argument to print any desired information after GPG verification.\n> \n> Hrm. Maybe I am missing something, but what does:\n> \n>   verify_and_format_tag(sha1, name, fmt, flags);\n> \n> get you over:\n> \n>   gpg_verify_tag(sha1, name, flags);\n>   pretty_print_ref(name, sha1, fmt);\n> \n> ? The latter seems much more flexible, and I do not see how the\n> verification step impacts the printing at all (or vice versa).\n> \n> I could understand it more if there were patches later in the series\n> that somehow used the format and verification results together. But I\n> didn't see that.\n\nHaving read through the rest of the series, it looks like you'd\nsometimes have to do:\n\n  int ret;\n\n  ret = gpg_verify_tag(sha1, name, flags);\n  pretty_print_ref(name, sha1, fmt);\n  if (ret)\n      ... do something ...\n\nand this function lets you do it in a single line.\n\nStill, I think I'd rather see it done as a wrapper than modifying\ngpg_verify_tag().\n\n-Peff\n"},{"id":"309517","messageId":"20170117153404.jp3ftdlzeyut6e7a@sigill.intra.peff.net","threadId":"44887","inReplyTo":"20170115184705.10376-6-santiago@nyu.edu","subject":"Re: [PATCH v5 5/7] builtin/tag: add --format argument for tag -v","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-01-17T15:34:04Z","receivedAt":"2017-01-17T15:34:11Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Jan 15, 2017 at 01:47:03PM -0500, santiago@nyu.edu wrote:\n\n> -static int for_each_tag_name(const char **argv, each_tag_name_fn fn)\n> +static int for_each_tag_name(const char **argv, each_tag_name_fn fn,\n> +\t\tvoid *cb_data)\n>  {\n>  \tconst char **p;\n>  \tchar ref[PATH_MAX];\n>  \tint had_error = 0;\n>  \tunsigned char sha1[20];\n>  \n> +\n>  \tfor (p = argv; *p; p++) {\n>  \t\tif (snprintf(ref, sizeof(ref), \"refs/tags/%s\", *p)\n>  \t\t\t\t\t>= sizeof(ref)) {\n\nFunny extra line?\n\n>  {\n> -\treturn verify_and_format_tag(sha1, name, NULL, GPG_VERIFY_VERBOSE);\n> +\tint flags;\n> +\tchar *fmt_pretty = cb_data;\n> +\tflags = GPG_VERIFY_VERBOSE;\n> +\n> +\tif (fmt_pretty)\n> +\t\tflags = GPG_VERIFY_QUIET;\n> +\n> +\treturn verify_and_format_tag(sha1, ref, fmt_pretty, flags);\n\nIt seems funny that VERBOSE and QUIET are bit-flags. What happens when\nyou ask for GPG_VERIFY_VERBOSE|GPG_VERIFY_QUIET?\n\nI suppose this is actually not a problem in _this_ patch, but in the\nvery first one that adds the QUIET flag. I'm not sure if the problem is\nthat the options should be more orthogonal, or that they are just badly\nnamed to appear as opposites when they aren't.\n\n-Peff\n"},{"id":"309518","messageId":"20170117153507.vr3i6k5hl3whjorf@sigill.intra.peff.net","threadId":"44887","inReplyTo":"20170115184705.10376-8-santiago@nyu.edu","subject":"Re: [PATCH v5 7/7] t/t7004-tag: Add --format specifier tests","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-01-17T15:35:07Z","receivedAt":"2017-01-17T15:35:14Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Jan 15, 2017 at 01:47:05PM -0500, santiago@nyu.edu wrote:\n\n> From: Santiago Torres <santiago@nyu.edu>\n> \n> tag -v now supports --format specifiers to inspect the contents of a tag\n> upon verification. Add two tests to ensure this behavior is respected in\n> future changes.\n> \n> Signed-off-by: Santiago Torres <santiago@nyu.edu>\n> ---\n>  t/t7004-tag.sh | 16 ++++++++++++++++\n>  1 file changed, 16 insertions(+)\n> \n> diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh\n> index 07869b0c0..b2b81f203 100755\n> --- a/t/t7004-tag.sh\n> +++ b/t/t7004-tag.sh\n> @@ -874,6 +874,22 @@ test_expect_success GPG 'verifying a forged tag should fail' '\n>  \ttest_must_fail git tag -v forged-tag\n>  '\n>  \n> +test_expect_success 'verifying a proper tag with --format pass and format accordingly' '\n> +\tcat >expect <<-\\EOF \n\nTrailing whitespace after \"EOF\" here (and below). Otherwise the tests\nlook reasonable to me.\n\n-Peff\n"},{"id":"309519","messageId":"20170117153602.qfit46fdc4j4rhao@sigill.intra.peff.net","threadId":"44887","inReplyTo":"20170115184705.10376-1-santiago@nyu.edu","subject":"Re: [PATCH v5 0/7] Add --format to tag verification","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-01-17T15:36:02Z","receivedAt":"2017-01-17T15:36:10Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Jan 15, 2017 at 01:46:58PM -0500, santiago@nyu.edu wrote:\n\n> From: Santiago Torres <santiago@nyu.edu>\n> \n> This is the fifth iteration of [1][2][3][4], and as a result of the\n> discussion in [5]. The main goal of this patch series is to bring\n> --format to git tag verification so that upper-layer tools can inspect\n> the content of a tag and make decisions based on it.\n\nThanks for picking this back up.  I didn't see any bugs, but I had a few\ninterface nits, which I sent inline.\n\n-Peff\n"},{"id":"309525","messageId":"20170117165724.2hbyfdzrhrmro54b@LykOS.localdomain","threadId":"44887","inReplyTo":"20170117153019.gujiruwghkwfklgv@sigill.intra.peff.net","subject":"Re: [PATCH v5 3/7] tag: add format specifier to gpg_verify_tag","fromName":"Santiago Torres","fromEmail":"santiago@nyu.edu","sentAt":"2017-01-17T16:57:25Z","receivedAt":"2017-01-17T16:57:37Z","isPatch":true,"sender":{"key":"santiago@nyu.edu","avatar":"https://avatars.githubusercontent.com/u/3579933?v=4"},"body":""},{"id":"309526","messageId":"20170117170018.nqk4yy5rrpomxr32@LykOS.localdomain","threadId":"44887","inReplyTo":"20170117153404.jp3ftdlzeyut6e7a@sigill.intra.peff.net","subject":"Re: [PATCH v5 5/7] builtin/tag: add --format argument for tag -v","fromName":"Santiago Torres","fromEmail":"santiago@nyu.edu","sentAt":"2017-01-17T17:00:19Z","receivedAt":"2017-01-17T17:08:07Z","isPatch":true,"sender":{"key":"santiago@nyu.edu","avatar":"https://avatars.githubusercontent.com/u/3579933?v=4"},"body":""},{"id":"309527","messageId":"20170117172531.bahjekbj3om43gtq@sigill.intra.peff.net","threadId":"44887","inReplyTo":"20170117165724.2hbyfdzrhrmro54b@LykOS.localdomain","subject":"Re: [PATCH v5 3/7] tag: add format specifier to gpg_verify_tag","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-01-17T17:25:31Z","receivedAt":"2017-01-17T17:26:36Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jan 17, 2017 at 11:57:25AM -0500, Santiago Torres wrote:\n\n> > Having read through the rest of the series, it looks like you'd\n> > sometimes have to do:\n> \n> IIRC, we did this to make the diff \"simpler\". It also feeds odd that the\n> call chain is the following:\n> \n>     verify_and_format_tag()\n>     gpg_verify_tag()\n>     run_gpg_verification()\n> \n> I'm afraid that adding yet another wrapper would further convolute the\n> call chain. If you think this is not an issue, I could easily do it. Do\n> you have any suggested name for the wrapper?\n\nActually, looking at the callsites, I think they are fine to just call\npretty_print_ref() themselves, and I don't think it actually matters if\nit happens before or after the verification.\n\nSo I think you could just throw out patch 3 entirely and squash these\nhunks into patches 4 and 5:\n\ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex 9da11e0c2..fab9fa8f9 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -111,10 +111,12 @@ static int verify_tag(const char *name, const char *ref,\n \tchar *fmt_pretty = cb_data;\n \tflags = GPG_VERIFY_VERBOSE;\n \n-\tif (fmt_pretty)\n+\tif (fmt_pretty) {\n \t\tflags = GPG_VERIFY_QUIET;\n+\t\tpretty_print_ref(name, sha1, fmt_pretty);\n+\t}\n \n-\treturn verify_and_format_tag(sha1, ref, fmt_pretty, flags);\n+\treturn gpg_verify_tag(sha1, ref, flags);\n }\n \n static int do_sign(struct strbuf *buffer)\ndiff --git a/builtin/verify-tag.c b/builtin/verify-tag.c\nindex 212449f47..114df1c52 100644\n--- a/builtin/verify-tag.c\n+++ b/builtin/verify-tag.c\n@@ -58,9 +58,15 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix)\n \twhile (i < argc) {\n \t\tunsigned char sha1[20];\n \t\tconst char *name = argv[i++];\n-\t\tif (get_sha1(name, sha1))\n+\n+\t\tif (get_sha1(name, sha1)) {\n \t\t\thad_error = !!error(\"tag '%s' not found.\", name);\n-\t\telse if (verify_and_format_tag(sha1, name, fmt_pretty, flags))\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tif (fmt_pretty)\n+\t\t\tpretty_print_ref(name, sha1, fmt_pretty);\n+\t\tif (gpg_verify_tag(sha1, name, flags))\n \t\t\thad_error = 1;\n \t}\n \treturn had_error;\n\nYou could make the diff in the second one simpler by skipping the\n\"continue\" and just doing the whole thing in an \"else\" block. But IMHO\nthe continue-on-error makes the logic more clear.\n\n-Peff\n"},{"id":"309528","messageId":"20170117173003.sgipqc2cijpdrukb@sigill.intra.peff.net","threadId":"44887","inReplyTo":"20170117172531.bahjekbj3om43gtq@sigill.intra.peff.net","subject":"Re: [PATCH v5 3/7] tag: add format specifier to gpg_verify_tag","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-01-17T17:30:04Z","receivedAt":"2017-01-17T17:30:17Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jan 17, 2017 at 12:25:31PM -0500, Jeff King wrote:\n\n> Actually, looking at the callsites, I think they are fine to just call\n> pretty_print_ref() themselves, and I don't think it actually matters if\n> it happens before or after the verification.\n\nOh, sorry, I misread it. We do indeed early-return from the verification\nand skip the printing in that case. So it'd be more like:\n\ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex 9da11e0c2..068f392b6 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -114,7 +114,11 @@ static int verify_tag(const char *name, const char *ref,\n \tif (fmt_pretty)\n \t\tflags = GPG_VERIFY_QUIET;\n \n-\treturn verify_and_format_tag(sha1, ref, fmt_pretty, flags);\n+\tif (gpg_verify_tag(sha1, ref, flags))\n+\t\treturn -1;\n+\n+\tpretty_print_ref(name, sha1, fmt_pretty);\n+\treturn 0;\n }\n \n static int do_sign(struct strbuf *buffer)\ndiff --git a/builtin/verify-tag.c b/builtin/verify-tag.c\nindex 212449f47..b3f08f705 100644\n--- a/builtin/verify-tag.c\n+++ b/builtin/verify-tag.c\n@@ -58,10 +58,19 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix)\n \twhile (i < argc) {\n \t\tunsigned char sha1[20];\n \t\tconst char *name = argv[i++];\n-\t\tif (get_sha1(name, sha1))\n+\n+\t\tif (get_sha1(name, sha1)) {\n \t\t\thad_error = !!error(\"tag '%s' not found.\", name);\n-\t\telse if (verify_and_format_tag(sha1, name, fmt_pretty, flags))\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tif (gpg_verify_tag(sha1, name, flags)) {\n \t\t\thad_error = 1;\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tif (fmt_pretty)\n+\t\t\tpretty_print_ref(name, sha1, fmt_pretty);\n \t}\n \treturn had_error;\n }\n\nwhich I think is still an improvement (the printing, rather than being\nan obscure parameter to the overloaded verify_and_format_tag()\nfunction, is clearly a first-class operation).\n\n-Peff\n"},{"id":"309529","messageId":"20170117173239.ir6jxbz46vwwzoht@sigill.intra.peff.net","threadId":"44887","inReplyTo":"20170117170018.nqk4yy5rrpomxr32@LykOS.localdomain","subject":"Re: [PATCH v5 5/7] builtin/tag: add --format argument for tag -v","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-01-17T17:32:39Z","receivedAt":"2017-01-17T17:39:32Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jan 17, 2017 at 12:00:19PM -0500, Santiago Torres wrote:\n\n> > >  {\n> > > -\treturn verify_and_format_tag(sha1, name, NULL, GPG_VERIFY_VERBOSE);\n> > > +\tint flags;\n> > > +\tchar *fmt_pretty = cb_data;\n> > > +\tflags = GPG_VERIFY_VERBOSE;\n> > > +\n> > > +\tif (fmt_pretty)\n> > > +\t\tflags = GPG_VERIFY_QUIET;\n> > > +\n> > > +\treturn verify_and_format_tag(sha1, ref, fmt_pretty, flags);\n> > \n> > It seems funny that VERBOSE and QUIET are bit-flags. What happens when\n> > you ask for GPG_VERIFY_VERBOSE|GPG_VERIFY_QUIET?\n> \n> If I'm not mistaken, the way the code works right now this is not\n> possible (GPG_VERIFY_VERBOSE will be unset when GPG_VERIFY_QUIET). I\n> would have to re-read the patch to make sure this is the case then.\n\nNo, you're right that the two flags are mutually exclusive in the\ncurrent callers. So I don't think there's a bug here. It's just that the\ninterface is potentially awkward/confusing, which may be a problem down\nthe line.\n\nVERBOSE|QUIET _does_ have a meaning, which is \"show the payload, but do\nnot print the signature buffer\". Perhaps just renaming QUIET to\nOMIT_STATUS or something would make it more clear.\n\n-Peff\n"},{"id":"309530","messageId":"20170117173433.dhz5payccjog4o6s@sigill.intra.peff.net","threadId":"44887","inReplyTo":"20170117173346.paqrsroauoskxpn6@LykOS.localdomain","subject":"Re: [PATCH v5 3/7] tag: add format specifier to gpg_verify_tag","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-01-17T17:34:33Z","receivedAt":"2017-01-17T17:41:31Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jan 17, 2017 at 12:33:46PM -0500, Santiago Torres wrote:\n\n> Yeah, this actually looks more cleaner.\n> \n> Let me give it a go.\n\nNeat. Note there's a bug:\n\n> > diff --git a/builtin/tag.c b/builtin/tag.c\n> > index 9da11e0c2..068f392b6 100644\n> > --- a/builtin/tag.c\n> > +++ b/builtin/tag.c\n> > @@ -114,7 +114,11 @@ static int verify_tag(const char *name, const char *ref,\n> >  \tif (fmt_pretty)\n> >  \t\tflags = GPG_VERIFY_QUIET;\n> >  \n> > -\treturn verify_and_format_tag(sha1, ref, fmt_pretty, flags);\n> > +\tif (gpg_verify_tag(sha1, ref, flags))\n> > +\t\treturn -1;\n> > +\n> > +\tpretty_print_ref(name, sha1, fmt_pretty);\n> > +\treturn 0;\n\nThe final print should be guarded by \"if (fmt_pretty)\".\n\n-Peff\n"},{"id":"309531","messageId":"20170117173346.paqrsroauoskxpn6@LykOS.localdomain","threadId":"44887","inReplyTo":"20170117173003.sgipqc2cijpdrukb@sigill.intra.peff.net","subject":"Re: [PATCH v5 3/7] tag: add format specifier to gpg_verify_tag","fromName":"Santiago Torres","fromEmail":"santiago@nyu.edu","sentAt":"2017-01-17T17:33:46Z","receivedAt":"2017-01-17T17:41:45Z","isPatch":true,"sender":{"key":"santiago@nyu.edu","avatar":"https://avatars.githubusercontent.com/u/3579933?v=4"},"body":""},{"id":"309532","messageId":"20170117173427.sq3kpo4jls6setkf@LykOS.localdomain","threadId":"44887","inReplyTo":"20170117173239.ir6jxbz46vwwzoht@sigill.intra.peff.net","subject":"Re: [PATCH v5 5/7] builtin/tag: add --format argument for tag -v","fromName":"Santiago Torres","fromEmail":"santiago@nyu.edu","sentAt":"2017-01-17T17:34:27Z","receivedAt":"2017-01-17T17:43:13Z","isPatch":true,"sender":{"key":"santiago@nyu.edu","avatar":"https://avatars.githubusercontent.com/u/3579933?v=4"},"body":""}]}