ref-filter: implement '--merged' and '--no-merged' options
[gitweb.git] / builtin / tag.c
index 5f6cdc5a03cd0d6df75c06453785f110cc3b08ee..280981f573be997dca71e23cc37042647c56e252 100644 (file)
@@ -56,6 +56,10 @@ static int match_pattern(const char **patterns, const char *ref)
        return 0;
 }
 
+/*
+ * This is currently duplicated in ref-filter.c, and will eventually be
+ * removed as we port tag.c to use the ref-filter APIs.
+ */
 static const unsigned char *match_points_at(const char *refname,
                                            const unsigned char *sha1)
 {
@@ -546,23 +550,6 @@ static int strbuf_check_tag_ref(struct strbuf *sb, const char *name)
        return check_refname_format(sb->buf, 0);
 }
 
-static int parse_opt_points_at(const struct option *opt __attribute__((unused)),
-                       const char *arg, int unset)
-{
-       unsigned char sha1[20];
-
-       if (unset) {
-               sha1_array_clear(&points_at);
-               return 0;
-       }
-       if (!arg)
-               return error(_("switch 'points-at' requires an object"));
-       if (get_sha1(arg, sha1))
-               return error(_("malformed object name '%s'"), arg);
-       sha1_array_append(&points_at, sha1);
-       return 0;
-}
-
 static int parse_opt_sort(const struct option *opt, const char *arg, int unset)
 {
        int *sort = opt->value;
@@ -625,8 +612,8 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
                        parse_opt_with_commit, (intptr_t)"HEAD",
                },
                {
-                       OPTION_CALLBACK, 0, "points-at", NULL, N_("object"),
-                       N_("print only tags of the object"), 0, parse_opt_points_at
+                       OPTION_CALLBACK, 0, "points-at", &points_at, N_("object"),
+                       N_("print only tags of the object"), 0, parse_opt_object_name
                },
                OPT_END()
        };