Thread (2 messages) flat view 2 messages, 2 authors, 2016-08-11

Re: [PATCH 9/10] Allow completion of --committer and --author arguments to git log.

From: Shawn Pearce <hidden>
Date: 2016-08-11 20:32:46

Junio C Hamano [off-list ref] wrote:
"Shawn O. Pearce" [off-list ref] writes:
quoted
This is just a cute hack, but we can (easily) complete the parameter
to --author or --committer in bash by asking for all possible authors
or committers in this project from git log and offering them up as
valid choices.
Easily but slowly ;-).  Try this in the kernel repository

	git log --author=Andre<TAB>

and watch the paint dry.  You might want to have an extra shell
to run top before you hit the TAB key.
When I put that in there I was thinking about how slowly that would
run on the kernel repository.  But I think its useful for git commit
--author, even if it is a tad turtleish.  I'm considering creating
a cache of names under .git/ and only dynamically generate the log
entries which are newer than the cache head.  That way we're only
wading through the most recent commits to build up the completion
set.

Apparently the bottleneck is bash.  If I add in | sort | uniq to
the end of the sed then I can generate author completions in about 7
seconds for the kernel repository.  Without them it is taking about
30 seconds.  (Both approximate as I just counted it out in my head.)

You can also see this in top.  We spend a bit of time in both git
and sed, then suddenly bash takes over for a while as it makes the
resulting list unique.

Using perl (instead of sed | sort | uniq) appears to improve things
slightly, but I'm getting some odd results that I don't have time
to debug right now.
It indeed is cute, but I think most people would wonder if the
terminal went dead, especially without any progress indicators.
Yes.  And in completion support mode you cannot give progress.  :-(

-- 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help