From: Jakub Narebski <jnareb@gmail.com>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] gitweb: Make git_get_refs_list do work of git_get_references
Date: Thu, 21 Sep 2006 00:40:52 +0200 [thread overview]
Message-ID: <200609210040.52886.jnareb@gmail.com> (raw)
In-Reply-To: <7veju6h0et.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
> Jakub Narebski wrote:
>> + if (! $4) { # unpeeled, direct reference
>> + push @refs, { hash => $1, name => $3 }; # without type
>> + } elsif ($3 eq $refs[-1]{'name'}) {
>> + # most likely a tag is followed by its peeled
>> + # (deref) one, and when that happens we know the
>> + # previous one was of type 'tag'.
>> + $refs[-1]{'type'} = "tag";
>> + }
>>...
>> - return \@reflist;
>> + return (\@reflist, \%refs);
>
> You are maintaining reflist (an array of hashrefs each element
> of which describes name, type, hash and other parse_ref()
> information for the ref) and refs (a hash that maps from name to
> hash) separatly. I wonder if this really has the performance
> advantage over just compute and return reflist from here and
> have the callers who need the mapping to derive it from the list
> (i.e.
>
> my ($reflist) = git_get_refs_list();
> my %refs = map { $_->{name} => $_->{hash} } @$reflist;
> ).
The %refs hash contain also map from peeled (dereferenced) object
to ref name. The information about derefs is not present in @reflist.
So the answer is that you can't derive %refs from @reflist.
--
Jakub Narebski
ShadeHawk on #git
Poland
next prev parent reply other threads:[~2006-09-20 22:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-19 12:30 [PATCH 0/2] Make git_get_refs_list do work of git_get_references Jakub Narebski
2006-09-19 12:31 ` [PATCH 1/2] gitweb: Always use git-peek-remote in git_get_references Jakub Narebski
2006-09-20 16:09 ` Junio C Hamano
2006-09-20 18:13 ` Jakub Narebski
2006-09-21 9:07 ` Andreas Ericsson
2006-09-19 12:33 ` [PATCH 2/2] gitweb: Make git_get_refs_list do work of git_get_references Jakub Narebski
2006-09-20 18:12 ` Junio C Hamano
2006-09-20 22:40 ` Jakub Narebski [this message]
2006-09-20 23:14 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200609210040.52886.jnareb@gmail.com \
--to=jnareb@gmail.com \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).