{"thread":{"id":"23103","subject":"[PATCH/RFC 0/5] libify verify_tag()","startedAt":"2010-03-20T05:09:54Z","lastAt":"2010-03-20T22:14:51Z","messageCount":9,"participants":["Jonathan Nieder","Johannes Sixt"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"137303","messageId":"20100320050953.GA24746@progeny.tock","threadId":"23103","inReplyTo":null,"subject":"[PATCH/RFC 0/5] libify verify_tag()","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-03-20T05:09:54Z","receivedAt":"2010-03-20T05:09:54Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nI noticed that ‘git tag -v’ runs git-verify-tag (dashed form), and while\nfixing that, I thought, why not make cmd_tag() run verify_tag()\ndirectly?  Here is what that would look like.\n\nThe performance impact is pretty negligible: t/t7004-tag.sh is about\n2% faster after the change here (with hot or cold cache, it doesn’t\nmatter).\n\nWhat do you think?\nJonathan Nieder (5):\n  tag: Run ‘git verify-tag’ using its undashed name\n  verify-tag: use sigchain library to block SIGPIPE\n  Expose verify_tag()\n  tag: Do not spawn a separate process for verify-tag\n  verify_tag_signature(): let caller look up tag object sha1\n\n Makefile                             |    1 +\n builtin/tag.c                        |    6 +--\n builtin/verify-tag.c                 |   84 ++++------------------------------\n tag.h                                |    2 +\n builtin/verify-tag.c => verify-tag.c |   49 ++++----------------\n 5 files changed, 22 insertions(+), 120 deletions(-)\n copy builtin/verify-tag.c => verify-tag.c (61%)\n"},{"id":"137304","messageId":"20100320051148.GA24791@progeny.tock","threadId":"23103","inReplyTo":"20100320050953.GA24746@progeny.tock","subject":"[PATCH 1/5] tag -v: use ‘git verify-tag’ without dash","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-03-20T05:11:48Z","receivedAt":"2010-03-20T05:11:48Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"There is not much reason to avoid dashed command names here except\nsetting a good example, but setting a good example is reason enough.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n builtin/tag.c |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex 4ef1c4f..d56c882 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -147,9 +147,9 @@ 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-\tconst char *argv_verify_tag[] = {\"git-verify-tag\",\n+\tconst char *argv_verify_tag[] = {\"git\", \"verify-tag\",\n \t\t\t\t\t\"-v\", \"SHA1_HEX\", NULL};\n-\targv_verify_tag[2] = sha1_to_hex(sha1);\n+\targv_verify_tag[3] = sha1_to_hex(sha1);\n \n \tif (run_command_v_opt(argv_verify_tag, 0))\n \t\treturn error(\"could not verify the tag '%s'\", name);\n-- \n1.7.0.2\n"},{"id":"137306","messageId":"20100320051219.GB24791@progeny.tock","threadId":"23103","inReplyTo":"20100320050953.GA24746@progeny.tock","subject":"[PATCH 2/5] verify-tag: use sigchain library to block SIGPIPE","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-03-20T05:12:19Z","receivedAt":"2010-03-20T05:12:19Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Without this change, callers cannot use verify_tag() safely without\nblocking SIGPIPE themselves.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n builtin/verify-tag.c |   11 ++++++++---\n 1 files changed, 8 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/verify-tag.c b/builtin/verify-tag.c\nindex 9f482c2..91dd1c1 100644\n--- a/builtin/verify-tag.c\n+++ b/builtin/verify-tag.c\n@@ -10,6 +10,7 @@\n #include \"tag.h\"\n #include \"run-command.h\"\n #include <signal.h>\n+#include \"sigchain.h\"\n #include \"parse-options.h\"\n \n static const char * const verify_tag_usage[] = {\n@@ -54,8 +55,15 @@ static int run_gpg_verify(const char *buf, unsigned long size, int verbose)\n \t\treturn error(\"could not run gpg.\");\n \t}\n \n+\t/*\n+\t * gpg will stop as soon as it knows the signature is bad,\n+\t * which can result in SIGPIPE.\n+\t */\n+\tsigchain_push(SIGPIPE, SIG_IGN);\n \twrite_in_full(gpg.in, buf, len);\n \tclose(gpg.in);\n+\tsigchain_pop(SIGPIPE);\n+\n \tret = finish_command(&gpg);\n \n \tunlink_or_warn(path);\n@@ -104,9 +112,6 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix)\n \tif (argc <= i)\n \t\tusage_with_options(verify_tag_usage, verify_tag_options);\n \n-\t/* sometimes the program was terminated because this signal\n-\t * was received in the process of writing the gpg input: */\n-\tsignal(SIGPIPE, SIG_IGN);\n \twhile (i < argc)\n \t\tif (verify_tag(argv[i++], verbose))\n \t\t\thad_error = 1;\n-- \n1.7.0.2\n"},{"id":"137307","messageId":"20100320051327.GC24791@progeny.tock","threadId":"23103","inReplyTo":"20100320050953.GA24746@progeny.tock","subject":"[PATCH 3/5] Expose verify_tag()","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-03-20T05:13:28Z","receivedAt":"2010-03-20T05:13:28Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Expose the verify_tag() function so ‘git tag -v’ can use it directly\nin the future.  verify_tag() already frees all the memory it allocates\nand does not call any functions that can exit, so this should be safe.\n\nThe function is renamed to verify_tag_signature() for clarity and to\navoid conflicting with builtin/tag.c and builtin/mktag.c’s unrelated\nverify_tag().\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n Makefile                             |    1 +\n builtin/verify-tag.c                 |   85 +---------------------------------\n tag.h                                |    1 +\n builtin/verify-tag.c => verify-tag.c |   34 +-------------\n 4 files changed, 4 insertions(+), 117 deletions(-)\n copy builtin/verify-tag.c => verify-tag.c (71%)\n\ndiff --git a/Makefile b/Makefile\nindex 7c616f8..ed58261 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -616,6 +616,7 @@ LIB_OBJS += unpack-trees.o\n LIB_OBJS += usage.o\n LIB_OBJS += userdiff.o\n LIB_OBJS += utf8.o\n+LIB_OBJS += verify-tag.o\n LIB_OBJS += walker.o\n LIB_OBJS += wrapper.o\n LIB_OBJS += write_or_die.o\ndiff --git a/builtin/verify-tag.c b/builtin/verify-tag.c\nindex 91dd1c1..ca075bd 100644\n--- a/builtin/verify-tag.c\n+++ b/builtin/verify-tag.c\n@@ -5,12 +5,8 @@\n  *\n  * Based on git-verify-tag.sh\n  */\n-#include \"cache.h\"\n #include \"builtin.h\"\n #include \"tag.h\"\n-#include \"run-command.h\"\n-#include <signal.h>\n-#include \"sigchain.h\"\n #include \"parse-options.h\"\n \n static const char * const verify_tag_usage[] = {\n@@ -18,85 +14,6 @@ static const char * const verify_tag_usage[] = {\n \t\tNULL\n };\n \n-#define PGP_SIGNATURE \"-----BEGIN PGP SIGNATURE-----\"\n-\n-static int run_gpg_verify(const char *buf, unsigned long size, int verbose)\n-{\n-\tstruct child_process gpg;\n-\tconst char *args_gpg[] = {\"gpg\", \"--verify\", \"FILE\", \"-\", NULL};\n-\tchar path[PATH_MAX], *eol;\n-\tsize_t len;\n-\tint fd, ret;\n-\n-\tfd = git_mkstemp(path, PATH_MAX, \".git_vtag_tmpXXXXXX\");\n-\tif (fd < 0)\n-\t\treturn error(\"could not create temporary file '%s': %s\",\n-\t\t\t\t\t\tpath, strerror(errno));\n-\tif (write_in_full(fd, buf, size) < 0)\n-\t\treturn error(\"failed writing temporary file '%s': %s\",\n-\t\t\t\t\t\tpath, strerror(errno));\n-\tclose(fd);\n-\n-\t/* find the length without signature */\n-\tlen = 0;\n-\twhile (len < size && prefixcmp(buf + len, PGP_SIGNATURE)) {\n-\t\teol = memchr(buf + len, '\\n', size - len);\n-\t\tlen += eol ? eol - (buf + len) + 1 : size - len;\n-\t}\n-\tif (verbose)\n-\t\twrite_in_full(1, buf, len);\n-\n-\tmemset(&gpg, 0, sizeof(gpg));\n-\tgpg.argv = args_gpg;\n-\tgpg.in = -1;\n-\targs_gpg[2] = path;\n-\tif (start_command(&gpg)) {\n-\t\tunlink(path);\n-\t\treturn error(\"could not run gpg.\");\n-\t}\n-\n-\t/*\n-\t * gpg will stop as soon as it knows the signature is bad,\n-\t * which can result in SIGPIPE.\n-\t */\n-\tsigchain_push(SIGPIPE, SIG_IGN);\n-\twrite_in_full(gpg.in, buf, len);\n-\tclose(gpg.in);\n-\tsigchain_pop(SIGPIPE);\n-\n-\tret = finish_command(&gpg);\n-\n-\tunlink_or_warn(path);\n-\n-\treturn ret;\n-}\n-\n-static int verify_tag(const char *name, int verbose)\n-{\n-\tenum object_type type;\n-\tunsigned char sha1[20];\n-\tchar *buf;\n-\tunsigned long size;\n-\tint ret;\n-\n-\tif (get_sha1(name, sha1))\n-\t\treturn error(\"tag '%s' not found.\", name);\n-\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, typename(type));\n-\n-\tbuf = read_sha1_file(sha1, &type, &size);\n-\tif (!buf)\n-\t\treturn error(\"%s: unable to read file.\", name);\n-\n-\tret = run_gpg_verify(buf, size, verbose);\n-\n-\tfree(buf);\n-\treturn ret;\n-}\n-\n int cmd_verify_tag(int argc, const char **argv, const char *prefix)\n {\n \tint i = 1, verbose = 0, had_error = 0;\n@@ -113,7 +30,7 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix)\n \t\tusage_with_options(verify_tag_usage, verify_tag_options);\n \n \twhile (i < argc)\n-\t\tif (verify_tag(argv[i++], verbose))\n+\t\tif (verify_tag_signature(argv[i++], verbose))\n \t\t\thad_error = 1;\n \treturn had_error;\n }\ndiff --git a/tag.h b/tag.h\nindex 7a0cb00..1034109 100644\n--- a/tag.h\n+++ b/tag.h\n@@ -16,5 +16,6 @@ extern struct tag *lookup_tag(const unsigned char *sha1);\n extern int parse_tag_buffer(struct tag *item, void *data, unsigned long size);\n extern int parse_tag(struct tag *item);\n extern struct object *deref_tag(struct object *, const char *, int);\n+extern int verify_tag_signature(const char *name, int verbose);\n \n #endif /* TAG_H */\ndiff --git a/builtin/verify-tag.c b/verify-tag.c\nsimilarity index 71%\ncopy from builtin/verify-tag.c\ncopy to verify-tag.c\nindex 91dd1c1..7152e99 100644\n--- a/builtin/verify-tag.c\n+++ b/verify-tag.c\n@@ -1,22 +1,11 @@\n /*\n- * Builtin \"git verify-tag\"\n- *\n  * Copyright (c) 2007 Carlos Rica <jasampler@gmail.com>\n- *\n- * Based on git-verify-tag.sh\n  */\n #include \"cache.h\"\n-#include \"builtin.h\"\n #include \"tag.h\"\n #include \"run-command.h\"\n #include <signal.h>\n #include \"sigchain.h\"\n-#include \"parse-options.h\"\n-\n-static const char * const verify_tag_usage[] = {\n-\t\t\"git verify-tag [-v|--verbose] <tag>...\",\n-\t\tNULL\n-};\n \n #define PGP_SIGNATURE \"-----BEGIN PGP SIGNATURE-----\"\n \n@@ -71,7 +60,7 @@ static int run_gpg_verify(const char *buf, unsigned long size, int verbose)\n \treturn ret;\n }\n \n-static int verify_tag(const char *name, int verbose)\n+int verify_tag_signature(const char *name, int verbose)\n {\n \tenum object_type type;\n \tunsigned char sha1[20];\n@@ -96,24 +85,3 @@ static int verify_tag(const char *name, int verbose)\n \tfree(buf);\n \treturn ret;\n }\n-\n-int cmd_verify_tag(int argc, const char **argv, const char *prefix)\n-{\n-\tint i = 1, verbose = 0, had_error = 0;\n-\tconst struct option verify_tag_options[] = {\n-\t\tOPT__VERBOSE(&verbose),\n-\t\tOPT_END()\n-\t};\n-\n-\tgit_config(git_default_config, NULL);\n-\n-\targc = parse_options(argc, argv, prefix, verify_tag_options,\n-\t\t\t     verify_tag_usage, PARSE_OPT_KEEP_ARGV0);\n-\tif (argc <= i)\n-\t\tusage_with_options(verify_tag_usage, verify_tag_options);\n-\n-\twhile (i < argc)\n-\t\tif (verify_tag(argv[i++], verbose))\n-\t\t\thad_error = 1;\n-\treturn had_error;\n-}\n-- \n1.7.0.2\n"},{"id":"137308","messageId":"20100320051414.GD24791@progeny.tock","threadId":"23103","inReplyTo":"20100320050953.GA24746@progeny.tock","subject":"[PATCH 4/5] tag -v: Do not spawn a separate process for verify-tag","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-03-20T05:14:14Z","receivedAt":"2010-03-20T05:14:14Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Aside from handling of SIGPIPE, there was no reason for verify-tag\nto run in a separate process.\n\nNot much advantage to this I can see.  It just simplifies things\na little.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n builtin/tag.c |    6 +-----\n 1 files changed, 1 insertions(+), 5 deletions(-)\n\ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex d56c882..d138e0c 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -147,11 +147,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-\tconst char *argv_verify_tag[] = {\"git\", \"verify-tag\",\n-\t\t\t\t\t\"-v\", \"SHA1_HEX\", NULL};\n-\targv_verify_tag[3] = sha1_to_hex(sha1);\n-\n-\tif (run_command_v_opt(argv_verify_tag, 0))\n+\tif (verify_tag_signature(sha1_to_hex(sha1), 1))\n \t\treturn error(\"could not verify the tag '%s'\", name);\n \treturn 0;\n }\n-- \n1.7.0.2\n"},{"id":"137309","messageId":"20100320051441.GE24791@progeny.tock","threadId":"23103","inReplyTo":"20100320050953.GA24746@progeny.tock","subject":"[PATCH 5/5] verify_tag_signature(): let caller look up tag object sha1","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-03-20T05:14:41Z","receivedAt":"2010-03-20T05:14:41Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Avoid an unnecessary get_sha1() call in cmd_tag().\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n builtin/tag.c        |    2 +-\n builtin/verify-tag.c |   16 ++++++++++++++--\n tag.h                |    3 ++-\n verify-tag.c         |    6 +-----\n 4 files changed, 18 insertions(+), 9 deletions(-)\n\ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex d138e0c..df94a8c 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -147,7 +147,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-\tif (verify_tag_signature(sha1_to_hex(sha1), 1))\n+\tif (verify_tag_signature(sha1, name, 1))\n \t\treturn error(\"could not verify the tag '%s'\", name);\n \treturn 0;\n }\ndiff --git a/builtin/verify-tag.c b/builtin/verify-tag.c\nindex ca075bd..df2e095 100644\n--- a/builtin/verify-tag.c\n+++ b/builtin/verify-tag.c\n@@ -14,6 +14,13 @@ static const char * const verify_tag_usage[] = {\n \t\tNULL\n };\n \n+static int get_sha1_or_whine(const char *name, unsigned char *sha1)\n+{\n+\tif (get_sha1(name, sha1))\n+\t\treturn error(\"tag '%s' not found.\", name);\n+\treturn 0;\n+}\n+\n int cmd_verify_tag(int argc, const char **argv, const char *prefix)\n {\n \tint i = 1, verbose = 0, had_error = 0;\n@@ -29,8 +36,13 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix)\n \tif (argc <= i)\n \t\tusage_with_options(verify_tag_usage, verify_tag_options);\n \n-\twhile (i < argc)\n-\t\tif (verify_tag_signature(argv[i++], verbose))\n+\twhile (i < argc) {\n+\t\tunsigned char sha1[20];\n+\t\tconst char *name = argv[i++];\n+\n+\t\tif (get_sha1_or_whine(name, sha1) < 0 ||\n+\t\t    verify_tag_signature(sha1, name, verbose) < 0)\n \t\t\thad_error = 1;\n+\t}\n \treturn had_error;\n }\ndiff --git a/tag.h b/tag.h\nindex 1034109..f83dce6 100644\n--- a/tag.h\n+++ b/tag.h\n@@ -16,6 +16,7 @@ extern struct tag *lookup_tag(const unsigned char *sha1);\n extern int parse_tag_buffer(struct tag *item, void *data, unsigned long size);\n extern int parse_tag(struct tag *item);\n extern struct object *deref_tag(struct object *, const char *, int);\n-extern int verify_tag_signature(const char *name, int verbose);\n+extern int verify_tag_signature(const unsigned char *sha1, const char *name,\n+\t\t\t\tint verbose);\n \n #endif /* TAG_H */\ndiff --git a/verify-tag.c b/verify-tag.c\nindex 7152e99..bf88707 100644\n--- a/verify-tag.c\n+++ b/verify-tag.c\n@@ -60,17 +60,13 @@ static int run_gpg_verify(const char *buf, unsigned long size, int verbose)\n \treturn ret;\n }\n \n-int verify_tag_signature(const char *name, int verbose)\n+int verify_tag_signature(const unsigned char *sha1, const char *name, int verbose)\n {\n \tenum object_type type;\n-\tunsigned char sha1[20];\n \tchar *buf;\n \tunsigned long size;\n \tint ret;\n \n-\tif (get_sha1(name, sha1))\n-\t\treturn error(\"tag '%s' not found.\", name);\n-\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-- \n1.7.0.2\n"},{"id":"137344","messageId":"201003201701.16820.j6t@kdbg.org","threadId":"23103","inReplyTo":"20100320051148.GA24791@progeny.tock","subject":"Re: [PATCH 1/5] tag -v: use ‘git verify-tag’ without dash","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2010-03-20T16:01:16Z","receivedAt":"2010-03-20T16:01:16Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"On Samstag, 20. März 2010, Jonathan Nieder wrote:\n> -\tconst char *argv_verify_tag[] = {\"git-verify-tag\",\n> +\tconst char *argv_verify_tag[] = {\"git\", \"verify-tag\",\n>  \t\t\t\t\t\"-v\", \"SHA1_HEX\", NULL};\n> -\targv_verify_tag[2] = sha1_to_hex(sha1);\n> +\targv_verify_tag[3] = sha1_to_hex(sha1);\n>\n>  \tif (run_command_v_opt(argv_verify_tag, 0))\n>  \t\treturn error(\"could not verify the tag '%s'\", name);\n\nThis should rather be changed to run_command_v_opt(..., RUN_GIT_CMD). See \nother examples in the code.\n\nOh, you remove this in a later patch. Then why have this patch at all?\n\n-- Hannes\n"},{"id":"137377","messageId":"20100320212932.GA30010@progeny.tock","threadId":"23103","inReplyTo":"201003201701.16820.j6t@kdbg.org","subject":"Re: [PATCH 1/5] tag -v: use ‘git verify-tag’ without dash","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-03-20T21:29:33Z","receivedAt":"2010-03-20T21:29:33Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Johannes Sixt wrote:\n> On Samstag, 20. März 2010, Jonathan Nieder wrote:\n\n>> -\tconst char *argv_verify_tag[] = {\"git-verify-tag\",\n>> +\tconst char *argv_verify_tag[] = {\"git\", \"verify-tag\",\n>>  \t\t\t\t\t\"-v\", \"SHA1_HEX\", NULL};\n>> -\targv_verify_tag[2] = sha1_to_hex(sha1);\n>> +\targv_verify_tag[3] = sha1_to_hex(sha1);\n>>\n>>  \tif (run_command_v_opt(argv_verify_tag, 0))\n>>  \t\treturn error(\"could not verify the tag '%s'\", name);\n>\n> This should rather be changed to run_command_v_opt(..., RUN_GIT_CMD). See \n> other examples in the code.\n\nNeat.  Thanks for the pointer.\n\n> Oh, you remove this in a later patch. Then why have this patch at all?\n\nIf the rest of the patches go in the right direction, this one should\nbe dropped.  I should presented it as two alternative series instead:\none that follows the appropriate calling convention here, and one that\nlibifies verify_tag.\n\nIn other words, no good reason at all; thanks for pointing it out.\nI’ll send a version of patch 4/5 that doesn’t depend on this one in a\nmoment.\n\nJonathan\n"},{"id":"137382","messageId":"20100320221451.GB31098@progeny.tock","threadId":"23103","inReplyTo":"20100320051414.GD24791@progeny.tock","subject":"[PATCH 4/5 v2] tag -v: Do not spawn a separate process for verify-tag","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-03-20T22:14:51Z","receivedAt":"2010-03-20T22:14:51Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Aside from handling of SIGPIPE, there was no reason for verify-tag\nto run in a separate process.\n\nNot much advantage to this I can see.  It just simplifies things\na little.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nRebased to remove the churn from patch 1, as suggested by Johannes.\nThanks.\n\nThe new series has only 4 patches:\n\n  [PATCH 2/5] verify-tag: use sigchain library to block SIGPIPE\n  [PATCH 3/5] Expose verify_tag()\n  [PATCH 4/5 v2] tag -v: Do not spawn a separate process for verify-tag\n  [PATCH 5/5] verify_tag_signature(): let caller look up tag object sha1\n\n builtin/tag.c |    6 +-----\n 1 files changed, 1 insertions(+), 5 deletions(-)\n\ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex 4ef1c4f..d138e0c 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -147,11 +147,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-\tconst char *argv_verify_tag[] = {\"git-verify-tag\",\n-\t\t\t\t\t\"-v\", \"SHA1_HEX\", NULL};\n-\targv_verify_tag[2] = sha1_to_hex(sha1);\n-\n-\tif (run_command_v_opt(argv_verify_tag, 0))\n+\tif (verify_tag_signature(sha1_to_hex(sha1), 1))\n \t\treturn error(\"could not verify the tag '%s'\", name);\n \treturn 0;\n }\n-- \n1.7.0.2\n"}]}