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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <junkio@xxxxxxx> wrote:
> "Shawn O. Pearce" <spearce@xxxxxxxxxxx> writes:
> 
> > 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.  :-(

-- 
Shawn.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]