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

Re: Unexpected (bug-like) behavior in `git ls-remote` matching.

From
Jeff King <peff@peff.net>
Date
Feb 8, 2023, 16:33 UTC
Message-ID
<Y+POvZLrtfm/qQwp@coredump.intra.peff.net>
In-Reply-To
<Y+POCxHMzrZj2bwz@coredump.intra.peff.net>
On Wed, Feb 08, 2023 at 11:30:04AM -0500, Jeff King wrote:
Show 17 quoted lines
> See commit 631f0f8c4b (ls-remote: do not send ref prefixes for patterns,
> 2018-10-31), which also adds a test. However, it was just handling
> existing behavior (which in fact confused another developer and caused a
> bug which the commit was fixing!).
> 
> 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.
> 
> There's some discussion in this thread about adding a new option to do
> prefix-matching, but I don't think any code was ever written:
> 
>   https://lore.kernel.org/git/m2k12g7v5u.fsf@gmail.com/
> 
> Likewise, something more elaborate like full-path globbing or even
> regex matching would be possible, but would need to be activated by an
> option.

Oh, and I forgot to mention: the documentation for ls-remote is quite weak here, and simply says "matching" without defining it. So the most obvious improvement is fixing that documentation to describe the current rules (which AFAIK is basically matching the pattern as a glob, but with an implicit "/" anchor, but somebody should double check the code before writing a documentation patch).

-Peff
Previous: Jeff KingNext: Junio C Hamano
Message 6 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.