Re: Quick command to count commits

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

 



Henk <henk_westhuis@xxxxxxxxxxx> wrote:
> For GitExtensions (windows git ui) I need a command to count all commits. I
> now use this command:
> git.cmd rev-list --all --abbrev-commit | wc -l
> 
> This works perfect but its very slow in big repositories. Is there a faster
> way to count the commits?

No.  But drop the --abbrev-commit flag, abbreviating the object ids
would take longer than just dumping the full 40 bytes to stdout.
It requires a scan of parts of the object database for every commit
to determine what is a unique abbreviation.

This isn't a very common operation.  Its expensive to do, as you
can see.  What's the reason for supplying it, and needing it so
quickly?  Nobody really cares how many commits are in their history,
unless they are trying to produce stats to describe how big their
repository is.  In which case the size of the .git/objects/pack
*.pack and *.idx files is much more relevant, especially the .idx
files as it gives a really quick estimate on the number of total
objects in the repository.

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

  Powered by Linux