Re: [git-users] bash SHA-1 completion

2013-07-12 Thread Peter van der Does
On Mon, 8 Jul 2013 11:41:09 -0700 (PDT)
Andy From andyf...@gmail.com 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 bTABTAB
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

real0m5.209s
user0m4.881s
sys 0m1.280s

So 419811 possibilities would be displayed after you do git
diffTABTAB

Assume you know the SHA1 starts with e
$time git rev-list --all | grep ^e | wc -l
26365

real0m5.826s
user0m6.223s
sys 0m0.923s

26365 possibilities on git diff eTABTAB



-- 
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 git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [git-users] bash SHA-1 completion

2013-07-12 Thread Philip Oakley
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 pvanderd...@gmail.com

To: git-users@googlegroups.com
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 andyf...@gmail.com 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 bTABTAB
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
diffTABTAB

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 eTABTAB



--
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 git-users+unsubscr...@googlegroups.com.

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 git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [git-users] bash SHA-1 completion

2013-07-10 Thread Konstantin Khomoutov
On Tue, 9 Jul 2013 11:23:13 -0400
wor...@alum.mit.edu (Dale R. Worley) wrote:

[...]
 I suspect the reason that hash completion hasn't been done yet is more
 that it isn't very useful.  If you type 8d40fc and auto-completion
 offers
 
 8d40fc7e56eeb9ea725054822de5c8c145a65c
 8d40fc088ee0223992617c6e45f0bae7915161
 8d40fc0263d7cfc32017fdbf8cb9101613ab9c
 
 that won't prompt your memory, Ah, yes,
 8d40fc088ee0223992617c6e45f0bae7915161 is the one I was looking for!
 In most modern systems, you use a hash only when you copy it from
 somewhere else, and there usually is a cut-and-paste functionality
 that allows you to do that.

I think that cut-and-paste is what the OP would like to stop dealing
with -- I, too, find it not very convenient to have to reach for the
mouse to copy a SHA-1 name from a `git log` output which I, say,
would like to run a rebasing operation on.  Being able to tab-complete
on SHA-1 names would require me just to memorize 2-3 leading digits
from that name, type them and hit my completion key one or two times to
be reassured I remembered correctly.  Not that I desperately need a
feature like this though...

-- 
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 git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [git-users] bash SHA-1 completion

2013-07-09 Thread Konstantin Khomoutov
On Mon, 8 Jul 2013 11:41:09 -0700 (PDT)
Andy From andyf...@gmail.com wrote:

 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...

A question like this should be directed to the main Git list
(git at vger.kernel.org, see [1]) which is dedicated to discussing of
the Git development.

But really let's just look at the problem: there's no single registry
of object names which would facilitate their quick lookups.  So full
support of SHA-1 completions appears to be infeasible to implement.

On the other hand, the completion function could run
`git for-each-ref ...` and try to complete through the list of returned
SHA-1 names of those references.  That would only include SHA-1 names
of all the branches, tags, notes etc but supposedly that would be okay
for most practical uses.

1. http://vger.kernel.org/vger-lists.html#git

-- 
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 git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[git-users] bash SHA-1 completion

2013-07-08 Thread Andy From
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

-- 
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 git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.