diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2017-03-24 18:40:55 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-03-24 12:15:26 -0700 |
commit | 6a338149f623f493525324bc0f8d7bb9257cb840 (patch) | |
tree | a163e31dd5963e4b25b10f641ad9474234927dbc /Documentation | |
parent | tag: change misleading --list <pattern> documentation (diff) | |
download | tgif-6a338149f623f493525324bc0f8d7bb9257cb840.tar.xz |
tag: implicitly supply --list given another list-like option
Change the "tag" command to implicitly turn on its --list mode when
provided with a list-like option such as --contains, --points-at etc.
This is for consistency with how "branch" works. When "branch" is
given a list-like option, such as --contains, it implicitly provides
--list. Before this change "tag" would error out on those sorts of
invocations. I.e. while both of these worked for "branch":
git branch --contains v2.8.0 <pattern>
git branch --list --contains v2.8.0 <pattern>
Only the latter form worked for "tag":
git tag --contains v2.8.0 '*rc*'
git tag --list --contains v2.8.0 '*rc*'
Now "tag", like "branch", will implicitly supply --list when a
list-like option is provided, and no other conflicting non-list
options (such as -d) are present on the command-line.
Spelunking through the history via:
git log --reverse -p -G'only allowed with' -- '*builtin*tag*c'
Reveals that there was no good reason for not allowing this in the
first place. The --contains option added in 32c35cfb1e ("git-tag: Add
--contains option", 2009-01-26) made this an error. All the other
subsequent list-like options that were added copied its pattern of
making this usage an error.
The only tests that break as a result of this change are tests that
were explicitly checking that this "branch-like" usage wasn't
permitted. Change those failing tests to check that this invocation
mode is permitted, add extra tests for the list-like options we
weren't testing, and tests to ensure that e.g. we don't toggle the
list mode in the presence of other conflicting non-list options.
With this change errors messages such as "--contains option is only
allowed with -l" don't make sense anymore, since options like
--contain turn on -l. Instead we error out when list-like options such
as --contain are used in conjunction with conflicting options such as
-d or -v.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/git-tag.txt | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/Documentation/git-tag.txt b/Documentation/git-tag.txt index 47d8733523..4d289f5dd5 100644 --- a/Documentation/git-tag.txt +++ b/Documentation/git-tag.txt @@ -82,10 +82,11 @@ OPTIONS -n<num>:: <num> specifies how many lines from the annotation, if any, - are printed when using -l. - The default is not to print any annotation lines. - If no number is given to `-n`, only the first line is printed. - If the tag is not annotated, the commit message is displayed instead. + are printed when using -l. Implies `--list`. ++ +The default is not to print any annotation lines. +If no number is given to `-n`, only the first line is printed. +If the tag is not annotated, the commit message is displayed instead. -l:: --list:: @@ -95,6 +96,10 @@ OPTIONS Running "git tag" without arguments also lists all tags. The pattern is a shell wildcard (i.e., matched using fnmatch(3)). Multiple patterns may be given; if any of them matches, the tag is shown. ++ +This option is implicitly supplied if any other list-like option such +as `--contains` is provided. See the documentation for each of those +options for details. --sort=<key>:: Sort based on the key given. Prefix `-` to sort in @@ -123,7 +128,7 @@ This option is only applicable when listing tags without annotation lines. --contains [<commit>]:: Only list tags which contain the specified commit (HEAD if not - specified). + specified). Implies `--list`. --merged [<commit>]:: Only list tags whose commits are reachable from the specified @@ -134,7 +139,7 @@ This option is only applicable when listing tags without annotation lines. commit (`HEAD` if not specified), incompatible with `--merged`. --points-at <object>:: - Only list tags of the given object. + Only list tags of the given object. Implies `--list`. -m <msg>:: --message=<msg>:: |