From: Junio C Hamano Date: Mon, 26 Oct 2009 23:59:18 GMT Subject: Re: [PATCH/RFC 2/2] completion: allow use without compiling Message-ID: <7vocntd7vt.fsf@alter.siamese.dyndns.org> In-Reply-To: <1256589116-6998-3-git-send-email-bebarino@gmail.com> Stephen Boyd writes: > Some users don't want to compile their completion, even when the build > generated completion is 10x faster to load. For example, in my bashrc I > source the completion script directly so I can stay up to date with the > latest completion by merely pulling changes. > > Do this by generating the lists dynamically when the merge strategy and > command lists still have their initial values (__GIT_MERGE_STRATEGYLIST, > __GIT_ALL_COMMANDLIST). > > Signed-off-by: Stephen Boyd > --- > > 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. If we are going to do this, wouldn't it make more sense to revert the rename of the script, so that people can keep relying on the name of the script being "git-completion.bash", _but_ make it produce a pre-compiled form to a separate file when invoked in some particular way? Then at the runtime: (0) If the script notices that it has already learned the command list it uses it; otherwise, (1) If the script notices that there is a file that contains the command list, it sources it; otherwise, (2) The script lazily builds the command list for its own use. And at the buildtime, Makefile can run the script in "generation mode", and install the output to where (1) above expects to see.