git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] doc/ls-remote: clarify pattern format

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 11, 2023, 02:54 UTC
Message-ID
<xmqq5yc8gbec.fsf@gitster.g>
In-Reply-To
<Y+cBFF0OPSq8DGnA@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 25 quoted lines
> 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", 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>
> ---
>  Documentation/git-ls-remote.txt | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/Documentation/git-ls-remote.txt b/Documentation/git-ls-remote.txt
> index f17567945f..2a941292a4 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=<exec>]
>  	      [-q | --quiet] [--exit-code] [--get-url] [--sort=<key>]
> -	      [--symref] [<repository> [<refs>...]]
> +	      [--symref] [<repository> [<patterns>...]]
Micronit.
builtin/ls-remote.c::ls_remote_usage[] needs a matching update.
Show 19 quoted lines
>  
>  DESCRIPTION
>  -----------
> @@ -85,11 +85,14 @@ OPTIONS
>  	either a URL or the name of a remote (see the GIT URLS and
>  	REMOTES sections of linkgit:git-fetch[1]).
>  
> -<refs>...::
> +<patterns>...::
>  	When unspecified, all references, after filtering done
> -	with --heads and --tags, are shown.  When <refs>... are
> -	specified, only references matching the given patterns
> -	are displayed.
> +	with --heads and --tags, are shown.  When <patterns>... 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 from a slash separator (so `bar`
> +	matches `refs/heads/bar` but not `refs/heads/foobar`).

Good. Is it too obvious that the pattern `refs/heads/bar` matches the ref `refs/heads/bar`, even though it becomes fuzzy what "starting from a slash separator" means in such a scenario?

Previous: Jeff KingNext: Jeff King
Message 14 of 16 in “Unexpected (bug-like) behavior in `git ls-remote` matching.”
  1. William BlevinsFeb 7, 2023
  2. Junio C HamanoFeb 8, 2023
  3. William BlevinsFeb 8, 2023
  4. Philip OakleyFeb 8, 2023
  5. Jeff KingFeb 8, 2023
  6. Jeff KingFeb 8, 2023
  7. Junio C HamanoFeb 8, 2023
  8. Junio C HamanoFeb 8, 2023
  9. Jeff KingFeb 9, 2023
  10. Junio C HamanoFeb 9, 2023
  11. Jeff KingFeb 11, 2023
  12. 1/2 doc/ls-remote: cosmetic cleanups for examplesJeff King, Feb 11, 2023
  13. 2/2 doc/ls-remote: clarify pattern formatJeff King, Feb 11, 2023
  14. Junio C HamanoFeb 11, 2023
  15. 2/2 doc/ls-remote: clarify pattern formatJeff King, Feb 11, 2023
  16. Ævar Arnfjörð BjarmasonFeb 8, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.