|
| 1 | +# Git Commit Size Scraper |
| 2 | + |
| 3 | +## Copyright and Licensing |
| 4 | + |
| 5 | +### Copyright Notice |
| 6 | + |
| 7 | +The copyright for the software, documentation, and associated files are |
| 8 | +held by the author. |
| 9 | + |
| 10 | + Copyright 2012, 2013 Todd A. Jacobs |
| 11 | + All rights reserved. |
| 12 | + |
| 13 | +The AUTHORS file is also included in the source tree. |
| 14 | + |
| 15 | +### Software License |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | +The software is licensed under the |
| 20 | +[GPLv3](http://www.gnu.org/copyleft/gpl.html). The LICENSE file is |
| 21 | +included in the source tree. |
| 22 | + |
| 23 | +### README License |
| 24 | + |
| 25 | + |
| 27 | + |
| 28 | +This README is licensed under the [Creative Commons |
| 29 | +Attribution-NonCommercial-ShareAlike 3.0 United States |
| 30 | +License](http://creativecommons.org/licenses/by-nc-sa/3.0/us/). |
| 31 | + |
| 32 | +## Purpose |
| 33 | + |
| 34 | +Git doesn't provide an easy way to determine the actual size of a given |
| 35 | +commit. However, it is possible to walk Git history to estimate the |
| 36 | +commit size in bytes by summing the objects associated with the commit. |
| 37 | + |
| 38 | +## Caveats |
| 39 | + |
| 40 | +- Currently measures blobs only; other object types are considered |
| 41 | + "overhead." |
| 42 | +- Overhead from tree objects and commit objects are not currently |
| 43 | + included in the per-commit totals. |
| 44 | +- Reports actual object size in bytes; does not take space savings from |
| 45 | + deltification or the packfile format into account. |
| 46 | + |
| 47 | +## Installation and Setup |
| 48 | + |
| 49 | + gem install git_commit_size_scraper |
| 50 | + |
| 51 | +## Usage |
| 52 | + |
| 53 | + # Accepts most arguments understood by git-rev-list(1). |
| 54 | + git_commit_size_scraper [args] |
| 55 | + |
| 56 | +## Examples |
| 57 | + |
| 58 | +No screenshots here, just samples of what you can expect to see on |
| 59 | +standard output when you run the program. |
| 60 | + |
| 61 | +### Command Line |
| 62 | + |
| 63 | + $> git_commit_size_scraper --max-count=10 |
| 64 | + Walking 10 commits ... |
| 65 | + {"f60d13b456162bb3b2364336e517f3f16c900693"=>28942, |
| 66 | + "c1194d24f71f9f8ff9aa1fd83337a70d7c233481"=>28813, |
| 67 | + "0142283e2b014f5206bba70a7d6e695096b4da1c"=>28789, |
| 68 | + "891773ec2a448992e19cb1d5b3d894abee88ce23"=>28563, |
| 69 | + "9e5c5dcd87b542444b17388ea86cb34bcdca29ba"=>28520, |
| 70 | + "b2f0faf4fca0ccbf26388b87cd9aa49e6e6149a4"=>28344, |
| 71 | + "0880b036e42c2e8bbf4ddbf8c540390c12cc83cb"=>28211, |
| 72 | + "f2160f0a5f48424eb1b5d7a8292f814b293191ec"=>28157, |
| 73 | + "01256264e64949b2ba1aa61a513d633c9bee7157"=>27757, |
| 74 | + "5d52891ab5ac19efaf1f8f1a0f596e954d0e9dd8"=>26647} |
| 75 | + |
| 76 | + Average: 28,432.0 bytes |
| 77 | + Median : 28,274.3 bytes |
| 78 | + Std Dev: 693.07 bytes |
| 79 | + Total : 282,743 bytes |
| 80 | + |
| 81 | +### REPL |
| 82 | + |
| 83 | + require 'git_commit_size_scraper/scraper' |
| 84 | + include GitCommitSizeScraper |
| 85 | + |
| 86 | + git = Scraper.new '-n10' |
| 87 | + git.walk |
| 88 | + p "Total bytes committed: %d" % git.list.values.compact.reduce(:+) |
| 89 | + # => "Total bytes committed: 282743" |
| 90 | + |
| 91 | +---- |
| 92 | + |
| 93 | +[Project Home Page](https://github.com/CodeGnome/git_commit_size_scraper) |
0 commit comments