git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Remotes order in "git remote update"

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 10, 2008, 19:21 UTC
Message-ID
<7v3aqyjsft.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<alpine.LSU.1.00.0803101212220.3975@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 21 quoted lines
> 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.

Previous: Johannes Schindelin
Message 9 of 9 in “Remotes order in "git remote update"”
  1. Samuel TardieuMar 9, 2008
  2. Junio C HamanoMar 9, 2008
  3. Samuel TardieuMar 9, 2008
  4. Johannes SchindelinMar 9, 2008
  5. Junio C HamanoMar 10, 2008
  6. Johannes SchindelinMar 10, 2008
  7. Samuel TardieuMar 10, 2008
  8. Johannes SchindelinMar 10, 2008
  9. Junio C HamanoMar 10, 2008

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.