git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: William Blevins <wblevins001@gmail.com>, git@vger.kernel.org
Subject: Re: Unexpected (bug-like) behavior in `git ls-remote` matching.
Date: Wed, 08 Feb 2023 09:40:06 -0800	[thread overview]
Message-ID: <xmqq357gt5s9.fsf@gitster.g> (raw)
In-Reply-To: <Y+POCxHMzrZj2bwz@coredump.intra.peff.net> (Jeff King's message of "Wed, 8 Feb 2023 11:30:03 -0500")

Jeff King <peff@peff.net> writes:

> I think the tail-matching behavior is not what we would probably choose
> today, but that is how it has behaved since 2005, and we are not going
> to break backwards compatibility in a plumbing tool like ls-remote.

The tail-matching behaviour that was Linus's preference (his
show-ref behaves the same way) has one interesting feature---looking
for all 'master' branches in different hierarchies is trivial.

In today's world, it would be tremendously benefitial if "ls-remote"
can trim not just the communication between the repositories but
also the enumeration of the ref namespace at the source repository
using the pattern, and tail-matching would not contribute to it at
all (unless if your server side adds special index).  If we used
prefix matching, our refs API can take advantage of it in reducing
the cost to enumerate refs, and on-the-wire protocol has ref-prefix
capability to help it.

> Likewise, something more elaborate like full-path globbing or even
> regex matching would be possible, but would need to be activated by an
> option.

True.  We should be able to do a bit better than just tail-matching
with an option.

I would not recommend sending over regex as protocol capability the
same way as ref-prefix works, unless we adopt something that can
match linear-time like re2 and use it everywhere, as you can send a
pattern that is deliberately made inefficient to inconvenience the
other side.

Thanks.

  parent reply	other threads:[~2023-02-08 17:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-07 23:03 Unexpected (bug-like) behavior in `git ls-remote` matching William Blevins
2023-02-08  7:20 ` Junio C Hamano
2023-02-08 13:49   ` William Blevins
2023-02-08 14:51     ` Philip Oakley
2023-02-08 16:30     ` Jeff King
2023-02-08 16:33       ` Jeff King
2023-02-08 17:46         ` Junio C Hamano
2023-02-08 17:40       ` Junio C Hamano [this message]
2023-02-09 13:15         ` Jeff King
2023-02-09 19:43           ` Junio C Hamano
2023-02-11  2:41             ` Jeff King
2023-02-11  2:44               ` [PATCH 1/2] doc/ls-remote: cosmetic cleanups for examples Jeff King
2023-02-11  2:44               ` [PATCH 2/2] doc/ls-remote: clarify pattern format Jeff King
2023-02-11  2:54                 ` Junio C Hamano
2023-02-11  4:52                   ` [PATCH v2 " Jeff King
2023-02-08 14:08 ` Unexpected (bug-like) behavior in `git ls-remote` matching Ævar Arnfjörð Bjarmason

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=xmqq357gt5s9.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=wblevins001@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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.
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 NNTP newsgroup(s).