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
Petr Baudis <pasky@suse.cz>
Date
Aug 26, 2007, 09:58 UTC
Message-ID
<20070826095836.GG1219@pasky.or.cz>
In-Reply-To
<7v6432udje.fsf@gitster.siamese.dyndns.org>
On Sun, Aug 26, 2007 at 06:26:29AM CEST, Junio C Hamano wrote:
Show 22 quoted lines
> Petr Baudis <pasky@suse.cz> writes:
> 
> > diff --git a/git-remote.perl b/git-remote.perl
> > index 01cf480..8ce8418 100755
> > --- a/git-remote.perl
> > +++ b/git-remote.perl
> > @@ -128,10 +128,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 = keys %{$git->remote_refs($info->{'URL'}, [ 'heads' ])};
> >  	$info->{'LS_REMOTE'} = \@ref;
> >  }
> 
> IIRC, ls-remote returns refs sorted and this function returns
> them as it receives.
> 
> Doesn't this change make @ref randomly ordered?  

Yes, but I couldn't find any place in git-remote.perl where we rely on the @ref ordering - maybe I'm blind...

-- 
				Petr "Pasky" Baudis
Ever try. Ever fail. No matter. // Try again. Fail again. Fail better.
		-- Samuel Beckett
Previous: Junio C HamanoNext: Jakub Narebski
Message 3 of 9 in “Git.pm: Add remote_refs() git-ls-remote frontend”
  1. Git.pm: Add remote_refs() git-ls-remote frontendPetr Baudis, Aug 25, 2007
  2. Junio C HamanoAug 26, 2007
  3. Petr BaudisAug 26, 2007
  4. Jakub NarebskiAug 30, 2007
  5. Petr BaudisAug 30, 2007
  6. Git.pm: Add remote_refs() git-ls-remote frontendPetr Baudis, Aug 30, 2007
  7. Junio C HamanoAug 31, 2007
  8. Petr BaudisAug 31, 2007
  9. Junio C HamanoAug 31, 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.