Subject: Re: [PATCH 2/6] remote.c: drop "remote" pointer from "struct branch"

From: Junio C Hamano <[email-masked]>
Date: Tue, 31 Mar 2015 15:29:48 -0700

Jeff King <[email-masked]> writes:

> On Tue, Mar 31, 2015 at 01:50:05PM -0700, Junio C Hamano wrote:
>
>> it first looked somewhat unnatural that you kept the name with which
>> you need to trigger a search for the structure, instead of keeping
>> the structure, one of whose field is its name already.
> ...
> That is the reason I was trying to explain above. Though I suppose you
> could argue that remote_name suffers the same question (i.e., would we
> ever set it to "origin"?)

Well, another would be that by keeping remote_name and making remote
on-demand, we may still have to keep all the defined branches in
core but we do not have to instanciate all the remotes, if each
branch only knows the remote_name.  A single look-up may be cheap
but that is not a good reason to do one-per-each-branch if we do not
need to.

> It is much worse for pushremotes, which can come from
> branch.*.pushremote, remote.pushdefault, branch.*.remote, or "origin".
>
> I'll try to re-word the commit message.

Thanks.