From: Felipe Contreras <felipe.contreras@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Taylor Blau" <me@ttaylorr.com>, Git <git@vger.kernel.org>,
"Philippe Blain" <levraiphilippeblain@gmail.com>,
"SZEDER Gábor" <szeder.dev@gmail.com>
Subject: Re: [PATCH] completion: bash: support recursive aliases
Date: Mon, 9 Nov 2020 19:10:11 -0600 [thread overview]
Message-ID: <CAMP44s36ThnMondH8w-VDi4vWNL0Cpkx+o1qRkx_giJvyfh0dg@mail.gmail.com> (raw)
In-Reply-To: <xmqq4klyb1w2.fsf@gitster.c.googlers.com>
On Mon, Nov 9, 2020 at 4:29 PM Junio C Hamano <gitster@pobox.com> wrote:
> >> So the completion should detect such aliases as well.
>
> Two comments.
>
> - on design, is it possible to make a set of aliases that form a
> cycle? do we need to worry about such case? what does the
> current implementation do for an "alias" in such a cycle?
Yes. The first try would be stuck in a loop until the user types CTRL+C.
I already sent a second version that fixes that.
> - on implementation, it is done as a recursive call to the same
> function, but a loop that naturally maps tail recursion would
> also be a trivial implementation. is it worth rewriting the
> recursive calls into a loop? if we need to solve the circular
> references (above) by say limiting the length of the cycle, would
> such a rewrite make sense as a way to help implementation?
Yes, that can be done. I opted for the minimal change so it was easy
to understand what the code was trying to do.
The second version works in the way you suggested.
--
Felipe Contreras
next prev parent reply other threads:[~2020-11-10 1:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-09 21:52 [PATCH] completion: bash: support recursive aliases Felipe Contreras
2020-11-09 22:01 ` Taylor Blau
2020-11-09 22:29 ` Junio C Hamano
2020-11-10 1:10 ` Felipe Contreras [this message]
2020-11-10 0:59 ` Felipe Contreras
2020-11-09 22:19 ` Jeff King
2020-11-10 1:06 ` Felipe Contreras
2020-11-10 1:19 ` Jeff King
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAMP44s36ThnMondH8w-VDi4vWNL0Cpkx+o1qRkx_giJvyfh0dg@mail.gmail.com \
--to=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=levraiphilippeblain@gmail.com \
--cc=me@ttaylorr.com \
--cc=szeder.dev@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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).