From baebde7d19a9281242f4542267b70e2565f63886 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Fri, 10 Feb 2023 21:44:13 -0500 Subject: doc/ls-remote: cosmetic cleanups for examples There are effectively three example commands and their output, but they're smushed together with no extra whitespace. Let's add some blank lines to make them more readable. Likewise, the first example uses "./." to refer to the path of the current repository, which is somewhat distracting. That may have been necessary back in 2005 when it was added, but we can just say "." these days. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- Documentation/git-ls-remote.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/git-ls-remote.txt b/Documentation/git-ls-remote.txt index 492e573856..f17567945f 100644 --- a/Documentation/git-ls-remote.txt +++ b/Documentation/git-ls-remote.txt @@ -95,15 +95,17 @@ EXAMPLES -------- ---- -$ git ls-remote --tags ./. +$ git ls-remote --tags . d6602ec5194c87b0fc87103ca4d67251c76f233a refs/tags/v0.99 f25a265a342aed6041ab0cc484224d9ca54b6f41 refs/tags/v0.99.1 7ceca275d047c90c0c7d5afb13ab97efdf51bd6e refs/tags/v0.99.3 c5db5456ae3b0873fc659c19fafdde22313cc441 refs/tags/v0.99.2 0918385dbd9656cab0d1d81ba7453d49bbc16250 refs/tags/junio-gpg-pub + $ git ls-remote http://www.kernel.org/pub/scm/git/git.git master seen rc 5fe978a5381f1fbad26a80e682ddd2a401966740 refs/heads/master c781a84b5204fb294c9ccc79f8b3baceeb32c061 refs/heads/seen + $ git remote add korg http://www.kernel.org/pub/scm/git/git.git $ git ls-remote --tags korg v\* d6602ec5194c87b0fc87103ca4d67251c76f233a refs/tags/v0.99 -- cgit v1.2.3 From d9ec3b0dc0fe51b4e56df5a809d3a1f8d83b89eb Mon Sep 17 00:00:00 2001 From: Jeff King Date: Fri, 10 Feb 2023 23:52:56 -0500 Subject: 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 Signed-off-by: Junio C Hamano --- Documentation/git-ls-remote.txt | 15 ++++++++++----- builtin/ls-remote.c | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Documentation/git-ls-remote.txt b/Documentation/git-ls-remote.txt index f17567945f..ff3da547dd 100644 --- a/Documentation/git-ls-remote.txt +++ b/Documentation/git-ls-remote.txt @@ -11,7 +11,7 @@ SYNOPSIS [verse] 'git ls-remote' [--heads] [--tags] [--refs] [--upload-pack=] [-q | --quiet] [--exit-code] [--get-url] [--sort=] - [--symref] [ [...]] + [--symref] [ [...]] DESCRIPTION ----------- @@ -85,11 +85,16 @@ OPTIONS either a URL or the name of a remote (see the GIT URLS and REMOTES sections of linkgit:git-fetch[1]). -...:: +...:: When unspecified, all references, after filtering done - with --heads and --tags, are shown. When ... are - specified, only references matching the given patterns - are displayed. + with --heads and --tags, are shown. When ... are + specified, only references matching one or more of the given + 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 -------- diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c index 5d5ac03871..6516177348 100644 --- a/builtin/ls-remote.c +++ b/builtin/ls-remote.c @@ -8,7 +8,7 @@ static const char * const ls_remote_usage[] = { N_("git ls-remote [--heads] [--tags] [--refs] [--upload-pack=]\n" " [-q | --quiet] [--exit-code] [--get-url] [--sort=]\n" - " [--symref] [ [...]]"), + " [--symref] [ [...]]"), NULL }; -- cgit v1.2.3