git-commit-vandalism/Documentation
Jeff King 0571979bd6 tag: do not show ambiguous tag names as "tags/foo"
Since b7cc53e9 (tag.c: use 'ref-filter' APIs, 2015-07-11),
git-tag has started showing tags with ambiguous names (i.e.,
when both "heads/foo" and "tags/foo" exists) as "tags/foo"
instead of just "foo". This is both:

  - pointless; the output of "git tag" includes only
    refs/tags, so we know that "foo" means the one in
    "refs/tags".

and

  - ambiguous; in the original output, we know that the line
    "foo" means that "refs/tags/foo" exists. In the new
    output, it is unclear whether we mean "refs/tags/foo" or
    "refs/tags/tags/foo".

The reason this happens is that commit b7cc53e9 switched
git-tag to use ref-filter's "%(refname:short)" output
formatting, which was adapted from for-each-ref. This more
general code does not know that we care only about tags, and
uses shorten_unambiguous_ref to get the short-name. We need
to tell it that we care only about "refs/tags/", and it
should shorten with respect to that value.

In theory, the ref-filter code could figure this out by us
passing FILTER_REFS_TAGS. But there are two complications
there:

  1. The handling of refname:short is deep in formatting
     code that does not even have our ref_filter struct, let
     alone the arguments to the filter_ref struct.

  2. In git v2.7.0, we expose the formatting language to the
     user. If we follow this path, it will mean that
     "%(refname:short)" behaves differently for "tag" versus
     "for-each-ref" (including "for-each-ref refs/tags/"),
     which can lead to confusion.

Instead, let's add a new modifier to the formatting
language, "strip", to remove a specific set of prefix
components. This fixes "git tag", and lets users invoke the
same behavior from their own custom formats (for "tag" or
"for-each-ref") while leaving ":short" with its same
consistent meaning in all places.

We introduce a test in t7004 for "git tag", which fails
without this patch. We also add a similar test in t3203 for
"git branch", which does not actually fail. But since it is
likely that "branch" will eventually use the same formatting
code, the test helps defend against future regressions.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-01-26 13:34:10 -08:00
..
howto command-list.txt: add the common groups block 2015-05-21 13:03:37 -07:00
RelNotes Git 2.6.5 2016-01-04 14:06:59 -08:00
technical Merge branch 'rs/daemon-plug-child-leak' into maint 2015-11-05 12:18:17 -08:00
.gitattributes
.gitignore
asciidoc.conf
blame-options.txt Documentation/blame-options: don't list date formats 2015-09-03 15:34:39 -07:00
build-docdep.perl
cat-texi.perl
cmd-list.perl command-list: prepare machinery for upcoming "common groups" section 2015-05-21 13:03:37 -07:00
CodingGuidelines Merge branch 'jg/cguide-we-cannot-count' into maint 2015-04-21 12:12:19 -07:00
config.txt Merge branch 'mc/push-recurse-submodules-config' 2015-12-21 10:59:05 -08:00
date-formats.txt Correct word usage of "timezone" in "Documentation" directory 2013-11-12 10:47:17 -08:00
diff-config.txt *config.txt: stick to camelCase naming convention 2015-03-13 22:13:46 -07:00
diff-format.txt diff-format doc: a score can follow M for rewrite 2015-01-28 22:22:03 -08:00
diff-generate-patch.txt doc: fix misrendering due to `single quote' 2015-05-12 22:13:39 -07:00
diff-options.txt Documentation/diff: give --word-diff-regex=. example 2015-11-24 18:38:46 -05:00
docbook-xsl.css
docbook.xsl
everyday.txto doc: add 'everyday' to 'git help' 2014-10-10 16:02:26 -07:00
fetch-options.txt *config.txt: stick to camelCase naming convention 2015-03-13 22:13:46 -07:00
fix-texi.perl
fmt-merge-msg-config.txt Documentation: include 'merge.branchdesc' for merge and config as well 2015-05-28 12:38:46 -07:00
git-add.txt Merge branch 'jk/asciidoc-markup-fix' into maint 2015-06-05 12:00:19 -07:00
git-am.txt Merge branch 'mm/keyid-docs' into maint 2015-10-16 14:32:33 -07:00
git-annotate.txt
git-apply.txt *config.txt: stick to camelCase naming convention 2015-03-13 22:13:46 -07:00
git-archimport.txt
git-archive.txt docs: clarify remote restrictions for git-upload-archive 2014-02-28 09:55:35 -08:00
git-bisect-lk2009.txt Merge branch 'jk/asciidoctor-section-heading-markup-fix' into maint 2015-10-16 14:32:53 -07:00
git-bisect.txt Merge branch 'xf/user-manual-markup' into maint 2015-11-04 14:20:47 -08:00
git-blame.txt blame: add blame.showEmail configuration 2015-06-01 15:50:43 -07:00
git-branch.txt Merge branch 'kn/for-each-branch' 2015-10-15 15:43:38 -07:00
git-bundle.txt
git-cat-file.txt usage: do not insist that standard input must come from a file 2015-10-16 15:27:52 -07:00
git-check-attr.txt usage: do not insist that standard input must come from a file 2015-10-16 15:27:52 -07:00
git-check-ignore.txt check-ignore: correct documentation about output 2015-11-24 17:13:36 -05:00
git-check-mailmap.txt builtin: add git-check-mailmap command 2013-07-13 10:19:37 -07:00
git-check-ref-format.txt Merge branch 'nd/doc-check-ref-format-typo' into maint 2015-12-11 11:14:15 -08:00
git-checkout-index.txt
git-checkout.txt checkout: add --progress option 2015-11-01 14:08:17 -08:00
git-cherry-pick.txt Documentation: explain optional arguments better 2015-09-21 10:48:23 -07:00
git-cherry.txt Documentation: revamp git-cherry(1) 2013-11-27 12:16:49 -08:00
git-citool.txt
git-clean.txt Merge branch 'mr/doc-clean-f-f' into maint 2015-03-13 22:56:12 -07:00
git-clone.txt clone: allow "--dissociate" without reference 2015-10-22 12:13:29 -07:00
git-column.txt doc: remote author/documentation sections from more pages 2014-01-27 08:34:34 -08:00
git-commit-tree.txt usage: do not insist that standard input must come from a file 2015-10-16 15:27:52 -07:00
git-commit.txt Documentation: explain optional arguments better 2015-09-21 10:48:23 -07:00
git-config.txt config: add '--name-only' option to list only variable names 2015-08-10 10:33:58 -07:00
git-count-objects.txt Documentation: fix misuses of "nor" 2014-03-31 15:16:22 -07:00
git-credential-cache--daemon.txt credential-cache: close stderr in daemon process 2014-09-16 11:11:58 -07:00
git-credential-cache.txt
git-credential-store.txt git-credential-store: support XDG_CONFIG_HOME 2015-03-24 08:08:02 -07:00
git-credential.txt Documentation: make AsciiDoc links always point to HTML files 2013-09-06 14:49:06 -07:00
git-cvsexportcommit.txt
git-cvsimport.txt Documentation: typofixes 2014-11-04 13:14:44 -08:00
git-cvsserver.txt *config.txt: stick to camelCase naming convention 2015-03-13 22:13:46 -07:00
git-daemon.txt Documentation: use "command-line" when used as a compound adjective, and fix other minor grammatical issues 2014-05-21 13:57:10 -07:00
git-describe.txt Merge branch 'sg/describe-contains' 2015-08-31 15:39:10 -07:00
git-diff-files.txt
git-diff-index.txt Documentation/diff-index: mention two modes of operation 2013-05-20 15:50:44 -07:00
git-diff-tree.txt
git-diff.txt Documentation: fix misuses of "nor" 2014-03-31 15:16:22 -07:00
git-difftool.txt difftool: add support for --trust-exit-code 2014-10-28 10:36:57 -07:00
git-fast-export.txt doc: convert \--option to --option 2015-05-12 22:14:46 -07:00
git-fast-import.txt Merge branch 'mh/fast-import-get-mark' 2015-08-03 11:01:23 -07:00
git-fetch-pack.txt doc: convert \--option to --option 2015-05-12 22:14:46 -07:00
git-fetch.txt Merge branch 'jc/em-dash-in-doc' into maint 2015-11-04 14:20:45 -08:00
git-filter-branch.txt Documentation: typofixes 2014-11-04 13:14:44 -08:00
git-fmt-merge-msg.txt usage: do not insist that standard input must come from a file 2015-10-16 15:27:52 -07:00
git-for-each-ref.txt tag: do not show ambiguous tag names as "tags/foo" 2016-01-26 13:34:10 -08:00
git-format-patch.txt format-patch: add an option to suppress commit hash 2015-12-15 10:03:40 -08:00
git-fsck-objects.txt
git-fsck.txt fsck: introduce git fsck --connectivity-only 2015-06-23 14:27:37 -07:00
git-gc.txt Merge branch 'jc/doc-gc-prune-now' into maint 2015-10-20 15:22:40 -07:00
git-get-tar-commit-id.txt usage: do not insist that standard input must come from a file 2015-10-16 15:27:52 -07:00
git-grep.txt Documentation: explain optional arguments better 2015-09-21 10:48:23 -07:00
git-gui.txt
git-hash-object.txt usage: do not insist that standard input must come from a file 2015-10-16 15:27:52 -07:00
git-help.txt Documentation: use "command-line" when used as a compound adjective, and fix other minor grammatical issues 2014-05-21 13:57:10 -07:00
git-http-backend.txt Merge branch 'jk/http-backend-deadlock' into maint 2015-06-16 14:33:45 -07:00
git-http-fetch.txt
git-http-push.txt
git-imap-send.txt imap-send: use cURL automatically when NO_OPENSSL defined 2015-03-10 15:19:05 -07:00
git-index-pack.txt clone: open a shortcut for connectivity check 2013-05-28 08:07:20 -07:00
git-init-db.txt
git-init.txt *config.txt: stick to camelCase naming convention 2015-03-13 22:13:46 -07:00
git-instaweb.txt *config.txt: stick to camelCase naming convention 2015-03-13 22:13:46 -07:00
git-interpret-trailers.txt Merge branch 'tk/doc-interpret-trailers-grammo' into maint 2015-10-16 14:32:56 -07:00
git-log.txt log: Update log.follow doc and add to config.txt 2015-10-07 10:37:48 -07:00
git-ls-files.txt Documentation: use "command-line" when used as a compound adjective, and fix other minor grammatical issues 2014-05-21 13:57:10 -07:00
git-ls-remote.txt ls-remote.txt: delete unsupported option 2015-09-28 11:07:04 -07:00
git-ls-tree.txt
git-mailinfo.txt git-mailinfo: add --message-id 2014-11-25 15:24:55 -08:00
git-mailsplit.txt
git-merge-base.txt merge-base: teach "--fork-point" mode 2013-10-29 13:06:08 -07:00
git-merge-file.txt merge-file: clamp exit code to maximum 127 2015-10-29 12:10:23 -07:00
git-merge-index.txt
git-merge-one-file.txt
git-merge-tree.txt use 'tree-ish' instead of 'treeish' 2013-09-04 15:02:56 -07:00
git-merge.txt Merge branch 'mm/keyid-docs' into maint 2015-10-16 14:32:33 -07:00
git-mergetool--lib.txt
git-mergetool.txt mergetool: document the default for --[no-]prompt 2014-04-24 11:29:05 -07:00
git-mktag.txt usage: do not insist that standard input must come from a file 2015-10-16 15:27:52 -07:00
git-mktree.txt
git-mv.txt mv: better document side effects when moving a submodule 2014-01-07 14:33:04 -08:00
git-name-rev.txt use 'commit-ish' instead of 'committish' 2013-09-04 15:03:03 -07:00
git-notes.txt Merge branch 'jk/notes-dwim-doc' into maint 2015-10-16 14:32:40 -07:00
git-p4.txt Merge branch 'ls/p4-keep-empty-commits' 2015-12-15 08:02:19 -08:00
git-pack-objects.txt doc: convert \--option to --option 2015-05-12 22:14:46 -07:00
git-pack-redundant.txt
git-pack-refs.txt Documentation: remove --prune from pack-refs examples 2013-07-18 16:23:46 -07:00
git-parse-remote.txt
git-patch-id.txt usage: do not insist that standard input must come from a file 2015-10-16 15:27:52 -07:00
git-prune-packed.txt Documentation: adjust document title underlining 2014-10-13 13:35:18 -07:00
git-prune.txt worktree: new place for "git prune --worktrees" 2015-06-29 08:48:44 -07:00
git-pull.txt pull: handle git-fetch's options as well 2015-06-02 13:36:22 -07:00
git-push.txt push: add recurseSubmodules config option 2015-11-20 08:02:07 -05:00
git-quiltimport.txt git-quiltimport: add commandline option --series <file> 2015-09-01 11:10:07 -07:00
git-read-tree.txt Documentation: use "command-line" when used as a compound adjective, and fix other minor grammatical issues 2014-05-21 13:57:10 -07:00
git-rebase.txt Merge branch 'jk/rebase-no-autostash' into maint 2015-12-08 14:05:01 -08:00
git-receive-pack.txt *config.txt: stick to camelCase naming convention 2015-03-13 22:13:46 -07:00
git-reflog.txt git-reflog: add exists command 2015-07-21 14:08:14 -07:00
git-relink.txt
git-remote-ext.txt doc: add some crossrefs between manual pages 2014-11-11 14:47:04 -08:00
git-remote-fd.txt doc: add some crossrefs between manual pages 2014-11-11 14:47:04 -08:00
git-remote-helpers.txto
git-remote-testgit.txt
git-remote.txt Merge branch 'xf/user-manual-markup' into maint 2015-11-04 14:20:47 -08:00
git-repack.txt *config.txt: stick to camelCase naming convention 2015-03-13 22:13:46 -07:00
git-replace.txt Merge branch 'cc/replace-graft' 2014-07-27 15:14:18 -07:00
git-request-pull.txt doc: show usage of branch description 2015-09-14 12:50:33 -07:00
git-rerere.txt *config.txt: stick to camelCase naming convention 2015-03-13 22:13:46 -07:00
git-reset.txt Merge branch 'jl/nor-or-nand-and' 2014-04-08 12:00:28 -07:00
git-rev-list.txt Merge branch 'jk/date-local' 2015-10-05 12:30:13 -07:00
git-rev-parse.txt rev-parse --parseopt: allow [*=?!] in argument hints 2015-07-15 10:30:54 -07:00
git-revert.txt Documentation: explain optional arguments better 2015-09-21 10:48:23 -07:00
git-rm.txt rm: better document side effects when removing a submodule 2014-01-07 14:34:06 -08:00
git-send-email.txt sendemail: teach git-send-email to dump alias names 2015-11-20 08:02:06 -05:00
git-send-pack.txt push: support signing pushes iff the server supports it 2015-08-19 12:58:45 -07:00
git-sh-i18n--envsubst.txt
git-sh-i18n.txt
git-sh-setup.txt Merge branch 'jc/reflog-doc' 2013-10-18 13:50:12 -07:00
git-shell.txt shell doc: remove stray "+" in example 2014-05-08 10:26:26 -07:00
git-shortlog.txt
git-show-branch.txt Documentation: fix misuses of "nor" 2014-03-31 15:16:22 -07:00
git-show-index.txt usage: do not insist that standard input must come from a file 2015-10-16 15:27:52 -07:00
git-show-ref.txt usage: do not insist that standard input must come from a file 2015-10-16 15:27:52 -07:00
git-show.txt doc: convert \--option to --option 2015-05-12 22:14:46 -07:00
git-stage.txt Documentation: adjust document title underlining 2014-10-13 13:35:18 -07:00
git-stash.txt stash: allow "stash show" diff output configurable 2015-08-31 11:29:04 -07:00
git-status.txt Documentation: explain optional arguments better 2015-09-21 10:48:23 -07:00
git-stripspace.txt usage: do not insist that standard input must come from a file 2015-10-16 15:27:52 -07:00
git-submodule.txt document submodule sync --recursive 2015-12-04 13:08:05 -08:00
git-svn.txt Merge branch 'br/svn-doc-include-paths-config' into maint 2015-09-17 12:11:46 -07:00
git-symbolic-ref.txt
git-tag.txt tag: do not show ambiguous tag names as "tags/foo" 2016-01-26 13:34:10 -08:00
git-tools.txt Documentation/git-tools: retire manually-maintained list 2015-07-28 13:21:59 -07:00
git-unpack-file.txt
git-unpack-objects.txt usage: do not insist that standard input must come from a file 2015-10-16 15:27:52 -07:00
git-update-index.txt Documentation/git-update-index: add missing opts to synopsis 2015-12-10 12:21:26 -08:00
git-update-ref.txt update-ref and tag: add --create-reflog arg 2015-07-21 14:08:35 -07:00
git-update-server-info.txt
git-upload-archive.txt Documentation: match underline with the text 2015-10-22 10:16:12 -07:00
git-upload-pack.txt
git-var.txt
git-verify-commit.txt verify-commit: add option to print raw gpg status information 2015-06-22 14:20:47 -07:00
git-verify-pack.txt git-verify-pack.txt: fix inconsistent spelling of "packfile" 2015-05-17 11:24:57 -07:00
git-verify-tag.txt verify-tag: add option to print raw gpg status information 2015-06-22 14:20:47 -07:00
git-web--browse.txt Documentation: use "command-line" when used as a compound adjective, and fix other minor grammatical issues 2014-05-21 13:57:10 -07:00
git-whatchanged.txt whatchanged: document its historical nature 2013-08-13 09:01:54 -07:00
git-worktree.txt worktree: add 'list' command 2015-10-08 11:57:14 -07:00
git-write-tree.txt
git.txt Git 2.7 2016-01-04 14:08:04 -08:00
gitattributes.txt userdiff: add support for Fountain documents 2015-07-23 14:44:51 -07:00
gitcli.txt Documentation: use "command-line" when used as a compound adjective, and fix other minor grammatical issues 2014-05-21 13:57:10 -07:00
gitcore-tutorial.txt Merge branch 'ja/tutorial-asciidoctor-fix' into maint 2015-06-05 12:00:22 -07:00
gitcredentials.txt *config.txt: stick to camelCase naming convention 2015-03-13 22:13:46 -07:00
gitcvs-migration.txt doc: add 'everyday' to 'git help' 2014-10-10 16:02:26 -07:00
gitdiffcore.txt doc: convert \--option to --option 2015-05-12 22:14:46 -07:00
giteveryday.txt Documentation/everyday: match undefline with the text 2015-10-22 10:14:44 -07:00
gitglossary.txt doc: add 'everyday' to 'git help' 2014-10-10 16:02:26 -07:00
githooks.txt receive-pack: support push-to-checkout hook 2015-01-08 14:28:43 -08:00
gitignore.txt Merge branch 'nd/ignore-then-not-ignore' 2015-10-07 13:38:17 -07:00
gitk.txt Documentation: change -L:<regex> to -L:<funcname> 2015-04-20 11:05:50 -07:00
gitmodules.txt submodule: improve documentation of update subcommand 2015-03-02 14:59:55 -08:00
gitnamespaces.txt
gitremote-helpers.txt gitremote-helpers.txt: document pushcert option 2015-08-19 12:41:38 -07:00
gitrepository-layout.txt Documentation/git-worktree: wordsmith worktree-related manpages 2015-07-20 11:07:18 -07:00
gitrevisions.txt Documentation: match underline with the text 2015-10-22 10:16:12 -07:00
gittutorial-2.txt Merge branch 'sn/tutorial-status-output-example' 2014-11-19 13:47:59 -08:00
gittutorial.txt Merge branch 'sn/tutorial-status-output-example' 2014-11-19 13:47:59 -08:00
gitweb.conf.txt Merge branch 'tf/gitweb-typofix' 2015-07-21 12:45:27 -07:00
gitweb.txt Documentation: fix documentation AsciiDoc links for external urls 2014-02-20 14:14:58 -08:00
gitworkflows.txt
glossary-content.txt refs: make refs/bisect/* per-worktree 2015-09-01 10:37:39 -07:00
howto-index.sh howto-index.sh: use the $( ... ) construct for command substitution 2014-04-17 11:14:57 -07:00
i18n.txt Documentation/i18n.txt: clarify character encoding support 2015-07-01 14:55:53 -07:00
install-doc-quick.sh
install-webdoc.sh install-webdoc.sh: use the $( ... ) construct for command substitution 2014-04-17 11:14:58 -07:00
line-range-format.txt Documentation: change -L:<regex> to -L:<funcname> 2015-04-20 11:05:50 -07:00
mailmap.txt
Makefile Documentation: fix version numbering 2015-01-22 13:44:14 -08:00
manpage-1.72.xsl
manpage-base-url.xsl.in
manpage-base.xsl
manpage-bold-literal.xsl
manpage-normal.xsl
manpage-quote-apos.xsl
manpage-suppress-sp.xsl
merge-config.txt Merge branch 'sg/merge-summary-config' into maint 2015-06-25 11:02:17 -07:00
merge-options.txt Documentation: fix misuses of "nor" 2014-03-31 15:16:22 -07:00
merge-strategies.txt Merge branch 'rr/doc-merge-strategies' into maint 2014-04-03 13:39:03 -07:00
pretty-formats.txt rev-list: make it obvious that we do not support notes 2015-08-24 10:33:15 -07:00
pretty-options.txt notes: correct documentation of DWIMery for notes references 2015-09-22 15:24:01 -07:00
pull-fetch-param.txt docs: Explain the purpose of fetch's and pull's <refspec> parameter. 2014-06-12 09:59:13 -07:00
rev-list-options.txt Merge branch 'jk/date-local' 2015-10-05 12:30:13 -07:00
revisions.txt sha1_name: implement @{push} shorthand 2015-05-22 09:33:08 -07:00
sequencer.txt
SubmittingPatches Merge branch 'jc/submitting-patches-mention-send-email' into maint 2015-03-28 09:33:10 -07:00
urls-remotes.txt Documentation: match underline with the text 2015-10-22 10:16:12 -07:00
urls.txt Merge branch 'ft/doc-git-transport' into maint 2013-07-21 22:51:24 -07:00
user-manual.conf
user-manual.txt Merge branch 'xf/user-manual-ff' into maint 2015-11-04 14:20:49 -08:00