git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Clemens Buchacher <drizzd@aon.at>
To: Junio C Hamano <gitster@pobox.com>
Cc: Stephen Boyd <bebarino@gmail.com>,
	"Shawn O. Pearce" <spearce@spearce.org>,
	git@vger.kernel.org, Sverre Rabbelier <srabbelier@gmail.com>
Subject: Re: [PATCH/RFC 2/2] completion: allow use without compiling
Date: Wed, 28 Oct 2009 09:19:49 +0100	[thread overview]
Message-ID: <20091028081949.GA25488@localhost> (raw)
In-Reply-To: <7v4opld631.fsf@alter.siamese.dyndns.org>

On Mon, Oct 26, 2009 at 05:38:10PM -0700, Junio C Hamano wrote:
> Clemens Buchacher <drizzd@aon.at> writes:
> 
> > On Mon, Oct 26, 2009 at 04:59:18PM -0700, Junio C Hamano wrote:
> >
> >> Stephen Boyd <bebarino@gmail.com> writes:
> >> 
> >> >  This duplicates code, but I don't know of a way to re-use the dynamic
> >> >  code without sourcing a bash script and possibly breaking someone's build.
> >>
> >>  (1) If the script notices that there is a file that contains the command
> >>      list, it sources it; otherwise,
> >
> > Or we substitute the command list in-place, so that we still have the entire
> > completion script in one file.
> 
> That defeats the whole point of my suggestion, as you would be overwriting
> the tracked file.

Ok, not in-place then. What I meant is something like this.

git-completion.bash.in:

 completion script with placeholders for command list generation code and
 static command list

git-command-list.sh:

 bash-agnostic command list generation script

git-completion.bash.generate:

 run git-command-list.sh and replace static command list placeholder in
 git-completion.bash.in, also insert command list generation code into
 git-completion.bash.in, write result to git-completion.bash

Whether or not the command list should be loaded dynamically can be decided
on a per-user basis using a configuration option.

A downside of this approach is that even if we do not need the static
command list, we still need to generate the completion script. I therefore
recommend we make this part of the normal build process.

Alternatively, we could source the command list code. But it's inconvenient
to copy two completion scripts and it will probably cause confusion among
users.

Clemens

  reply	other threads:[~2009-10-28  8:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-26 20:31 [PATCH 0/2] pre-generated completion fix and RFC Stephen Boyd
2009-10-26 20:31 ` [PATCH 1/2] completion: ignore custom merge strategies when pre-generating Stephen Boyd
2009-10-26 20:31 ` [PATCH/RFC 2/2] completion: allow use without compiling Stephen Boyd
2009-10-26 23:59   ` Junio C Hamano
2009-10-27  0:33     ` Clemens Buchacher
2009-10-27  0:38       ` Junio C Hamano
2009-10-28  8:19         ` Clemens Buchacher [this message]
2009-10-27  2:49     ` Stephen Boyd
2009-10-27 18:52   ` Shawn O. Pearce
2009-10-28  1:43     ` Stephen Boyd
2009-10-28  7:18       ` Junio C Hamano
2009-10-28  7:29         ` Stephen Boyd

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=20091028081949.GA25488@localhost \
    --to=drizzd@aon.at \
    --cc=bebarino@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=spearce@spearce.org \
    --cc=srabbelier@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).