Speed up bash completion loading
authorJonathan Nieder <jrnieder@gmail.com>
Wed, 18 Nov 2009 00:49:10 +0000 (18:49 -0600)
committerJunio C Hamano <gitster@pobox.com>
Wed, 18 Nov 2009 05:35:15 +0000 (21:35 -0800)
commiteaa4e6ee2a1df289e6900ee908751463b22a3a54
tree538c24d16c9bd0fecd809412fee129cd1a2b272e
parent78d553b7d7b269bb22ebd8b1198657c37484a3a0
Speed up bash completion loading

Since git is not used in each and every interactive xterm, it
seems best to load completion support with cold caches and then
load each needed thing lazily.  This has most of the speed
advantage of pre-generating everything at build time, without the
complication of figuring out at build time what commands will be
available at run time.

On this slow laptop, this decreases the time to load
git-completion.bash from about 500 ms to about 175 ms.

Suggested-by: Kirill Smelkov <kirr@mns.spb.ru>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Cc: Stephen Boyd <bebarino@gmail.com>
Cc: SZEDER Gábor <szeder@ira.uka.de>
Cc: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash