It may be worth delaying this type of SHA-1 auto-completion until at
least 3 digits have been entered.
That greatly reduces the false positives and has a conceptual match with
the loose object filing in .git/objects/<ab>/<cde...> so that
(conceptually) the 2-digit directory, and first file char is completed.
In reality the filing system is hidden because many objects are in
packs, so the 'wait for 3-digits' is just a convenience which reduces
the list by 1:2^12 == 1:4096. Though your example of the kernel repo
(typical list of 100 entries) would suggest 4 digits would be better
Philip
----- Original Message -----
From: "Peter van der Does" <[email protected]>
To: <[email protected]>
Sent: Tuesday, July 09, 2013 3:13 AM
Subject: Re: [git-users] bash SHA-1 completion
On Mon, 8 Jul 2013 11:41:09 -0700 (PDT)
Andy From <[email protected]> wrote:
Hi,
I wonder if there's been any work on providing SHA-1 tab completion
for any command (e.g. show or diff) ?
Completion works fine for e.g. branches but it might be a convenience
feature to also be able to complete on SHA-1.
Maybe there would be some performance drawbacks on this and there's
been some discussion on this already...
BR, A
There could be major performance drawbacks, memory problems and just
the shear amount that will be displayed.
Completion works on the principal of getting all potential completions
in memory and then showing them.
So for example with branches,
git checkout b<TAB><TAB>
All branches that start with b are loaded in memory and displayed.
Now imagine this with all your commits.
Do a git rev-list|wc -l on your repository and see how long it takes
and how many commits you have.
For the kernel repo for example:
$time git rev-list --all | wc -l
419811
real 0m5.209s
user 0m4.881s
sys 0m1.280s
So 419811 possibilities would be displayed after you do git
diff<TAB><TAB>
Assume you know the SHA1 starts with e
$time git rev-list --all | grep ^e | wc -l
26365
real 0m5.826s
user 0m6.223s
sys 0m0.923s
26365 possibilities on git diff e<TAB><TAB>
--
Peter van der Does
GPG key: CB317D6E
Site: http://avirtualhome.com
GitHub: https://github.com/petervanderdoes
Twitter: @petervanderdoes
--
You received this message because you are subscribed to the Google
Groups "Git for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2013.0.3349 / Virus Database: 3204/6483 - Release Date:
07/11/13
--
You received this message because you are subscribed to the Google Groups "Git for
human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.