doc/ls-remote: clarify pattern format

We document that you can specify "refs" to ls-remote, but we don't
explain any further than that they are "matched" as patterns. Since this
can be interpreted in a lot of ways, let's clarify that they are
tail-matched globs.

Likewise, let's use the word "patterns" to refer to them consistently,
rather than "refs" (both here and in the quick "-h" help), and mention
more explicitly that only one pattern needs to be matched (though there
is also an example already that shows this in action).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff King 2023-02-10 23:52:56 -05:00 committed by Junio C Hamano
parent baebde7d19
commit d9ec3b0dc0
2 changed files with 11 additions and 6 deletions

View File

@ -11,7 +11,7 @@ SYNOPSIS
[verse] [verse]
'git ls-remote' [--heads] [--tags] [--refs] [--upload-pack=<exec>] 'git ls-remote' [--heads] [--tags] [--refs] [--upload-pack=<exec>]
[-q | --quiet] [--exit-code] [--get-url] [--sort=<key>] [-q | --quiet] [--exit-code] [--get-url] [--sort=<key>]
[--symref] [<repository> [<refs>...]] [--symref] [<repository> [<patterns>...]]
DESCRIPTION DESCRIPTION
----------- -----------
@ -85,11 +85,16 @@ OPTIONS
either a URL or the name of a remote (see the GIT URLS and either a URL or the name of a remote (see the GIT URLS and
REMOTES sections of linkgit:git-fetch[1]). REMOTES sections of linkgit:git-fetch[1]).
<refs>...:: <patterns>...::
When unspecified, all references, after filtering done When unspecified, all references, after filtering done
with --heads and --tags, are shown. When <refs>... are with --heads and --tags, are shown. When <patterns>... are
specified, only references matching the given patterns specified, only references matching one or more of the given
are displayed. patterns are displayed. Each pattern is interpreted as a glob
(see `glob` in linkgit:gitglossary[7]) which is matched against
the "tail" of a ref, starting either from the start of the ref
(so a full name like `refs/heads/foo` matches) or from a slash
separator (so `bar` matches `refs/heads/bar` but not
`refs/heads/foobar`).
EXAMPLES EXAMPLES
-------- --------

View File

@ -8,7 +8,7 @@
static const char * const ls_remote_usage[] = { static const char * const ls_remote_usage[] = {
N_("git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n" N_("git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n"
" [-q | --quiet] [--exit-code] [--get-url] [--sort=<key>]\n" " [-q | --quiet] [--exit-code] [--get-url] [--sort=<key>]\n"
" [--symref] [<repository> [<refs>...]]"), " [--symref] [<repository> [<patterns>...]]"),
NULL NULL
}; };