# [PATCH] tag: grok "--with" as synonym to "--contains"

1 messages from 2014-03-07 to 2014-03-07. Participants: Junio C Hamano.
Thread: https://gitlist.dev/t/36099

## Junio C Hamano, 2014-03-07 20:07

Subject: [PATCH] tag: grok "--with" as synonym to "--contains"
Message-ID: <xmqqr46du60n.fsf@gitster.dls.corp.google.com>
URL: https://gitlist.dev/e/xmqqr46du60n.fsf%40gitster.dls.corp.google.com

```
Just like "git branch" can be told to list the branches that has the
named commit by "git branch --with <commit>", teach the same
short-hand to "git tag", so that "git tag --with <commit>" shows the
releases with the named commit.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 * After umpteenth time I got an optparse error I finally decided
   that this may be worth consideration.

   Just like "git branch", the synonym is not advertised in the
   documentation nor "git cmd -h" output.  We _might_ want to expose
   both at the same time, but that is not in the scope of this patch.

 builtin/tag.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/builtin/tag.c b/builtin/tag.c
index af3af3f..cb7bb2b 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -471,6 +471,12 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
 			parse_opt_with_commit, (intptr_t)"HEAD",
 		},
 		{
+			OPTION_CALLBACK, 0, "with", &with_commit, N_("commit"),
+			N_("print only tags that contain the commit"),
+			PARSE_OPT_HIDDEN | PARSE_OPT_LASTARG_DEFAULT,
+			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
 		},

```
