Skip to content

Commit 7fb52e4

Browse files
committed
README: document new installation methods (and a few other tweaks)
1 parent 989fe1d commit 7fb52e4

File tree

1 file changed

+55
-20
lines changed

1 file changed

+55
-20
lines changed

README.md

Lines changed: 55 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -67,36 +67,70 @@ Is your Git repository bursting at the seams?
6767

6868
## Getting started
6969

70-
1. [Install the Git command-line client](https://git-scm.com/) and put it in your `PATH`. (`git-sizer` invokes `git` commands to examine the contents of your repository.)
70+
1. Make sure that you have the [Git command-line client](https://git-scm.com/) installed. NOTE: `git-sizer` invokes `git` commands to examine the contents of your repository, so **it is required that the `git` command be in your `PATH`** when you run `git-sizer`.
7171

72-
2. Build:
72+
2. Install `git-sizer`. Either:
7373

74-
* On Linux or OS X:
74+
a. Install a released version of `git-sizer` (recommended):
7575

76-
script/bootstrap
77-
make
76+
* Go to [the releases page](https://github.com/github/git-sizer/releases) and download the ZIP file corresponding to your platform.
7877

79-
The executable file is written to `bin/git-sizer`. If you copy it to your `PATH`, you can run the program by typing `git sizer`; otherwise, you need to type the full path and filename to run it; e.g., `bin/git-sizer`.
78+
* Unzip the file.
8079

81-
* On other platforms: TBD
80+
* Move the executable file (`git-sizer` or `git-sizer.exe`) into your `PATH`.
8281

83-
3. Change to the directory containing the Git repository, then run
82+
b. Install `git-sizer` using `go get`:
8483

85-
git sizer [<opt>...]
84+
* Make sure that you have a recent version of the [Go language toolchain](https://golang.org/doc/install) installed and that you have set `GOPATH`.
8685

87-
To get a summary of the current repository, all you need is
86+
* Get `git-sizer` using `go get`:
8887

89-
git sizer
88+
go get github.com/github/git-sizer
9089

91-
Use the `--json` option to get output in JSON format, including the raw numbers.
90+
This should fetch and compile the source code and write the executable file to `$GOPATH/bin/`.
91+
92+
* Either add `$GOPATH/bin` to your `PATH`, or copy the executable file (`git-sizer` or `git-sizer.exe`) to a directory that is already in your `PATH`.
93+
94+
c. Build using `make` (for experts; works on Linux or OS X):
95+
96+
* Clone the `git-sizer` Git repository and switch to that directory:
97+
98+
git clone https://github.com/github/git-sizer.git
99+
cd git-sizer
100+
101+
* Install Go if necessary and create and prepare a project-local `GOPATH`:
102+
103+
script/bootstrap
104+
105+
* Build `git-sizer`:
106+
107+
make
108+
109+
* Copy the resulting executable file (`bin/git-sizer`) to a directory in your `PATH`.
110+
111+
Assuming that you have installed the `git-sizer` executable to your `PATH`, you can run the program via Git by typing `git sizer`; otherwise, you need to type the full path and filename to run it; e.g., `/path/to/bin/git-sizer`.
112+
113+
3. Change to the directory containing the Git repository that you'd like to analyze, then run
114+
115+
git sizer [<option>...]
116+
117+
No options are required. You can learn about available options by typing `git sizer -h` or by reading on.
118+
119+
(The above command assumes that you have added `git-sizer` to your `PATH`. If you don't add it to your `PATH`, you need to type its full path and filename to run it; e.g., `/path/to/bin/git-sizer`.)
92120

93121

94122
## Usage
95123

96-
By default, `git-sizer` outputs its results in tabular format. For example, let's use it to check [the Linux repository](https://github.com/torvalds/linux), using the `--verbose` option to cause all statistics to be output:
124+
By default, `git-sizer` outputs its results in tabular format. For example, let's use it to analyze [the Linux repository](https://github.com/torvalds/linux), using the `--verbose` option so that all statistics are output:
97125

98126
```
99127
$ git-sizer --verbose
128+
Processing blobs: 1652370
129+
Processing trees: 3396199
130+
Processing commits: 722647
131+
Matching commits to trees: 722647
132+
Processing annotated tags: 534
133+
Processing references: 539
100134
| Name | Value | Level of concern |
101135
| ---------------------------- | --------- | ------------------------------ |
102136
| Overall repository size | | |
@@ -149,21 +183,19 @@ $ git-sizer --verbose
149183
[10] f29a5ea76884ac37e1197bef1941f62fda3f7b99 (f5308d1b83eba20e69df5e0926ba7257c8dd9074^{tree})
150184
```
151185

152-
`git-sizer` has to traverse all of the history, so the analysis can take a while.
153-
154-
The output is a table showing the thing that was measured, its numerical value, and a rough indication of which values might be a cause for concern.
186+
The output is a table showing the thing that was measured, its numerical value, and a rough indication of which values might be a cause for concern. In all cases, only objects that are reachable from references are included (i.e., not unreachable objects, nor objects that are reachable only from the reflogs).
155187

156188
The "Overall repository size" section includes repository-wide statistics about distinct objects, not including repetition. "Total size" is the sum of the sizes of the corresponding objects in their uncompressed form, measured in bytes.
157189

158190
The "Biggest objects" section provides information about the biggest single objects of each type, anywhere in the history.
159191

160192
In the "History structure" section, "maximum history depth" is the longest chain of commits in the history, and "maximum tag depth" reports the longest chain of annotated tags that point at other annotated tags.
161193

162-
The "Biggest checkouts" section is about the sizes of commits as checked out into a working copy. "Maximum path depth" is the largest number of path components within the repository, and "maximum path length" is the longest path in terms of bytes. "Total size of files" is the sum of all file sizes in the single biggest commit, including multiplicities if the same file appears multiple times.
194+
The "Biggest checkouts" section is about the sizes of commits as checked out into a working copy. "Maximum path depth" is the largest number of path components for files in the working copy, and "maximum path length" is the longest path in terms of bytes. "Total size of files" is the sum of all file sizes in the single biggest commit, including multiplicities if the same file appears multiple times.
163195

164196
The "Value" column displays counts, using units "k" (thousand), "M" (million), "G" (billion) etc., and sizes, using units "B" (bytes), "KiB" (1024 bytes), "MiB" (1024 KiB), etc. Note that if a value overflows its counter (which should only happen for malicious repositories), the corresponding value is displayed as `` in tabular form, or truncated to 2³²-1 or 2⁶⁴-1 (depending on the size of the counter) in JSON mode.
165197

166-
The "Level of concern" column uses asterisks to indicate values that seem high compared with "typical" Git repositories. The more asterisks, the more inconvenience this value might be expected to cause. Exclamation points indicate values that are extremely high (i.e., equivalent to more than 30 asterisks).
198+
The "Level of concern" column uses asterisks to indicate values that seem high compared with "typical" Git repositories. The more asterisks, the more inconvenience this aspect of your repository might be expected to cause. Exclamation points indicate values that are extremely high (i.e., equivalent to more than 30 asterisks).
167199

168200
The footnotes list the SHA-1s of the "biggest" objects referenced in the table, along with a more human-readable `<commit>:<path>` description of where that object is located in the repository's history. Given the name of a large object, you could, for example, type
169201

@@ -173,16 +205,19 @@ at the command line to view the contents of the object. (Use `--names=none` if y
173205

174206
By default, only statistics above a minimal level of concern are reported. Use `--verbose` (as above) to request that all statistics be output. Use `--threshold=<value>` to suppress the reporting of statistics below a specified level of concern. (`<value>` is interpreted as a numerical value corresponding to the number of asterisks.) Use `--critical` to report only statistics with a critical level of concern (equivalent to `--threshold=30`).
175207

208+
If you'd like the output in machine-readable format, including exact numbers, use the `--json` option.
209+
176210
To get a list of other options, run
177211

178-
git sizer --help
212+
git sizer -h
179213

180-
The Linux repository is large by most standards, and as you can see, it is pushing some of Git's limits. And indeed, some Git operations on the Linux repository (e.g., `git fsck`, `git gc`) take a while. But due to its sane structure, none of its dimensions are wildly out of proportion to the size of the code base, so it can be managed successfully using Git.
214+
The Linux repository is large by most standards. As you can see, it is pushing some of Git's limits. And indeed, some Git operations on the Linux repository (e.g., `git fsck`, `git gc`) do take a while. But due to its sane structure, none of its dimensions are wildly out of proportion to the size of the code base, so the kernel project is managed successfully using Git.
181215

182216
Here is the non-verbose output for one of the famous ["git bomb"](https://kate.io/blog/git-bomb/) repositories:
183217

184218
```
185219
$ git-sizer
220+
[...]
186221
| Name | Value | Level of concern |
187222
| ---------------------------- | --------- | ------------------------------ |
188223
| Biggest checkouts | | |

0 commit comments

Comments
 (0)