summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 56c3eb1)
raw | patch | inline | side by side (parent: 56c3eb1)
author | Pierre Habouzit <madcoder@debian.org> | |
Fri, 21 Dec 2007 10:50:58 +0000 (11:50 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 22 Dec 2007 08:05:02 +0000 (00:05 -0800) |
The command itself takes an optional <pattern> argument that
limits the shown tags to the ones that match when in listing
mode that is triggered with '-l' option. The <pattern> is not
an optional option-argument to '-l'.
With this fix, "git tag -l -n 4 v0.99" works as expected.
It also removes a few bogus tests in t7004.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
limits the shown tags to the ones that match when in listing
mode that is triggered with '-l' option. The <pattern> is not
an optional option-argument to '-l'.
With this fix, "git tag -l -n 4 v0.99" works as expected.
It also removes a few bogus tests in t7004.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-tag.c | patch | blob | history | |
t/t7004-tag.sh | patch | blob | history |
diff --git a/builtin-tag.c b/builtin-tag.c
index 274901a408fa0d1d988da35d637ead7ca565552e..020ee1cb777d666fc2c70f87f01081355c061424 100644 (file)
--- a/builtin-tag.c
+++ b/builtin-tag.c
static const char * const git_tag_usage[] = {
"git-tag [-a|-s|-u <key-id>] [-f] [-m <msg>|-F <file>] <tagname> [<head>]",
"git-tag -d <tagname>...",
- "git-tag [-n [<num>]] -l [<pattern>]",
+ "git-tag -l [-n [<num>]] [<pattern>]",
"git-tag -v <tagname>...",
NULL
};
struct ref_lock *lock;
int annotate = 0, sign = 0, force = 0, lines = 0,
- delete = 0, verify = 0;
- char *list = NULL, *msgfile = NULL, *keyid = NULL;
- const char *no_pattern = "NO_PATTERN";
+ list = 0, delete = 0, verify = 0;
+ char *msgfile = NULL, *keyid = NULL;
struct msg_arg msg = { 0, STRBUF_INIT };
struct option options[] = {
- { OPTION_STRING, 'l', NULL, &list, "pattern", "list tag names",
- PARSE_OPT_OPTARG, NULL, (intptr_t) no_pattern },
+ OPT_BOOLEAN('l', NULL, &list, "list tag names"),
{ OPTION_INTEGER, 'n', NULL, &lines, NULL,
"print n lines of each tag message",
PARSE_OPT_OPTARG, NULL, 1 },
annotate = 1;
if (list)
- return list_tags(list == no_pattern ? NULL : list, lines);
+ return list_tags(argv[0], lines);
if (delete)
return for_each_tag_name(argv, delete_tag);
if (verify)
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index 09d56e0839f042a74bee5c13ab251f19fcc2c76e..6f41ce3a772df682504faf76af5276c921168e42 100755 (executable)
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
git diff expect actual &&
echo "tag-one-line A msg" >expect &&
- git-tag -n xxx -l | grep "^tag-one-line" >actual &&
- git diff expect actual &&
- git-tag -n "" -l | grep "^tag-one-line" >actual &&
- git diff expect actual &&
git-tag -n 1 -l | grep "^tag-one-line" >actual &&
git diff expect actual &&
git-tag -n -l | grep "^tag-one-line" >actual &&
git diff expect actual &&
echo "stag-one-line A message line signed" >expect &&
- git-tag -n xxx -l | grep "^stag-one-line" >actual &&
- git diff expect actual &&
- git-tag -n "" -l | grep "^stag-one-line" >actual &&
- git diff expect actual &&
git-tag -n 1 -l | grep "^stag-one-line" >actual &&
git diff expect actual &&
git-tag -n -l | grep "^stag-one-line" >actual &&