From: Junio C Hamano Date: Mon, 23 Mar 2015 18:28:02 +0000 (-0700) Subject: Merge branch 'jk/tag-h-column-is-a-listing-option' X-Git-Tag: v2.4.0-rc0~26 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/a633651d214d855a036535f6f64b5eba58892a0f?ds=inline;hp=-c Merge branch 'jk/tag-h-column-is-a-listing-option' "git tag -h" used to show the "--column" and "--sort" options that are about listing in a wrong section. * jk/tag-h-column-is-a-listing-option: tag: fix some mis-organized options in "-h" listing --- a633651d214d855a036535f6f64b5eba58892a0f diff --combined builtin/tag.c index 4194b9a711,de1beed2f9..6f07ac6b93 --- a/builtin/tag.c +++ b/builtin/tag.c @@@ -19,9 -19,9 +19,9 @@@ #include "column.h" static const char * const git_tag_usage[] = { - N_("git tag [-a|-s|-u ] [-f] [-m |-F ] []"), + N_("git tag [-a | -s | -u ] [-f] [-m | -F ] []"), N_("git tag -d ..."), - N_("git tag -l [-n[]] [--contains ] [--points-at ] " + N_("git tag -l [-n[]] [--contains ] [--points-at ]" "\n\t\t[...]"), N_("git tag -v ..."), NULL @@@ -85,7 -85,7 +85,7 @@@ static int in_commit_list(const struct enum contains_result { CONTAINS_UNKNOWN = -1, CONTAINS_NO = 0, - CONTAINS_YES = 1, + CONTAINS_YES = 1 }; /* @@@ -576,6 -576,7 +576,6 @@@ int cmd_tag(int argc, const char **argv struct strbuf ref = STRBUF_INIT; unsigned char object[20], prev[20]; const char *object_ref, *tag; - struct ref_lock *lock; struct create_tag_options opt; char *cleanup_arg = NULL; int annotate = 0, force = 0, lines = -1; @@@ -583,8 -584,6 +583,8 @@@ const char *msgfile = NULL, *keyid = NULL; struct msg_arg msg = { 0, STRBUF_INIT }; struct commit_list *with_commit = NULL; + struct ref_transaction *transaction; + struct strbuf err = STRBUF_INIT; struct option options[] = { OPT_CMDMODE('l', "list", &cmdmode, N_("list tag names"), 'l'), { OPTION_INTEGER, 'n', NULL, &lines, N_("n"), @@@ -605,13 -604,13 +605,13 @@@ OPT_STRING('u', "local-user", &keyid, N_("key-id"), N_("use another key to sign the tag")), OPT__FORCE(&force, N_("replace the tag if exists")), + + OPT_GROUP(N_("Tag listing options")), OPT_COLUMN(0, "column", &colopts, N_("show tag list in columns")), { OPTION_CALLBACK, 0, "sort", &tag_sort, N_("type"), N_("sort tags"), PARSE_OPT_NONEG, parse_opt_sort }, - - OPT_GROUP(N_("Tag listing options")), { OPTION_CALLBACK, 0, "contains", &with_commit, N_("commit"), N_("print only tags that contain the commit"), @@@ -730,17 -729,14 +730,17 @@@ if (annotate) create_tag(object, tag, &buf, &opt, prev, object); - lock = lock_any_ref_for_update(ref.buf, prev, 0, NULL); - if (!lock) - die(_("%s: cannot lock the ref"), ref.buf); - if (write_ref_sha1(lock, object, NULL) < 0) - die(_("%s: cannot update the ref"), ref.buf); + transaction = ref_transaction_begin(&err); + if (!transaction || + ref_transaction_update(transaction, ref.buf, object, prev, + 0, NULL, &err) || + ref_transaction_commit(transaction, &err)) + die("%s", err.buf); + ref_transaction_free(transaction); if (force && !is_null_sha1(prev) && hashcmp(prev, object)) printf(_("Updated tag '%s' (was %s)\n"), tag, find_unique_abbrev(prev, DEFAULT_ABBREV)); + strbuf_release(&err); strbuf_release(&buf); strbuf_release(&ref); return 0;