mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <>
To: Bryan Turner <>
Cc: David Carson <>,
	"" <>
Subject: Re: add 'ls-remote' option to limit output records
Date: Wed, 1 May 2019 14:23:23 -0400	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Fri, Apr 26, 2019 at 12:32:51PM -0700, Bryan Turner wrote:

> >         $ git ls-remote -n1 --tags --sort=v:refname origin "v*"
> [...]
> With the v2 wire protocol, the client could provide a prefix (like
> `refs/tags/`, or potentially `refs/tags/v`) to reduce what the server
> included in the ref advertisement, but even the v2 protocol doesn't
> have anything for telling the server "Version parse these names and
> then return the first N". That means the parsing, sorting and trimming
> for the advertised tags would still all have to happen locally. (I'm
> sure someone can correct me if I've misstated what protocol v2 can do
> for filtering, but I don't see any "ls-refs" options that look like
> they enable anything other than prefix matching.)

No, that sounds right. The "--tags" in the original command should cause
v2 to ask only for refs/tags/. But because of the way ls-remote matching
works, "v*" is not a pure prefix match, and would find
"refs/tags/foo/v1.2.3". So we can't use protocol-level matching to ask
for "refs/tags/v*".

There are no provisions in the protocol for sorting, nor for limiting
the output.

I didn't check, but I suspect some hosting-platform APIs might be able
to answer this with a single query.


      reply	other threads:[~2019-05-01 18:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-26 18:56 add 'ls-remote' option to limit output records David Carson
2019-04-26 19:32 ` Bryan Turner
2019-05-01 18:23   ` Jeff King [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).