# Where has "git ls-remote" reference pattern matching gone?

4 messages from 2007-12-08 to 2007-12-09. Participants: Eyvind Bernhardsen, Junio C Hamano, Daniel Barkalow.
Thread: https://gitlist.dev/t/11202

## Eyvind Bernhardsen, 2007-12-08 22:05

Subject: Where has "git ls-remote" reference pattern matching gone?
Message-ID: <4E5E5B1E-A303-45C9-9944-57D54FD50F80@orakel.ntnu.no>
URL: https://gitlist.dev/e/4E5E5B1E-A303-45C9-9944-57D54FD50F80%40orakel.ntnu.no

```
git-ls-remote(1) says that ls-remote supports filtering by reference  
name:


> SYNOPSIS
>        git-ls-remote [--heads] [--tags]  [-u <exec> | --upload-pack  
> <exec>]
>                      <repository> <refs>...
>
> [...]
>
>        <refs>...
>               When unspecified, all references, after filtering done  
> with
>               --heads and --tags, are shown. When <refs>... are  
> specified,
>               only references matching the given patterns are  
> displayed.
>
> [...]
>
>        $ git ls-remote --tags public v\*
>        d6602ec5194c87b0fc87103ca4d67251c76f233a        refs/tags/v0.99
>        f25a265a342aed6041ab0cc484224d9ca54b6f41        refs/tags/ 
> v0.99.1
>        c5db5456ae3b0873fc659c19fafdde22313cc441        refs/tags/ 
> v0.99.2
>        7ceca275d047c90c0c7d5afb13ab97efdf51bd6e        refs/tags/ 
> v0.99.3

But when I try to use the <refs> argument on a current build of git  
(git version v1.5.3.7-1112-g9758ecd), I just get its usage message,  
which doesn't mention that argument:

> vredefort:[backup]% git ls-remote origin foob
> usage: git-ls-remote [--upload-pack=<git-upload-pack>]  
> [<host>:]<directory>


ls-remote was recently made a builtin; was reference filtering  
deliberately removed, or was it just lost in translation from the  
shell script?

Eyvind Bernhardsen

```

## Junio C Hamano, 2007-12-09 01:34

Subject: Re: Where has "git ls-remote" reference pattern matching gone?
Message-ID: <7vve78tzw1.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vve78tzw1.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <4E5E5B1E-A303-45C9-9944-57D54FD50F80@orakel.ntnu.no>

```
Eyvind Bernhardsen <eyvind-git@orakel.ntnu.no> writes:

> ls-remote was recently made a builtin; was reference filtering
> deliberately removed, or was it just lost in translation from the
> shell script?

I suspect that to be the case.  Daniel, I think this is yours.

```

## Daniel Barkalow, 2007-12-09 02:20

Subject: Re: Where has "git ls-remote" reference pattern matching gone?
Message-ID: <Pine.LNX.4.64.0712082048570.5349@iabervon.org>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0712082048570.5349%40iabervon.org
In-Reply-To: <7vve78tzw1.fsf@gitster.siamese.dyndns.org>

```
On Sat, 8 Dec 2007, Junio C Hamano wrote:

> Eyvind Bernhardsen <eyvind-git@orakel.ntnu.no> writes:
> 
> > ls-remote was recently made a builtin; was reference filtering
> > deliberately removed, or was it just lost in translation from the
> > shell script?
> 
> I suspect that to be the case.  Daniel, I think this is yours.

Ah, sure enough. I didn't see that feature there, I guess. Am I right that 
it's supposed to have "git ls-remote origin db/*" return refs of the 
form "*/db/*", interpreted as for globs?

Eyvind: can I get a test case? I haven't ever used this feature, and I'm 
not sure I'll implement it correctly.

	-Daniel
*This .sig left intentionally blank*

```

## Eyvind Bernhardsen, 2007-12-09 15:38

Subject: Re: Where has "git ls-remote" reference pattern matching gone?
Message-ID: <135A5AE4-45F9-47BC-8727-68C6680B6EEF@orakel.ntnu.no>
URL: https://gitlist.dev/e/135A5AE4-45F9-47BC-8727-68C6680B6EEF%40orakel.ntnu.no
In-Reply-To: <Pine.LNX.4.64.0712082048570.5349@iabervon.org>

```
On 9. des.. 2007, at 03.20, Daniel Barkalow wrote:

> On Sat, 8 Dec 2007, Junio C Hamano wrote:
>
>> Eyvind Bernhardsen <eyvind-git@orakel.ntnu.no> writes:
>>
>>> ls-remote was recently made a builtin; was reference filtering
>>> deliberately removed, or was it just lost in translation from the
>>> shell script?
>>
>> I suspect that to be the case.  Daniel, I think this is yours.
>
> Ah, sure enough. I didn't see that feature there, I guess. Am I  
> right that
> it's supposed to have "git ls-remote origin db/*" return refs of the
> form "*/db/*", interpreted as for globs?
>
> Eyvind: can I get a test case? I haven't ever used this feature, and  
> I'm
> not sure I'll implement it correctly.

I've noticed that a fix made it to master already; that's fast work by  
you and Junio!  Unfortunately, it fails the test case I was going to  
suggest, which is the one in the ls-remote manpage (see my response in  
the patch thread).

I haven't used the ref matching for anything (yet), so I don't have  
any other test cases.

Eyvind Bernhardsen

```
