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

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

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Feb 8, 2023, 14:08 UTC
Message-ID
<230208.86o7q4z1jr.gmgdl@evledraar.gmail.com>
In-Reply-To
<CALJHx121C+=mAmfWxko0PUy1QBjfezM4ft6uE1+cyiH3gaLQ2w@mail.gmail.com>
On Tue, Feb 07 2023, William Blevins wrote:
Show 30 quoted lines
> Setup as follows.
>
> example repo: git@github.com:owner/repo.git
> example branches:
> * ABC-1
> * feature/ABC-1
> * XBC-1
> * EABC-1
>
> These are all things that work as "expected".
> ```
> $ git ls-remote --heads git@github.com:owner/repo.git ABC-
> $ git ls-remote --heads git@github.com:owner/repo.git BC-1
> $ git ls-remote --heads git@github.com:owner/repo.git XBC-1
> <ref>    refs/head/XBC-1
> $ git ls-remote --heads git@github.com:owner/repo.git *BC-1
> <ref>    refs/head/ABC-1
> <ref>    refs/head/EABC-1
> <ref>    refs/head/XBC-1
> <ref>    refs/head/feature/ABC-1
> $ git ls-remote --heads git@github.com:owner/repo.git "[^/]ABC-1"
> <ref>    refs/head/EABC-1
> ```
>
> What is totally unexpected.... is the most simple search for ABC-1...
> ```
> $ git ls-remote --heads git@github.com:owner/repo.git ABC-1
> <ref>    refs/head/ABC-1
> <ref>    refs/head/feature/ABC-1
> ```

Aside from what Junio mentioned, I don't see why you'd think that the result for "ABC-1" and "BC-1" is correct if you'd like your "ABC-1" query to also find "EABC-1", but maybe I'm missing something obvious.

Previous: Jeff King
Message 16 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.