git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Samuel Tardieu <sam@rfc1149.net>, git@vger.kernel.org
Subject: Re: Remotes order in "git remote update"
Date: Mon, 10 Mar 2008 12:21:42 -0700	[thread overview]
Message-ID: <7v3aqyjsft.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <alpine.LSU.1.00.0803101212220.3975@racer.site> (Johannes Schindelin's message of "Mon, 10 Mar 2008 12:13:43 +0100 (CET)")

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> On Mon, 10 Mar 2008, Samuel Tardieu wrote:
>
>> On  9/03, Johannes Schindelin wrote:
>> 
>> | Well, technically this is a regression.
>> | 
>> | If you really want to order your remotes, why not add something like
>> | 
>> | [remotes]
>> | 	default = my-first-remote my-second-remote [...]
>> | 
>> | to the config?  That is what the (recently fixed in builtin-remote) 
>> | remote groups are for...
>> 
>> I could do that, but it means that if I add a new remote, it won't enter 
>> the default group by itself since I defined it explicitely. I think 
>> respecting the order given in the .git/config file when not using a 
>> group doesn't hurt and may help.
>
> Well, since the builtin remote does that, I do not see a reason to change 
> it ;-)  However, I do not see a reason to guarantee that, either.

I think it is a reasonable expectation that, if you have these in the
configuration file (not limited to "remotes" but for a random "a"):

	[a "foo"]
        	x = "frotz"
                x = "xyzzy"
	[a "bar"]
        	x = "nitfol"
                x = "rezrov"

something that _iterates_ over a.*.* would see them in the order of
appearance (foo.frotz, foo.xyzzy, bar.nitfol and then bar.rezrov).

If you need both iterable and also quick lookup (e.g. when there can be
thousands of "foo" and "bar" for a particular "a" and it is common to ask
for "a.$name.x" for random $name), the config reader for "a" needs to
have an implementation that is better than just a naive linear list.
Maybe it can use a hashed table whose entry records the appearance order
in the configuration file, expecting that a look-up is far more common
operation than enumeration, and when somebody asks you to enumerate, you
can create a sorted list on-demand and iterate on that.  The
implementation would be different depending on the expected usage pattern,
but I do not see much to gain for us by reserving the right to enumerate
things in a random order.

      reply	other threads:[~2008-03-10 19:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-09 10:22 Remotes order in "git remote update" Samuel Tardieu
2008-03-09 10:38 ` Junio C Hamano
2008-03-09 11:21   ` Samuel Tardieu
2008-03-09 20:50     ` Johannes Schindelin
2008-03-10  5:50       ` Junio C Hamano
2008-03-10 11:11         ` Johannes Schindelin
2008-03-10  8:17       ` Samuel Tardieu
2008-03-10 11:13         ` Johannes Schindelin
2008-03-10 19:21           ` Junio C Hamano [this message]

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=7v3aqyjsft.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=sam@rfc1149.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).