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

Re: [PATCH] Git.pm: Add remote_refs() git-ls-remote frontend

From
Junio C Hamano <junkio@cox.net>
Date
May 17, 2007, 05:58 UTC
Message-ID
<7vk5v89ek8.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20070517023743.1982.41240.stgit@rover>
Petr Baudis <pasky@suse.cz> writes:
Show 9 quoted lines
> .... Too bad that
>
> 	git-ls-remote --heads .
> 	
> is subtly different from
>
> 	git-ls-remote . refs/heads/
>
> so we have to provide the interface for specifying both.

I've already heard you say the above elsewhere, but I am not sure what you exactly mean here. Mind substantiating it a bit more clearly?

I think "ls-remote --heads ." is just a special case of giving "refs/heads/*" as the glob pattern:

        $ git ls-remote --heads . | head -n 3
        3545193735522f733fdb4e345f16ddf131e2007a	refs/heads/ap/ident
        b7993dd57a9cfd5b989f0e2cc5d271a524339318	refs/heads/db/remote
        960ccca6803c9fb57429d43572a9545a96107e32	refs/heads/dh/pack
	$ git ls-remote . refs/heads/ | wc -l
        0
	$ git ls-remote . "refs/heads/*" | head -n 3
        3545193735522f733fdb4e345f16ddf131e2007a	refs/heads/ap/ident
        b7993dd57a9cfd5b989f0e2cc5d271a524339318	refs/heads/db/remote
        960ccca6803c9fb57429d43572a9545a96107e32	refs/heads/dh/pack
	$ git ls-remote . "refs/heads/???/*"
        7841ce79854868eaaa146c1d018b17fc4f3320be	refs/heads/mst/connect
        $ git ls-remote . "refs/*/jc/*" | head -n 4
        80a767ba3b1c69fc41fa5f5fbe4a247757a9c575	refs/heads/jc/blame
        a1481ab7b16c51d4ec7925fd9b38d9cf21f72263	refs/heads/jc/diff
        4e8daa0dca5deb9d391538241939a2a2ad6d36b8	refs/tags/hold/jc/3way
        ff77ab7919e6f31cb6c58bc004217e624b553fb6	refs/tags/hold/jc/changes

So if you really do not want separate interfaces, I think you could just implement --heads as what it is: a shorthand for "refs/heads/*".

Previous: Petr BaudisNext: Petr Baudis
Message 2 of 3 in “Git.pm: Add remote_refs() git-ls-remote frontend”
  1. Git.pm: Add remote_refs() git-ls-remote frontendPetr Baudis, May 17, 2007
  2. Junio C HamanoMay 17, 2007
  3. Petr BaudisMay 17, 2007

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.