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

Re: [PATCH] Speedup bash completion loading

From
Shawn O. Pearce <spearce@spearce.org>
Date
Oct 8, 2009, 15:02 UTC
Message-ID
<20091008150206.GD9261@spearce.org>
In-Reply-To
<20091008132718.GA12161@tugrik.mns.mnsspb.ru>
Kirill Smelkov <kirr@mns.spb.ru> wrote:
Show 12 quoted lines
> diff --git a/contrib/completion/Makefile b/contrib/completion/Makefile
> new file mode 100644
> index 0000000..a0fbb66
> --- /dev/null
> +++ b/contrib/completion/Makefile
> @@ -0,0 +1,11 @@
> +all	: git-completion.bash
> +
> +
> +git-completion.bash: git-completion.bash.in git-completion.bash.generate
> +	# Generate completions for binaries we have just built
> +	PATH="$(shell pwd)/..:$$PATH" ./git-completion.bash.generate

Is only one .. enough? Isn't that putting us into the contrib directory, and therefore not finding the 'git' we just compiled?

I'm also concerned that git-completion.bash.generate requires bash to compile the completion for bash. IMHO, if we are building this code at compile time we shouldn't assume bash is available. What if this is a sandboxed build environment using another shell and /bin/bash isn't installed?

I think the git-completion.bash.generate code needs to be a bit more sh agnostic than the completion routines themselves are.

> +# pregenerated stuff (to save load time)
> +__git_merge_strategylist=__GIT_MERGE_STRATEGYLIST
> +__git_all_commandlist=__GIT_ALL_COMMANDLIST
> +__git_porcelain_commandlist=__GIT_PORCELAIN_COMMANDLIST

This also makes testing the completion a bit more difficult, now we have to build it before we can load it, making the testing cycle actually be:

  make && . git-completion.bash

We probably should place a quick comment here to remind folks that they need to build the script in order to test it properly.

-- 
Shawn.
Previous: Kirill SmelkovNext: Kirill Smelkov
Message 6 of 14 in “Speedup bash completion loading”
  1. Speedup bash completion loadingKirill Smelkov, Oct 5, 2009
  2. Shawn O. PearceOct 5, 2009
  3. Kirill SmelkovOct 5, 2009
  4. Ted PavlicOct 5, 2009
  5. Kirill SmelkovOct 8, 2009
  6. Shawn O. PearceOct 8, 2009
  7. Kirill SmelkovOct 8, 2009
  8. Kirill SmelkovOct 9, 2009
  9. Shawn O. PearceOct 9, 2009
  10. Kirill SmelkovOct 9, 2009
  11. Shawn O. PearceOct 9, 2009
  12. Kirill SmelkovOct 9, 2009
  13. Shawn O. PearceOct 9, 2009
  14. Junio C HamanoOct 10, 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.