Skip to contentSkip to conversation

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

PATCH New Junio C Hamano 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tag: grok "--with" as synonym to "--contains"

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.

---

* 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(+)
builtin/tag.c +6 -0
index af3af3f..cb7bb2b 100644
@@ -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
 		},