threads / patch / 36099

patchtag: grok "--with" as synonym to "--contains"

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

## tl;dr

One message between Mar 7, 2014 and Mar 7, 2014. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Junio C Hamano· Mar 7, 2014, 20:07 UTC · lore

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(+)
Show changes to builtin/tag.c +6 −0
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
 		},

← back to recent threads