From: Junio C Hamano Date: Fri, 29 Apr 2016 19:59:09 +0000 (-0700) Subject: Merge branch 'st/verify-tag' X-Git-Tag: v2.9.0-rc0~86 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/b559121e3ce56f221280314e4c5f1bdb75d4c32e?ds=inline;hp=-c Merge branch 'st/verify-tag' Unify internal logic between "git tag -v" and "git verify-tag" commands by making one directly call into the other. * st/verify-tag: tag -v: verify directly rather than exec-ing verify-tag verify-tag: move tag verification code to tag.c verify-tag: prepare verify_tag for libification verify-tag: update variable name and type t7030: test verifying multiple tags builtin/verify-tag.c: ignore SIGPIPE in gpg-interface --- b559121e3ce56f221280314e4c5f1bdb75d4c32e diff --combined builtin/tag.c index 528a1bab69,7b2918ef38..50e4ae5678 --- a/builtin/tag.c +++ b/builtin/tag.c @@@ -29,7 -29,6 +29,7 @@@ static const char * const git_tag_usage }; static unsigned int colopts; +static int force_sign_annotate; static int list_tags(struct ref_filter *filter, struct ref_sorting *sorting, const char *format) { @@@ -105,13 -104,7 +105,7 @@@ static int delete_tag(const char *name static int verify_tag(const char *name, const char *ref, const unsigned char *sha1) { - const char *argv_verify_tag[] = {"verify-tag", - "-v", "SHA1_HEX", NULL}; - argv_verify_tag[2] = sha1_to_hex(sha1); - - if (run_command_v_opt(argv_verify_tag, RUN_GIT_CMD)) - return error(_("could not verify the tag '%s'"), name); - return 0; + return gpg_verify_tag(sha1, name, GPG_VERIFY_VERBOSE); } static int do_sign(struct strbuf *buffer) @@@ -167,11 -160,6 +161,11 @@@ static int git_tag_config(const char *v status = git_gpg_config(var, value, cb); if (status) return status; + if (!strcmp(var, "tag.forcesignannotated")) { + force_sign_annotate = git_config_bool(var, value); + return 0; + } + if (starts_with(var, "column.")) return git_column_config(var, value, "tag", &colopts); return git_default_config(var, value, cb); @@@ -333,7 -321,7 +327,7 @@@ int cmd_tag(int argc, const char **argv char *cleanup_arg = NULL; int create_reflog = 0; int annotate = 0, force = 0; - int cmdmode = 0; + int cmdmode = 0, create_tag_object = 0; const char *msgfile = NULL, *keyid = NULL; struct msg_arg msg = { 0, STRBUF_INIT }; struct ref_transaction *transaction; @@@ -391,12 -379,12 +385,12 @@@ opt.sign = 1; set_signing_key(keyid); } - if (opt.sign) - annotate = 1; + create_tag_object = (opt.sign || annotate || msg.given || msgfile); + if (argc == 0 && !cmdmode) cmdmode = 'l'; - if ((annotate || msg.given || msgfile || force) && (cmdmode != 0)) + if ((create_tag_object || force) && (cmdmode != 0)) usage_with_options(git_tag_usage, options); finalize_colopts(&colopts, -1); @@@ -437,6 -425,7 +431,6 @@@ if (msg.given || msgfile) { if (msg.given && msgfile) die(_("only one -F or -m option is allowed.")); - annotate = 1; if (msg.given) strbuf_addbuf(&buf, &(msg.buf)); else { @@@ -479,11 -468,8 +473,11 @@@ else die(_("Invalid cleanup mode %s"), cleanup_arg); - if (annotate) + if (create_tag_object) { + if (force_sign_annotate && !annotate) + opt.sign = 1; create_tag(object, tag, &buf, &opt, prev, object); + } transaction = ref_transaction_begin(&err); if (!transaction ||