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

Re: [PATCH/RFC 2/2] completion: allow use without compiling

From
Clemens Buchacher <drizzd@aon.at>
Date
Oct 28, 2009, 08:19 UTC
Message-ID
<20091028081949.GA25488@localhost>
In-Reply-To
<7v4opld631.fsf@alter.siamese.dyndns.org>
On Mon, Oct 26, 2009 at 05:38:10PM -0700, Junio C Hamano wrote:
Show 17 quoted lines
> 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
Previous: Junio C HamanoNext: Stephen Boyd
Message 7 of 12 in “pre-generated completion fix and RFC”
  1. 0/2 pre-generated completion fix and RFCStephen Boyd, Oct 26, 2009
  2. 1/2 completion: ignore custom merge strategies when pre-generatingStephen Boyd, Oct 26, 2009
  3. 2/2 completion: allow use without compilingStephen Boyd, Oct 26, 2009
  4. Junio C HamanoOct 26, 2009
  5. Clemens BuchacherOct 27, 2009
  6. Junio C HamanoOct 27, 2009
  7. Clemens BuchacherOct 28, 2009
  8. Stephen BoydOct 27, 2009
  9. Shawn O. PearceOct 27, 2009
  10. Stephen BoydOct 28, 2009
  11. Junio C HamanoOct 28, 2009
  12. Stephen BoydOct 28, 2009

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.