Re: [PATCH] Git.pm: Add remote_refs() git-ls-remote frontend
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:10
Petr Baudis [off-list ref] writes:
.... 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/*".