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

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Wed, 08 Feb 2023 15:08:56 +0100

On Tue, Feb 07 2023, William Blevins wrote:

> Setup as follows.
>
> example repo: [email-masked]: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 [email-masked]:owner/repo.git ABC-
> $ git ls-remote --heads [email-masked]:owner/repo.git BC-1
> $ git ls-remote --heads [email-masked]:owner/repo.git XBC-1
> <ref>    refs/head/XBC-1
> $ git ls-remote --heads [email-masked]: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 [email-masked]: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 [email-masked]: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.