From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Alex Riesen <raa.lkml@gmail.com>, Git Mailing List <git@vger.kernel.org>
Subject: Re: Fwd: Runaway "git remote" if group definition contains a remote by the same name
Date: Tue, 31 Dec 2013 03:06:47 -0500 [thread overview]
Message-ID: <20131231080647.GA25838@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqqlhz2rw7s.fsf@gitster.dls.corp.google.com>
On Mon, Dec 30, 2013 at 11:10:31AM -0800, Junio C Hamano wrote:
> > So I think the sanest thing is probably:
> >
> > 1. Teach "fetch" to expand recursively in a single process, and then
> > tell sub-processes (via a new command-line option) not to expand
> > any further.
> >
> > 2. Teach "fetch" to detect cycles (probably just by a simple depth
> > counter).
>
> I suspect that the expansion code will just accumulate remotes found
> into a string-list (as part of 4. below), so deduping would be
> fairly easily done without a depth counter.
I don't think that will work (at least not naively). The end-product of
step 1, and the string_list that is de-duped in step 4, is a list of the
concrete remotes. The cycles occur between groups, which are not
mentioned in the final list.
You can keep a separate list of the groups we visit, of course, but we
do not otherwise need it.
One thing that does make such a list easier is that we do not need to
care about order. E.g., in config like this:
[remotes]
a = c
b = c
c = d e
you can mark "c" as seen after visiting it via "a". It is not
technically a cycle, but since we would want to suppress duplicates
anyway, we can be overly broad.
> > 3. Teach the group-reading code to detect groups more robustly, so
> > that a single-item group like "remotes.foo=bar" correctly recurses
> > to "bar".
>
> A single-item remote group is somewhat annoying, but expanding it
> only at some places while ignoring it at other places is even more
> annoying, so this sounds like a right thing to do.
The only configuration that I think would be negatively affected is
something like:
[remote]
foo = foo
[remote "foo"]
url = ...
that silently works now, but would become broken (because we would
complain about the cycle). I think that's OK; that config is clearly
stupid and broken. If it were "remote.foo = foo bar", trying to expand
the concrete "foo" and "bar", that might make some sense, but then it is
already broken in the current code (that is the example that started the
discussion).
-Peff
prev parent reply other threads:[~2013-12-31 8:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-17 17:10 Runaway "git remote" if group definition contains a remote by the same name Alex Riesen
2013-12-28 14:56 ` Fwd: " Alex Riesen
2013-12-29 7:58 ` Jeff King
2013-12-30 19:10 ` Junio C Hamano
2013-12-31 8:06 ` Jeff King [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=20131231080647.GA25838@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=raa.lkml@gmail.com \
/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).