Merge branch 'jc/add-u-A-default-to-top'
[gitweb.git] / builtin / tag.c
index 74eaf25d5cec12d364ad7626b57edcc610d44ddc..8db8c87e57ef05edadce8de19316572498c40753 100644 (file)
@@ -23,7 +23,7 @@ static const char * const git_tag_usage[] = {
        N_("git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] <tagname> [<head>]"),
        N_("git tag -d <tagname>..."),
        N_("git tag -l [-n[<num>]] [--contains <commit>] [--points-at <object>]"
-               "\n\t\t[--format=<format>] [<pattern>...]"),
+               "\n\t\t[--format=<format>] [--[no-]merged [<commit>]] [<pattern>...]"),
        N_("git tag -v <tagname>..."),
        NULL
 };
@@ -52,6 +52,7 @@ static int list_tags(struct ref_filter *filter, struct ref_sorting *sorting, con
        }
 
        verify_ref_format(format);
+       filter->with_commit_tag_algo = 1;
        filter_refs(&array, filter, FILTER_REFS_TAGS);
        ref_array_sort(sorting, &array);
 
@@ -268,7 +269,7 @@ static void create_tag(const unsigned char *object, const char *tag,
        }
 
        if (opt->cleanup_mode != CLEANUP_NONE)
-               stripspace(buf, opt->cleanup_mode == CLEANUP_ALL);
+               strbuf_stripspace(buf, opt->cleanup_mode == CLEANUP_ALL);
 
        if (!opt->message_given && !buf->len)
                die(_("no tag message?"));
@@ -354,12 +355,14 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
                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_BOOL(0, "create-reflog", &create_reflog, N_("create_reflog")),
+               OPT_BOOL(0, "create-reflog", &create_reflog, N_("create a reflog")),
 
                OPT_GROUP(N_("Tag listing options")),
                OPT_COLUMN(0, "column", &colopts, N_("show tag list in columns")),
                OPT_CONTAINS(&filter.with_commit, N_("print only tags that contain the commit")),
                OPT_WITH(&filter.with_commit, N_("print only tags that contain the commit")),
+               OPT_MERGED(&filter, N_("print only tags that are merged")),
+               OPT_NO_MERGED(&filter, N_("print only tags that are not merged")),
                OPT_CALLBACK(0 , "sort", sorting_tail, N_("key"),
                             N_("field name to sort on"), &parse_opt_ref_sorting),
                {
@@ -418,6 +421,8 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
                die(_("--contains option is only allowed with -l."));
        if (filter.points_at.nr)
                die(_("--points-at option is only allowed with -l."));
+       if (filter.merge_commit)
+               die(_("--merged and --no-merged option are only allowed with -l"));
        if (cmdmode == 'd')
                return for_each_tag_name(argv, delete_tag);
        if (cmdmode == 'v')