summaryrefslogtreecommitdiff
path: root/contrib/examples
diff options
context:
space:
mode:
authorPetr Baudis <pasky@suse.cz>2008-07-08 17:48:04 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-07-09 05:46:01 (GMT)
commit31a92f6aa47732e93f6685b8d1fd1ac09c1fec44 (patch)
tree06cfcea954c5772d5ff8f4ff4b0ee54b4b449091 /contrib/examples
parente896912c5edb8f989a2d25e101b2eb14f1a56aa9 (diff)
downloadgit-31a92f6aa47732e93f6685b8d1fd1ac09c1fec44.zip
git-31a92f6aa47732e93f6685b8d1fd1ac09c1fec44.tar.gz
git-31a92f6aa47732e93f6685b8d1fd1ac09c1fec44.tar.bz2
Git.pm: Add remote_refs() git-ls-remote frontend
This patch also converts the good ole' git-remote.perl to use it. It is otherwise used in the repo.or.cz machinery and I guess other scripts might find it useful too. Unfortunately, git-ls-remote --heads . is subtly different from git-ls-remote . refs/heads/ (since the second matches anywhere in the string, not just at the beginning) so we have to provide interface for both. Signed-off-by: Petr Baudis <pasky@suse.cz> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/examples')
-rwxr-xr-xcontrib/examples/git-remote.perl5
1 files changed, 1 insertions, 4 deletions
diff --git a/contrib/examples/git-remote.perl b/contrib/examples/git-remote.perl
index b30ed73..36bd54c 100755
--- a/contrib/examples/git-remote.perl
+++ b/contrib/examples/git-remote.perl
@@ -129,10 +129,7 @@ sub update_ls_remote {
return if (($harder == 0) ||
(($harder == 1) && exists $info->{'LS_REMOTE'}));
- my @ref = map {
- s|^[0-9a-f]{40}\s+refs/heads/||;
- $_;
- } $git->command(qw(ls-remote --heads), $info->{'URL'});
+ my @ref = map { s|refs/heads/||; $_; } keys %{$git->remote_refs($info->{'URL'}, [ 'heads' ])};
$info->{'LS_REMOTE'} = \@ref;
}