mirror of
https://github.com/git-quick-stats/git-quick-stats.git
synced 2025-12-16 12:00:12 +01:00
Compare commits
125 Commits
2.0.14
...
134-featur
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
376887a394 | ||
|
|
cebb5a8f48 | ||
|
|
343351b762 | ||
|
|
95136d3f92 | ||
|
|
79c735c814 | ||
|
|
ec6a95d2ef | ||
|
|
b65b100cd8 | ||
|
|
dd7719c3b0 | ||
|
|
c34ceb4c0e | ||
|
|
850b7453eb | ||
|
|
5063d1aad7 | ||
|
|
53b9971cf7 | ||
|
|
eec6d53ce9 | ||
|
|
d06a7ca090 | ||
|
|
462439a855 | ||
|
|
c467a9694b | ||
|
|
d4f71cfdad | ||
|
|
88e369503e | ||
|
|
afd61ce9c2 | ||
|
|
e1e02024a1 | ||
|
|
d1641f7bf3 | ||
|
|
8de8c43212 | ||
|
|
f4ec72073d | ||
|
|
b0003bef49 | ||
|
|
a833a5f431 | ||
|
|
886f64f086 | ||
|
|
115b21a48d | ||
|
|
4d515b88b3 | ||
|
|
9b3c0e5db1 | ||
|
|
86ad0af8bb | ||
|
|
fb488abe3e | ||
|
|
3cce04ddad | ||
|
|
d4e56cf557 | ||
|
|
cf239e5523 | ||
|
|
a0f495894b | ||
|
|
4faf233ad1 | ||
|
|
7d5087795e | ||
|
|
fe2df31c36 | ||
|
|
615563459f | ||
|
|
8c1d81a29d | ||
|
|
9f96cecf42 | ||
|
|
5b01b5e055 | ||
|
|
32a84903ff | ||
|
|
cd6d67df06 | ||
|
|
00d13c0b79 | ||
|
|
b525ed3b5c | ||
|
|
41a8542aaa | ||
|
|
7b1e0b2a65 | ||
|
|
43bc82520e | ||
|
|
d33ede9bcc | ||
|
|
7f24d202b9 | ||
|
|
62b128a3ce | ||
|
|
8515fe3a94 | ||
|
|
37bfde67ed | ||
|
|
d886facadf | ||
|
|
aa6619508a | ||
|
|
a813846c9f | ||
|
|
22bf354da4 | ||
|
|
0fea0323a4 | ||
|
|
4fcf8f5fef | ||
|
|
374aa2ef72 | ||
|
|
33dca7f3ed | ||
|
|
2ecb296442 | ||
|
|
428d25d0ef | ||
|
|
c3110e985e | ||
|
|
ebbeb34837 | ||
|
|
6cdca7c7c7 | ||
|
|
71d414eb4a | ||
|
|
d8346210a4 | ||
|
|
b85760e8b9 | ||
|
|
07ad3b57a7 | ||
|
|
dec1c4e103 | ||
|
|
2a0294941f | ||
|
|
22f1b3563d | ||
|
|
628b31ffd8 | ||
|
|
1e5723d7a2 | ||
|
|
0c1749a560 | ||
|
|
ecab54c630 | ||
|
|
7219205696 | ||
|
|
dd3c97816e | ||
|
|
d2b273eead | ||
|
|
5b08bb0b52 | ||
|
|
08d1a5a6e3 | ||
|
|
f5c2b82f02 | ||
|
|
bf29c19cf5 | ||
|
|
c6cb74a5e0 | ||
|
|
3f0befcd07 | ||
|
|
292876846d | ||
|
|
e70c288225 | ||
|
|
4d2621b084 | ||
|
|
2318d42765 | ||
|
|
ef74d79102 | ||
|
|
82f8690285 | ||
|
|
0f641ea0e6 | ||
|
|
6c7bd4fddf | ||
|
|
9f9617b88b | ||
|
|
8cea653d6c | ||
|
|
efa004122e | ||
|
|
0534327006 | ||
|
|
a113dc306f | ||
|
|
0fc2fe956b | ||
|
|
1efe3133dc | ||
|
|
3fd0ee2453 | ||
|
|
a4f19c9e54 | ||
|
|
cd38c40fe8 | ||
|
|
3283122a38 | ||
|
|
920b95c042 | ||
|
|
810ffcff54 | ||
|
|
f9df7ee5e2 | ||
|
|
e31fc931c8 | ||
|
|
0655814800 | ||
|
|
1eb8c53f09 | ||
|
|
3b2f26e85d | ||
|
|
93aa829eae | ||
|
|
1a11540b67 | ||
|
|
6692ec8aa3 | ||
|
|
63eba9f1b8 | ||
|
|
228e67f879 | ||
|
|
891e2277ad | ||
|
|
cc87b3046f | ||
|
|
7aea224e21 | ||
|
|
c37492bb4c | ||
|
|
c258e34afe | ||
|
|
9e18cf35d4 | ||
|
|
24ae67ae57 |
4
.github/FUNDING.yml
vendored
4
.github/FUNDING.yml
vendored
@@ -1,5 +1 @@
|
|||||||
# These are supported funding model platforms
|
# These are supported funding model platforms
|
||||||
|
|
||||||
github: [arzzen]
|
|
||||||
open_collective: git-quick-stats
|
|
||||||
custom: ['https://lukasmestan.com/thanks/']
|
|
||||||
|
|||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -8,3 +8,6 @@
|
|||||||
.Trash*
|
.Trash*
|
||||||
**/*~
|
**/*~
|
||||||
nbproject/*
|
nbproject/*
|
||||||
|
/tests/test-git/.git/
|
||||||
|
#/tests/test-git/*
|
||||||
|
!/tests/test-git/resetgit
|
||||||
|
|||||||
4
.mailmap
4
.mailmap
@@ -1,3 +1,3 @@
|
|||||||
Lukas Mestan <lukas.mestan@gmail.com> Lukáš Mešťan <arzzen@users.noreply.github.com>
|
Lukas <test@gmail.com> Lukáš <arzzen@users.noreply.github.com>
|
||||||
Lukas Mestan <lukas.mestan@gmail.com> arzzen
|
Lukas <lukas@gmail.com> arzzen
|
||||||
|
|
||||||
|
|||||||
@@ -23,5 +23,6 @@ ENV _GIT_SINCE= \
|
|||||||
TERM=xterm-256color
|
TERM=xterm-256color
|
||||||
|
|
||||||
WORKDIR /git
|
WORKDIR /git
|
||||||
|
RUN git config --global --add safe.directory /git
|
||||||
ENTRYPOINT [ "/usr/local/bin/docker-entrypoint" ]
|
ENTRYPOINT [ "/usr/local/bin/docker-entrypoint" ]
|
||||||
CMD [ "/usr/bin/git", "quick-stats" ]
|
CMD [ "/usr/bin/git", "quick-stats" ]
|
||||||
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2020 Lukáš Mešťan
|
Copyright (c) 2024 git-quick-stats.sh
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
5
Makefile
5
Makefile
@@ -3,6 +3,7 @@ _INSTDIR ?= $(DESTDIR)$(PREFIX)
|
|||||||
BINDIR ?= $(_INSTDIR)/bin
|
BINDIR ?= $(_INSTDIR)/bin
|
||||||
MANDIR ?= $(_INSTDIR)/share/man
|
MANDIR ?= $(_INSTDIR)/share/man
|
||||||
TASK_DONE = echo -e "\n✓ $@ done\n"
|
TASK_DONE = echo -e "\n✓ $@ done\n"
|
||||||
|
SHELL := $(shell which bash)
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
|
|
||||||
@@ -29,8 +30,8 @@ uninstall:
|
|||||||
@$(TASK_DONE)
|
@$(TASK_DONE)
|
||||||
|
|
||||||
reinstall:
|
reinstall:
|
||||||
@curl -sO https://raw.githubusercontent.com/arzzen/git-quick-stats/master/git-quick-stats
|
@curl -sO https://raw.githubusercontent.com/git-quick-stats/git-quick-stats/master/git-quick-stats
|
||||||
@curl -sO https://raw.githubusercontent.com/arzzen/git-quick-stats/master/git-quick-stats.1
|
@curl -sO https://raw.githubusercontent.com/git-quick-stats/git-quick-stats/master/git-quick-stats.1
|
||||||
$(MAKE) install
|
$(MAKE) install
|
||||||
@$(TASK_DONE)
|
@$(TASK_DONE)
|
||||||
|
|
||||||
|
|||||||
290
README.md
290
README.md
@@ -1,11 +1,12 @@
|
|||||||
|
# GIT quick statistics [](https://twitter.com/intent/tweet?text=Simple%20and%20efficient%20way%20to%20access%20various%20statistics%20in%20git%20repository&url=https://github.com/arzzen/git-quick-stat&via=arzzen&hashtags=git,stats,tool,statistics,developers)
|
||||||
|
|
||||||
# GIT quick statistics [](#backers) [](#sponsors) [](https://twitter.com/intent/tweet?text=Simple%20and%20efficient%20way%20to%20access%20various%20statistics%20in%20git%20repository&url=https://github.com/arzzen/git-quick-stat&via=arzzen&hashtags=git,stats,tool,statistics,developers) [](https://travis-ci.org/arzzen/git-quick-stats) [](http://braumeister.org/formula/git-quick-stats) [](https://repology.org/metapackage/git-quick-stats/packages)
|
[](https://formulae.brew.sh/formula/git-quick-stats#default)
|
||||||
|
|
||||||
> `git-quick-stats` is a simple and efficient way to access various statistics in a git repository.
|
> `git-quick-stats` is a simple and efficient way to access various statistics in a git repository.
|
||||||
>
|
>
|
||||||
> Any git repository may contain tons of information about commits, contributors, and files. Extracting this information is not always trivial, mostly because there are a gadzillion options to a gadzillion git commands – I don’t think there is a single person alive who knows them all. Probably not even [Linus Torvalds](https://github.com/torvalds) himself :).
|
> Any git repository may contain tons of information about commits, contributors, and files. Extracting this information is not always trivial, mostly because there are a gadzillion options to a gadzillion git commands - I don't think there is a single person alive who knows them all. Probably not even [Linus Torvalds](https://github.com/torvalds) himself :).
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
@@ -13,33 +14,34 @@
|
|||||||
|
|
||||||
[**Usage**](#usage)
|
[**Usage**](#usage)
|
||||||
|
|
||||||
* [**Interactive**](#interactive)
|
- [**Interactive**](#interactive)
|
||||||
* [**Non-interactive**](#non-interactive)
|
- [**Non-interactive**](#non-interactive)
|
||||||
* [**Command-line arguments**](#command-line-arguments)
|
- [**Command-line arguments**](#command-line-arguments)
|
||||||
* [**Git log since and until**](#git-log-since-and-until)
|
- [**Git log since and until**](#git-log-since-and-until)
|
||||||
* [**Git log limit**](#git-log-limit)
|
- [**Git log limit**](#git-log-limit)
|
||||||
* [**Git pathspec**](#git-pathspec)
|
- [**Git log options**](#git-log-options)
|
||||||
* [**Git merge view strategy**](#git-merge-view-strategy)
|
- [**Git pathspec**](#git-pathspec)
|
||||||
* [**Color themes**](#color-themes)
|
- [**Git merge view strategy**](#git-merge-view-strategy)
|
||||||
|
- [**Color themes**](#color-themes)
|
||||||
|
|
||||||
[**Installation**](#installation)
|
[**Installation**](#installation)
|
||||||
|
|
||||||
* [**UNIX and Linux**](#unix-and-linux)
|
- [**UNIX and Linux**](#unix-and-linux)
|
||||||
* [**macOS**](#macos-homebrew)
|
- [**macOS**](#macos-homebrew)
|
||||||
* [**Windows**](#windows)
|
- [**Windows**](#windows)
|
||||||
* [**Docker**](#docker)
|
- [**Docker**](#docker)
|
||||||
|
|
||||||
[**System requirements**](#system-requirements)
|
[**System requirements**](#system-requirements)
|
||||||
|
|
||||||
* [**Dependencies**](#dependencies)
|
- [**Dependencies**](#dependencies)
|
||||||
|
|
||||||
[**FAQ**](#faq)
|
[**FAQ**](#faq)
|
||||||
|
|
||||||
[**Contribution**](#contribution)
|
[**Contribution**](#contribution)
|
||||||
|
|
||||||
* [**Code reviews**](#code-reviews)
|
- [**Code reviews**](#code-reviews)
|
||||||
* [**Some tips for good pull requests**](#some-tips-for-good-pull-requests)
|
- [**Some tips for good pull requests**](#some-tips-for-good-pull-requests)
|
||||||
* [**Formatting**](#formatting)
|
- [**Formatting**](#formatting)
|
||||||
|
|
||||||
[**Tests**](#tests)
|
[**Tests**](#tests)
|
||||||
|
|
||||||
@@ -47,20 +49,20 @@
|
|||||||
|
|
||||||
[**Contributors**](#contributors)
|
[**Contributors**](#contributors)
|
||||||
|
|
||||||
* [**Backers**](#backers)
|
- [**Backers**](#backers)
|
||||||
* [**Sponsors**](#sponsors)
|
- [**Sponsors**](#sponsors)
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### Interactive
|
### Interactive
|
||||||
|
|
||||||
git-quick-stats has a built-in interactive menu that can be executed as such:
|
`git-quick-stats` has a built-in interactive menu that can be executed as such:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git-quick-stats
|
git-quick-stats
|
||||||
@@ -91,40 +93,57 @@ git quick-stats <optional-command-to-execute-directly>
|
|||||||
Possible arguments in short and long form:
|
Possible arguments in short and long form:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
-r, --suggest-reviewers
|
GENERATE OPTIONS
|
||||||
show the best people to contact to review code
|
-T, --detailed-git-stats
|
||||||
-T, --detailed-git-stats
|
give a detailed list of git stats
|
||||||
give a detailed list of git stats
|
-R, --git-stats-by-branch
|
||||||
-R, --git-stats-by-branch
|
see detailed list of git stats by branch
|
||||||
see detailed list of git stats by branch
|
-c, --changelogs
|
||||||
-d, --commits-per-day
|
see changelogs
|
||||||
displays a list of commits per day
|
-L, --changelogs-by-author
|
||||||
-m, --commits-by-month
|
see changelogs by author
|
||||||
displays a list of commits per month
|
-S, --my-daily-stats
|
||||||
-w, --commits-by-weekday
|
see your current daily stats
|
||||||
displays a list of commits per weekday
|
-V, --csv-output-by-branch
|
||||||
-o, --commits-by-hour
|
output daily stats by branch in CSV format
|
||||||
displays a list of commits per hour
|
-j, --json-output
|
||||||
-A, --commits-by-author-by-hour
|
save git log as a JSON formatted file to a specified area
|
||||||
displays a list of commits per hour by author
|
|
||||||
-a, --commits-per-author
|
LIST OPTIONS
|
||||||
displays a list of commits per author
|
-b, --branch-tree
|
||||||
-S, --my-daily-stats
|
show an ASCII graph of the git repo branch history
|
||||||
see your current daily stats
|
-D, --branches-by-date
|
||||||
-C, --contributors
|
show branches by date
|
||||||
see a list of everyone who contributed to the repo
|
-C, --contributors
|
||||||
-b, --branch-tree
|
see a list of everyone who contributed to the repo
|
||||||
show an ASCII graph of the git repo branch history
|
-n, --new-contributors
|
||||||
-D, --branches-by-date
|
list everyone who made their first contribution since a specified date
|
||||||
show branches by date
|
-a, --commits-per-author
|
||||||
-c, --changelogs
|
displays a list of commits per author
|
||||||
see changelogs
|
-d, --commits-per-day
|
||||||
-L, --changelogs-by-author
|
displays a list of commits per day
|
||||||
see changelogs by author
|
-Y, --commits-by-year
|
||||||
-j, --json-output
|
displays a list of commits per year
|
||||||
save git log as a JSON formatted file to a specified area
|
-m, --commits-by-month
|
||||||
-h, -?, --help
|
displays a list of commits per month
|
||||||
display this help text in the terminal
|
-w, --commits-by-weekday
|
||||||
|
displays a list of commits per weekday
|
||||||
|
-W, --commits-by-author-by-weekday
|
||||||
|
displays a list of commits per weekday by author
|
||||||
|
-o, --commits-by-hour
|
||||||
|
displays a list of commits per hour
|
||||||
|
-A, --commits-by-author-by-hour
|
||||||
|
displays a list of commits per hour by author
|
||||||
|
-z, --commits-by-timezone
|
||||||
|
displays a list of commits per timezone
|
||||||
|
-Z, --commits-by-author-by-timezone
|
||||||
|
displays a list of commits per timezone by author
|
||||||
|
|
||||||
|
SUGGEST OPTIONS
|
||||||
|
-r, --suggest-reviewers
|
||||||
|
show the best people to contact to review code
|
||||||
|
-h, -?, --help
|
||||||
|
display this help text in the terminal
|
||||||
```
|
```
|
||||||
|
|
||||||
### Git log since and until
|
### Git log since and until
|
||||||
@@ -140,12 +159,20 @@ Once set, run `git quick-stats` as normal. Note that this affects all stats that
|
|||||||
|
|
||||||
### Git log limit
|
### Git log limit
|
||||||
|
|
||||||
You can set variable `_GIT_LIMIT` for limited output. It will affect the "changelogs" and "branch tree" options.
|
You can set variable `_GIT_LIMIT` for limited output. It will affect the "changelogs" and "branch tree" options. The default limit is `10`.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export _GIT_LIMIT=20
|
export _GIT_LIMIT=20
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Git log options
|
||||||
|
|
||||||
|
You can set `_GIT_LOG_OPTIONS` for [git log options](https://git-scm.com/docs/git-log#_options):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export _GIT_LOG_OPTIONS="--ignore-all-space --ignore-blank-lines"
|
||||||
|
```
|
||||||
|
|
||||||
### Git pathspec
|
### Git pathspec
|
||||||
|
|
||||||
You can exclude a directory from the stats by using [pathspec](https://git-scm.com/docs/gitglossary#gitglossary-aiddefpathspecapathspec)
|
You can exclude a directory from the stats by using [pathspec](https://git-scm.com/docs/gitglossary#gitglossary-aiddefpathspecapathspec)
|
||||||
@@ -169,22 +196,57 @@ export _GIT_MERGE_VIEW="enable"
|
|||||||
export _GIT_MERGE_VIEW="exclusive"
|
export _GIT_MERGE_VIEW="exclusive"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Color themes
|
### Git branch
|
||||||
|
|
||||||
You can change to the legacy color scheme by toggling the variable `_MENU_THEME` between `default` and `legacy`
|
You can set the variable `_GIT_BRANCH` to set the branch of the stats. Works with commands `--git-stats-by-branch` and `--csv-output-by-branch`.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export _MENU_THEME=legacy
|
export _GIT_BRANCH="master"
|
||||||
```
|
```
|
||||||
|
|
||||||

|
### Ignore authors
|
||||||
|
|
||||||
|
You can set the variable `_GIT_IGNORE_AUTHORS` to filter out specific authors. It will affect the "All contributors", ""Suggested code reviewers" and "New contributors" options.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export _GIT_IGNORE_AUTHORS="(author@examle.com|username)"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Sorting contribution stats
|
||||||
|
|
||||||
|
You can sort contribution stats by field `name`, `commits`, `insertions`, `deletions`, or `lines` (total lines changed) and order (`asc`, `desc`). e.g.: `commits-desc`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export _GIT_SORT_BY="name-asc"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Color themes
|
||||||
|
|
||||||
|
You can change to the legacy color scheme by toggling the variable `_MENU_THEME` between `default` and `legacy`.
|
||||||
|
You can completely disable the color theme by setting the `_MENU_THEME` variable to `none`.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export _MENU_THEME="legacy"
|
||||||
|
# or
|
||||||
|
export _MENU_THEME="none"
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
### Debian and Ubuntu
|
||||||
|
|
||||||
|
If you are on at least Debian Bullseye or Ubuntu Focal you can use apt for installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
apt install git-quick-stats
|
||||||
|
```
|
||||||
|
|
||||||
### UNIX and Linux
|
### UNIX and Linux
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/arzzen/git-quick-stats.git && cd git-quick-stats
|
git clone https://github.com/git-quick-stats/git-quick-stats.git && cd git-quick-stats
|
||||||
sudo make install
|
sudo make install
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -202,18 +264,34 @@ sudo make reinstall
|
|||||||
|
|
||||||
### macOS (homebrew)
|
### macOS (homebrew)
|
||||||
|
|
||||||
|
macOS requires GNU coreutils to be installed and for the non "g" aliased
|
||||||
|
versions to be exported to your path. The following is an example of how to
|
||||||
|
perform this if you are using Homebrew as your package manager.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew install coreutils
|
||||||
|
export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"
|
||||||
|
```
|
||||||
|
|
||||||
|
From there, you can install via Homebrew as follows:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
brew install git-quick-stats
|
brew install git-quick-stats
|
||||||
```
|
```
|
||||||
|
|
||||||
Or you can follow the UNIX and Linux instructions if you wish.
|
Or you can follow the UNIX and Linux instructions if you wish.
|
||||||
|
|
||||||
|
If you would like to default to using the GNU coreutils (recommended), then you
|
||||||
|
can add `export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"` to
|
||||||
|
your applicable `~/.bash_profile`, `~/.zprofile`, or other relevant profile
|
||||||
|
based on the shell of your choice.
|
||||||
|
|
||||||
### Windows
|
### Windows
|
||||||
|
|
||||||
If you are installing with Cygwin, use these scripts:
|
If you are installing with Cygwin, use these scripts:
|
||||||
|
|
||||||
* [installer](https://gist.github.com/arzzen/35e09866dfdadf2108b2420045739245)
|
- [installer](https://gist.github.com/arzzen/35e09866dfdadf2108b2420045739245)
|
||||||
* [uninstaller](https://gist.github.com/arzzen/21c660014d0663b6c5710014714779d6)
|
- [uninstaller](https://gist.github.com/arzzen/21c660014d0663b6c5710014714779d6)
|
||||||
|
|
||||||
If you are wishing to use this with WSL, follow the UNIX and Linux instructions.
|
If you are wishing to use this with WSL, follow the UNIX and Linux instructions.
|
||||||
|
|
||||||
@@ -221,24 +299,51 @@ If you are wishing to use this with WSL, follow the UNIX and Linux instructions.
|
|||||||
|
|
||||||
You can use the Docker image provided:
|
You can use the Docker image provided:
|
||||||
|
|
||||||
* Build: `docker build -t arzzen/git-quick-stats .`
|
- Build: `docker build -t arzzen/git-quick-stats .`
|
||||||
* Run interactive menu: `docker run --rm -it -v $(pwd):/git arzzen/git-quick-stats`
|
- Run interactive menu: `docker run --rm -it -v $(pwd):/git arzzen/git-quick-stats`
|
||||||
* Docker pull command: `docker pull arzzen/git-quick-stats` [docker repository](https://hub.docker.com/r/arzzen/git-quick-stats)
|
- Docker pull command: `docker pull arzzen/git-quick-stats` [docker repository](https://hub.docker.com/r/arzzen/git-quick-stats)
|
||||||
|
|
||||||
## System requirements
|
## System requirements
|
||||||
|
|
||||||
* An OS with a Bash shell
|
- An OS with a Bash shell
|
||||||
* Tools we use: awk ; basename ; cat ; column ; echo ; git ; grep ; head ; seq ; sort ; tput ; tr ; uniq ; wc
|
- Tools we use:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
awk
|
||||||
|
basename
|
||||||
|
cat
|
||||||
|
column
|
||||||
|
date
|
||||||
|
echo
|
||||||
|
git
|
||||||
|
grep
|
||||||
|
head
|
||||||
|
printf
|
||||||
|
seq
|
||||||
|
sort
|
||||||
|
tput
|
||||||
|
tr
|
||||||
|
uniq
|
||||||
|
```
|
||||||
|
|
||||||
### Dependencies
|
### Dependencies
|
||||||
|
|
||||||
* [`bsdmainutils`](https://packages.debian.org/sid/bsdmainutils) `apt install bsdmainutils`
|
- [`bsdextrautils`](https://packages.debian.org/sid/bsdextrautils) `apt install bsdextrautils`
|
||||||
|
- [`coreutils`](https://packages.debian.org/sid/coreutils) `apt install coreutils`
|
||||||
|
- [`gawk`](https://packages.debian.org/sid/gawk) `apt install gawk`
|
||||||
|
- [`grep`](https://packages.debian.org/sid/grep) `apt install grep`
|
||||||
|
- [`ncurses-bin`](https://packages.debian.org/sid/ncurses-bin) `apt install ncurses-bin`
|
||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
|
|
||||||
*Q:* I get some errors after run git-quick-stats in cygwin like `/usr/local/bin/git-quick-stats: line 2: $'\r': command not found`
|
_Q:_ I get some errors after run git-quick-stats in cygwin like `/usr/local/bin/git-quick-stats: line 2: $'\r': command not found`
|
||||||
|
|
||||||
*A:* You can run the dos2unix app in cygwin as follows: `/bin/dos2unix.exe /usr/local/bin/git-quick-stats`. This will convert the script from the CR-LF convention that Microsoft uses to the LF convention that UNIX, OS X, and Linux use. You should then should be able to run it as normal.
|
_A:_ You can run the dos2unix app in cygwin as follows: `/bin/dos2unix.exe /usr/local/bin/git-quick-stats`. This will convert the script from the CR-LF convention that Microsoft uses to the LF convention that UNIX, OS X, and Linux use. You should then should be able to run it as normal.
|
||||||
|
|
||||||
|
_Q:_ How they could be used in a project with many git projects and statistics would show a summary of all git projects?
|
||||||
|
|
||||||
|
_A:_ If you want to include submodule logs, you can try using the following: `export _GIT_LOG_OPTIONS="-p --submodule=log"`
|
||||||
|
(more info about [git log --submodule](https://git-scm.com/docs/git-log#Documentation/git-log.txt---submoduleltformatgt))
|
||||||
|
|
||||||
## Contribution
|
## Contribution
|
||||||
|
|
||||||
@@ -251,13 +356,13 @@ We use GitHub pull requests for this purpose.
|
|||||||
|
|
||||||
### Some tips for good pull requests
|
### Some tips for good pull requests
|
||||||
|
|
||||||
* Use our code </br>
|
- Use our code </br>
|
||||||
When in doubt, try to stay true to the existing code of the project.
|
When in doubt, try to stay true to the existing code of the project.
|
||||||
* Write a descriptive commit message. What problem are you solving and what
|
- Write a descriptive commit message. What problem are you solving and what
|
||||||
are the consequences? Where and what did you test? Some good tips:
|
are the consequences? Where and what did you test? Some good tips:
|
||||||
[here](http://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message)
|
[here](http://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message)
|
||||||
and [here](https://www.kernel.org/doc/Documentation/SubmittingPatches).
|
and [here](https://www.kernel.org/doc/Documentation/SubmittingPatches).
|
||||||
* If your PR consists of multiple commits which are successive improvements /
|
- If your PR consists of multiple commits which are successive improvements /
|
||||||
fixes to your first commit, consider squashing them into a single commit
|
fixes to your first commit, consider squashing them into a single commit
|
||||||
(`git rebase -i`) such that your PR is a single commit on top of the current
|
(`git rebase -i`) such that your PR is a single commit on top of the current
|
||||||
HEAD. This make reviewing the code so much easier, and our history more
|
HEAD. This make reviewing the code so much easier, and our history more
|
||||||
@@ -279,32 +384,33 @@ make test
|
|||||||
|
|
||||||
MIT see [LICENSE][] for the full license text.
|
MIT see [LICENSE][] for the full license text.
|
||||||
|
|
||||||
[read this page]: http://github.com/arzzen/git-quick-stats/blob/master/.github/CONTRIBUTING.md
|
[read this page]: http://github.com/git-quick-stats/git-quick-stats/blob/master/.github/CONTRIBUTING.md
|
||||||
[landing page]: http://arzzen.github.io/git-quick-stats
|
[landing page]: https://git-quick-stats.sh
|
||||||
[LICENSE]: https://github.com/arzzen/git-quick-stats/blob/master/LICENSE
|
[LICENSE]: https://github.com/git-quick-stats/git-quick-stats/blob/master/LICENSE
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
This project exists thanks to all the people who contribute.
|
This project exists thanks to all the people who contribute.
|
||||||
<a href="https://github.com/arzzen/git-quick-stats/graphs/contributors"><img src="https://opencollective.com/git-quick-stats/contributors.svg?width=890&button=false" /></a>
|
|
||||||
|
[](https://github.com/git-quick-stats/git-quick-stats/graphs/contributors)
|
||||||
|
|
||||||
### Backers
|
### Backers
|
||||||
|
|
||||||
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/git-quick-stats#backer)]
|
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/git-quick-stats#backer)]
|
||||||
|
|
||||||
<a href="https://opencollective.com/git-quick-stats#backers" target="_blank"><img src="https://opencollective.com/git-quick-stats/backers.svg?width=890"></a>
|
[](https://opencollective.com/git-quick-stats#backers)
|
||||||
|
|
||||||
### Sponsors
|
### Sponsors
|
||||||
|
|
||||||
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/git-quick-stats#sponsor)]
|
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/git-quick-stats#sponsor)]
|
||||||
|
|
||||||
<a href="https://opencollective.com/git-quick-stats/sponsor/0/website" target="_blank"><img src="https://opencollective.com/git-quick-stats/sponsor/0/avatar.svg?v=1"></a>
|
[](https://opencollective.com/git-quick-stats/sponsor/0/website)
|
||||||
<a href="https://opencollective.com/git-quick-stats/sponsor/1/website" target="_blank"><img src="https://opencollective.com/git-quick-stats/sponsor/1/avatar.svg"></a>
|
[](https://opencollective.com/git-quick-stats/sponsor/1/website)
|
||||||
<a href="https://opencollective.com/git-quick-stats/sponsor/2/website" target="_blank"><img src="https://opencollective.com/git-quick-stats/sponsor/2/avatar.svg"></a>
|
[](https://opencollective.com/git-quick-stats/sponsor/2/website)
|
||||||
<a href="https://opencollective.com/git-quick-stats/sponsor/3/website" target="_blank"><img src="https://opencollective.com/git-quick-stats/sponsor/3/avatar.svg"></a>
|
[](https://opencollective.com/git-quick-stats/sponsor/3/website)
|
||||||
<a href="https://opencollective.com/git-quick-stats/sponsor/4/website" target="_blank"><img src="https://opencollective.com/git-quick-stats/sponsor/4/avatar.svg"></a>
|
[](https://opencollective.com/git-quick-stats/sponsor/4/website)
|
||||||
<a href="https://opencollective.com/git-quick-stats/sponsor/5/website" target="_blank"><img src="https://opencollective.com/git-quick-stats/sponsor/5/avatar.svg"></a>
|
[](https://opencollective.com/git-quick-stats/sponsor/5/website)
|
||||||
<a href="https://opencollective.com/git-quick-stats/sponsor/6/website" target="_blank"><img src="https://opencollective.com/git-quick-stats/sponsor/6/avatar.svg"></a>
|
[](https://opencollective.com/git-quick-stats/sponsor/6/website)
|
||||||
<a href="https://opencollective.com/git-quick-stats/sponsor/7/website" target="_blank"><img src="https://opencollective.com/git-quick-stats/sponsor/7/avatar.svg"></a>
|
[](https://opencollective.com/git-quick-stats/sponsor/7/website)
|
||||||
<a href="https://opencollective.com/git-quick-stats/sponsor/8/website" target="_blank"><img src="https://opencollective.com/git-quick-stats/sponsor/8/avatar.svg"></a>
|
[](https://opencollective.com/git-quick-stats/sponsor/8/website)
|
||||||
<a href="https://opencollective.com/git-quick-stats/sponsor/9/website" target="_blank"><img src="https://opencollective.com/git-quick-stats/sponsor/9/avatar.svg"></a>
|
[](https://opencollective.com/git-quick-stats/sponsor/9/website)
|
||||||
|
|||||||
1619
git-quick-stats
1619
git-quick-stats
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
|||||||
.TH git-quick-stats "1" "January 2020" "git-quick-stats" "User Commands"
|
.TH git-quick-stats "1" "June 2025" "git-quick-stats" "User Commands"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.B git\-quick\-stats
|
.B git\-quick\-stats
|
||||||
\- Simple and efficient way to access various stats in a git repository.
|
\- Simple and efficient way to access various stats in a git repository.
|
||||||
@@ -17,12 +17,7 @@ and files. Extracting this information is not always trivial, mostly because
|
|||||||
of a gadzillion options to a gadzillion git commands.
|
of a gadzillion options to a gadzillion git commands.
|
||||||
This program allows you to see detailed information about a git repository.
|
This program allows you to see detailed information about a git repository.
|
||||||
.PP
|
.PP
|
||||||
.SH OPTIONS
|
.SH GENERATE OPTIONS
|
||||||
.HP
|
|
||||||
\fB\-r\fR, \fB\-\-suggest\-reviewers\fR
|
|
||||||
.IP
|
|
||||||
show the best people to contact to review code
|
|
||||||
.HP
|
|
||||||
.PP
|
.PP
|
||||||
\fB\-T\fR, \fB\-\-detailed\-git\-stats\fR
|
\fB\-T\fR, \fB\-\-detailed\-git\-stats\fR
|
||||||
.IP
|
.IP
|
||||||
@@ -34,56 +29,6 @@ give a detailed list of git stats
|
|||||||
see detailed list of git stats by branch
|
see detailed list of git stats by branch
|
||||||
.HP
|
.HP
|
||||||
.PP
|
.PP
|
||||||
\fB\-d\fR, \fB\-\-commits\-per\-day\fR
|
|
||||||
.IP
|
|
||||||
displays a list of commits per day
|
|
||||||
.HP
|
|
||||||
.PP
|
|
||||||
\fB\-m\fR, \fB\-\-commits\-by\-month\fR
|
|
||||||
.IP
|
|
||||||
displays a list of commits per month
|
|
||||||
.HP
|
|
||||||
.PP
|
|
||||||
\fB\-w\fR, \fB\-\-commits\-by\-weekday\fR
|
|
||||||
.IP
|
|
||||||
displays a list of commits per weekday
|
|
||||||
.HP
|
|
||||||
.PP
|
|
||||||
\fB\-o\fR, \fB\-\-commits\-by\-hour\fR
|
|
||||||
.IP
|
|
||||||
displays a list of commits per hour
|
|
||||||
.HP
|
|
||||||
.PP
|
|
||||||
\fB\-A\fR, \fB\-\-commits\-by\-author\-by\-hour\fR
|
|
||||||
.IP
|
|
||||||
displays a list of commits per hour by author
|
|
||||||
.HP
|
|
||||||
.PP
|
|
||||||
\fB\-a\fR, \fB\-\-commits\-per\-author\fR
|
|
||||||
.IP
|
|
||||||
displays a list of commits per author
|
|
||||||
.HP
|
|
||||||
.PP
|
|
||||||
\fB\-S\fR, \fB\-\-my\-daily\-stats\fR
|
|
||||||
.IP
|
|
||||||
see your current daily stats
|
|
||||||
.HP
|
|
||||||
.PP
|
|
||||||
\fB\-C\fR, \fB\-\-contributors\fR
|
|
||||||
.IP
|
|
||||||
see a list of everyone who contributed to the repo
|
|
||||||
.HP
|
|
||||||
.PP
|
|
||||||
\fB\-b\fR, \fB\-\-branch\-tree\fR
|
|
||||||
.IP
|
|
||||||
show an ASCII graph of the git repo branch history
|
|
||||||
.HP
|
|
||||||
.PP
|
|
||||||
\fB\-D\fR, \fB\-\-branches\-by\-date\fR
|
|
||||||
.IP
|
|
||||||
show branches by date
|
|
||||||
.HP
|
|
||||||
.PP
|
|
||||||
\fB\-c\fR, \fB\-\-changelogs\fR
|
\fB\-c\fR, \fB\-\-changelogs\fR
|
||||||
.IP
|
.IP
|
||||||
see changelogs
|
see changelogs
|
||||||
@@ -94,10 +39,102 @@ see changelogs
|
|||||||
see changelogs by author
|
see changelogs by author
|
||||||
.HP
|
.HP
|
||||||
.PP
|
.PP
|
||||||
|
\fB\-S\fR, \fB\-\-my\-daily\-stats\fR
|
||||||
|
.IP
|
||||||
|
see your current daily stats
|
||||||
|
.HP
|
||||||
|
.PP
|
||||||
|
\fB\-V\fR, \fB\-\-csv\-output\-by\-branch\fR
|
||||||
|
.IP
|
||||||
|
output daily stats by branch in CSV format
|
||||||
|
.HP
|
||||||
|
.PP
|
||||||
\fB\-j\fR, \fB\-\-json\-output\fR
|
\fB\-j\fR, \fB\-\-json\-output\fR
|
||||||
.IP
|
.IP
|
||||||
save git log as a JSON formatted file to a specified area
|
save git log as a JSON formatted file to a specified area
|
||||||
.HP
|
.HP
|
||||||
|
.SH LIST OPTIONS
|
||||||
|
.PP
|
||||||
|
\fB\-b\fR, \fB\-\-branch\-tree\fR
|
||||||
|
.IP
|
||||||
|
show an ASCII graph of the git repo branch history
|
||||||
|
.HP
|
||||||
|
.PP
|
||||||
|
\fB\-D\fR, \fB\-\-branches\-by\-date\fR
|
||||||
|
.IP
|
||||||
|
show branches by date
|
||||||
|
.HP
|
||||||
|
.PP
|
||||||
|
\fB\-C\fR, \fB\-\-contributors\fR
|
||||||
|
.IP
|
||||||
|
see a list of everyone who contributed to the repo
|
||||||
|
.HP
|
||||||
|
.PP
|
||||||
|
\fB\-n\fR, \fB\-\-new\-contributors\fR
|
||||||
|
.IP
|
||||||
|
list everyone who made their first contribution since a specified date
|
||||||
|
.HP
|
||||||
|
.PP
|
||||||
|
\fB\-a\fR, \fB\-\-commits\-per\-author\fR
|
||||||
|
.IP
|
||||||
|
displays a list of commits per author
|
||||||
|
.HP
|
||||||
|
.PP
|
||||||
|
\fB\-d\fR, \fB\-\-commits\-per\-day\fR
|
||||||
|
.IP
|
||||||
|
displays a list of commits per day
|
||||||
|
.HP
|
||||||
|
.PP
|
||||||
|
\fB\-m\fR, \fB\-\-commits\-by\-month\fR
|
||||||
|
.IP
|
||||||
|
displays a list of commits per month
|
||||||
|
.HP
|
||||||
|
.PP
|
||||||
|
\fB\-Y\fR, \fB\-\-commits\-by\-year\fR
|
||||||
|
.IP
|
||||||
|
displays a list of commits per year
|
||||||
|
.HP
|
||||||
|
.PP
|
||||||
|
\fB\-w\fR, \fB\-\-commits\-by\-weekday\fR
|
||||||
|
.IP
|
||||||
|
displays a list of commits per weekday
|
||||||
|
.HP
|
||||||
|
.PP
|
||||||
|
\fB\-W\fR, \fB\-\-commits\-by\-author\-by\-weekday\fR
|
||||||
|
.IP
|
||||||
|
displays a list of commits per weekday by author
|
||||||
|
.HP
|
||||||
|
.PP
|
||||||
|
\fB\-o\fR, \fB\-\-commits\-by\-hour\fR
|
||||||
|
.IP
|
||||||
|
displays a list of commits per hour
|
||||||
|
.HP
|
||||||
|
.PP
|
||||||
|
\fB\-A\fR, \fB\-\-commits\-by\-author\-by\-hour\fR
|
||||||
|
.IP
|
||||||
|
displays a list of commits per hour by author
|
||||||
|
.HP
|
||||||
|
.PP
|
||||||
|
\fB\-z\fR, \fB\-\-commits\-by\-timezone\fR
|
||||||
|
.IP
|
||||||
|
displays a list of commits per timezone
|
||||||
|
.HP
|
||||||
|
.PP
|
||||||
|
\fB\-Z\fR, \fB\-\-commits\-by\-author\-by\-timezone\fR
|
||||||
|
.IP
|
||||||
|
displays a list of commits per timezone by author
|
||||||
|
.HP
|
||||||
|
.PP
|
||||||
|
\fB\-\-activity\-calendar\fR
|
||||||
|
.IP
|
||||||
|
displays a calendar-style grid of commit activity per day-of-week and month for a selected author.
|
||||||
|
.HP
|
||||||
|
.SH SUGGEST OPTIONS
|
||||||
|
.PP
|
||||||
|
\fB\-r\fR, \fB\-\-suggest\-reviewers\fR
|
||||||
|
.IP
|
||||||
|
show the best people to contact to review code
|
||||||
|
.HP
|
||||||
.PP
|
.PP
|
||||||
\fB\-h\fR, \-?, \fB\-\-help\fR
|
\fB\-h\fR, \-?, \fB\-\-help\fR
|
||||||
.IP
|
.IP
|
||||||
@@ -112,6 +149,10 @@ You can set _GIT_LIMIT for limited output log, example:
|
|||||||
.PP
|
.PP
|
||||||
.B export _GIT_LIMIT=20
|
.B export _GIT_LIMIT=20
|
||||||
.PP
|
.PP
|
||||||
|
You can set _GIT_LOG_OPTIONS for git log options, example:
|
||||||
|
.PP
|
||||||
|
.B export _GIT_LOG_OPTIONS="--ignore-all-space --ignore-blank-lines"
|
||||||
|
.PP
|
||||||
You can exclude directories or files from the stats by using pathspec, example:
|
You can exclude directories or files from the stats by using pathspec, example:
|
||||||
.PP
|
.PP
|
||||||
.B export _GIT_PATHSPEC=':!pattern'
|
.B export _GIT_PATHSPEC=':!pattern'
|
||||||
@@ -124,9 +165,49 @@ You can also set _GIT_MERGE_VIEW to only show merge commits, example:
|
|||||||
.PP
|
.PP
|
||||||
.B export _GIT_MERGE_VIEW="exclusive"
|
.B export _GIT_MERGE_VIEW="exclusive"
|
||||||
.PP
|
.PP
|
||||||
You can switch to the legacy color scheme, example:
|
You can sort contribution stats by field "name", "commits", "insertions", "deletions", or "lines" (total lines changed) and order ("asc", "desc"). e.g.: "commits-desc"
|
||||||
|
.PP
|
||||||
|
.B export _GIT_SORT_BY="name-asc"
|
||||||
|
.PP
|
||||||
|
You can change to the legacy color scheme by toggling the variable "_MENU_THEME" between "default" and "legacy". You can completely disable the color theme by setting the "_MENU_THEME" variable to "none", example:
|
||||||
.PP
|
.PP
|
||||||
.B export _MENU_THEME=legacy
|
.B export _MENU_THEME=legacy
|
||||||
|
.PP
|
||||||
|
or
|
||||||
|
.B export _MENU_THEME=none
|
||||||
|
.PP
|
||||||
|
You can set _GIT_BRANCH to set the branch of the stats, example:
|
||||||
|
.PP
|
||||||
|
.B export _GIT_BRANCH="master"
|
||||||
|
.PP
|
||||||
|
.SH Calendar activity output
|
||||||
|
.PP
|
||||||
|
\fBactivity-calendar\fR outputs a visual grid of commit activity for a selected author, grouped by day-of-week (rows: Mon..Sun) and month (columns: Jan..Dec). Each cell is 3 characters wide, separated by one space.
|
||||||
|
.PP
|
||||||
|
Sample output:
|
||||||
|
.PP
|
||||||
|
.nf
|
||||||
|
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
|
||||||
|
Mon ▓▓▓ ░░░ ▒▒▒ ░░░ ░░░ ▒▒▒ ▓▓▓ ░░░ ░░░ ▓▓▓ ▒▒▒ ▒▒▒
|
||||||
|
Tue ▒▒▒ ░░░ ▒▒▒ ░░░ ▒▒▒ ░░░ ▒▒▒ ▓▓▓ ▒▒▒ ░░░ ░░░ ░░░
|
||||||
|
Wed ░░░ ▓▓▓ ░░░ ▓▓▓ ▒▒▒ ░░░ ░░░ ▒▒▒ ░░░ ░░░ ▓▓▓ ░░░
|
||||||
|
Thu ░░░ ▒▒▒ ░░░ ░░░ ▒▒▒ ░░░ ▓▓▓ ▒▒▒ ▒▒▒ ░░░ ░░░ ▒▒▒
|
||||||
|
Fri ▒▒▒ ░░░ ▒▒▒ ▓▓▓ ░░░ ▓▓▓ ▒▒▒ ░░░ ▒▒▒ ░░░ ▒▒▒ ░░░
|
||||||
|
Sat ░░░ ░░░ ▒▒▒ ░░░ ░░░ ░░░ ▒▒▒ ░░░ ▒▒▒ ▓▓▓ ▒▒▒ ░░░
|
||||||
|
Sun ▓▓▓ ░░░ ▓▓▓ ░░░ ░░░ ▓▓▓ ░░░ ▒▒▒ ░░░ ░░░ ▓▓▓ ░░░
|
||||||
|
|
||||||
|
Legend: ... = 0 ░░░ = 1–2 ▒▒▒ = 3–5 ▓▓▓ = 6+ commits
|
||||||
|
.PP
|
||||||
|
You can set _GIT_IGNORE_AUTHORS to filter out specific authors, example:
|
||||||
|
.PP
|
||||||
|
.B export _GIT_IGNORE_AUTHORS="(author@examle.com|username)"
|
||||||
.
|
.
|
||||||
.fi
|
.fi
|
||||||
|
|
||||||
|
.PP
|
||||||
|
.SH SEE ALSO
|
||||||
|
.BR git (1)
|
||||||
|
.PP
|
||||||
|
Project homepage:
|
||||||
|
.UR https://github.com/git-quick-stats/git-quick-stats
|
||||||
|
.UE
|
||||||
@@ -17,12 +17,16 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
set -o nounset
|
||||||
|
|
||||||
export DISCOVERONLY=${DISCOVERONLY:-}
|
export DISCOVERONLY=${DISCOVERONLY:-}
|
||||||
export DEBUG=${DEBUG:-}
|
export DEBUG=${DEBUG:-}
|
||||||
export STOP=${STOP:-}
|
export STOP=${STOP:-}
|
||||||
export INVARIANT=${INVARIANT:-}
|
export INVARIANT=${INVARIANT:-}
|
||||||
export CONTINUE=${CONTINUE:-}
|
export CONTINUE=${CONTINUE:-}
|
||||||
|
|
||||||
|
GREP=${GREP:-grep}
|
||||||
|
|
||||||
args="$(getopt -n "$0" -l \
|
args="$(getopt -n "$0" -l \
|
||||||
verbose,help,stop,discover,invariant,continue vhxdic $*)" \
|
verbose,help,stop,discover,invariant,continue vhxdic $*)" \
|
||||||
|| exit -1
|
|| exit -1
|
||||||
@@ -101,7 +105,7 @@ assert_end() {
|
|||||||
assert() {
|
assert() {
|
||||||
# assert <command> <expected stdout> [stdin]
|
# assert <command> <expected stdout> [stdin]
|
||||||
(( tests_ran++ )) || :
|
(( tests_ran++ )) || :
|
||||||
[[ -z "$DISCOVERONLY" ]] || return
|
[[ -z "$DISCOVERONLY" ]] || return 0
|
||||||
expected=$(echo -ne "${2:-}")
|
expected=$(echo -ne "${2:-}")
|
||||||
result="$(eval 2>/dev/null $1 <<< ${3:-})" || true
|
result="$(eval 2>/dev/null $1 <<< ${3:-})" || true
|
||||||
if [[ "$result" == "$expected" ]]; then
|
if [[ "$result" == "$expected" ]]; then
|
||||||
@@ -111,13 +115,13 @@ assert() {
|
|||||||
result="$(sed -e :a -e '$!N;s/\n/\\n/;ta' <<< "$result")"
|
result="$(sed -e :a -e '$!N;s/\n/\\n/;ta' <<< "$result")"
|
||||||
[[ -z "$result" ]] && result="nothing" || result="\"$result\""
|
[[ -z "$result" ]] && result="nothing" || result="\"$result\""
|
||||||
[[ -z "$2" ]] && expected="nothing" || expected="\"$2\""
|
[[ -z "$2" ]] && expected="nothing" || expected="\"$2\""
|
||||||
_assert_fail "expected $expected${_indent}got $result" "$1" "$3"
|
_assert_fail "expected $expected${_indent}got $result" "$1" "${3:-}"
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_raises() {
|
assert_raises() {
|
||||||
# assert_raises <command> <expected code> [stdin]
|
# assert_raises <command> <expected code> [stdin]
|
||||||
(( tests_ran++ )) || :
|
(( tests_ran++ )) || :
|
||||||
[[ -z "$DISCOVERONLY" ]] || return
|
[[ -z "$DISCOVERONLY" ]] || return 0
|
||||||
status=0
|
status=0
|
||||||
(eval $1 <<< ${3:-}) > /dev/null 2>&1 || status=$?
|
(eval $1 <<< ${3:-}) > /dev/null 2>&1 || status=$?
|
||||||
expected=${2:-0}
|
expected=${2:-0}
|
||||||
@@ -125,19 +129,24 @@ assert_raises() {
|
|||||||
[[ -z "$DEBUG" ]] || echo -n .
|
[[ -z "$DEBUG" ]] || echo -n .
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
_assert_fail "program terminated with code $status instead of $expected" "$1" "$3"
|
_assert_fail "program terminated with code $status instead of $expected" "$1" "${3:-}"
|
||||||
|
}
|
||||||
|
|
||||||
|
assert_success() {
|
||||||
|
# assert_success <command>
|
||||||
|
assert_raises "$1" 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# _assert_with_grep <grep modifiers> <command> <expected output...>
|
# _assert_with_grep <grep modifiers> <command> <expected output...>
|
||||||
_assert_with_grep() {
|
_assert_with_grep() {
|
||||||
local grep_modifier="$1"
|
local grep_modifier="$1"
|
||||||
local output="$($2)"
|
local output="$($2)"
|
||||||
local exitcode="$4" || 0
|
local exitcode=0
|
||||||
shift 2
|
shift 2
|
||||||
|
|
||||||
while [ $# != 0 ]; do
|
while [ $# != 0 ]; do
|
||||||
assert_raises "echo '$output' | $GREP $grep_modifier '$1'" $exitcode || return 1
|
assert_raises "echo '$output' | $GREP $grep_modifier '$1'" $exitcode || return 1
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,123 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Verify we are in a git repo. Create one if not
|
||||||
|
# FIXME: All the paths are hardcoded currently and will break if anything
|
||||||
|
# in this chain moves or gets executed elsewhere. Adjust all of these so
|
||||||
|
# pathing does not matter as much such as creating a TOP variable that
|
||||||
|
# does something like TOP=$(cd "$(dirname "$0")" || exit ; pwd -P)
|
||||||
|
# or maybe leverages Make to handle these as test targets
|
||||||
|
./tests/test-git/resetgit
|
||||||
|
|
||||||
. tests/assert.sh -v
|
. tests/assert.sh -v
|
||||||
|
|
||||||
src="./git-quick-stats"
|
src="./git-quick-stats"
|
||||||
assert "$src fail" "Invalid argument\n\nNAME\n git-quick-stats - Simple and efficient way to access various stats in a git repo\n\nSYNOPSIS\n For non-interactive mode: git-quick-stats [OPTIONS]\n For interactive mode: git-quick-stats\n\nDESCRIPTION\n Any git repository contains tons of information about commits, contributors,\n and files. Extracting this information is not always trivial, mostly because\n of a gadzillion options to a gadzillion git commands.\n\n This program allows you to see detailed information about a git repository.\n\nOPTIONS\n -r, --suggest-reviewers\n show the best people to contact to review code\n -T, --detailed-git-stats\n give a detailed list of git stats\n -R, --git-stats-by-branch\n see detailed list of git stats by branch\n -d, --commits-per-day\n displays a list of commits per day\n -m, --commits-by-month\n displays a list of commits per month\n -w, --commits-by-weekday\n displays a list of commits per weekday\n -o, --commits-by-hour\n displays a list of commits per hour\n -A, --commits-by-author-by-hour\n displays a list of commits per hour by author\n -a, --commits-per-author\n displays a list of commits per author\n -S, --my-daily-stats\n see your current daily stats\n -C, --contributors\n see a list of everyone who contributed to the repo\n -b, --branch-tree\n show an ASCII graph of the git repo branch history\n -D, --branches-by-date\n show branches by date\n -c, --changelogs\n see changelogs\n -L, --changelogs-by-author\n see changelogs by author\n -j, --json-output\n save git log as a JSON formatted file to a specified area\n -h, -?, --help\n display this help text in the terminal\n\nADDITIONAL USAGE\n You can set _GIT_SINCE and _GIT_UNTIL to limit the git time log\n ex: export _GIT_SINCE=\"2017-01-20\"\n You can set _GIT_LIMIT for limited output log\n ex: export _GIT_LIMIT=20\n You can exclude directories or files from the stats by using pathspec\n ex: export _GIT_PATHSPEC=':!pattern'\n You can set _GIT_MERGE_VIEW to view merge commits with normal commits\n ex: export _GIT_MERGE_VIEW=enable\n You can also set _GIT_MERGE_VIEW to only show merge commits\n ex: export _GIT_MERGE_VIEW=exclusive\n You can set _MENU_THEME to display the legacy color scheme\n ex: export _MENU_THEME=legacy"
|
assert "$src fail" "Invalid argument: fail
|
||||||
|
|
||||||
|
NAME
|
||||||
|
git-quick-stats - Simple and efficient way to access various stats in a git repo
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
For non-interactive mode: git-quick-stats [OPTIONS]
|
||||||
|
For interactive mode: git-quick-stats
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
Any git repository contains tons of information about commits, contributors,
|
||||||
|
and files. Extracting this information is not always trivial, mostly because
|
||||||
|
of a gadzillion options to a gadzillion git commands.
|
||||||
|
|
||||||
|
This program allows you to see detailed information about a git repository.
|
||||||
|
|
||||||
|
GENERATE OPTIONS
|
||||||
|
-T, --detailed-git-stats
|
||||||
|
give a detailed list of git stats
|
||||||
|
-R, --git-stats-by-branch
|
||||||
|
see detailed list of git stats by branch
|
||||||
|
-c, --changelogs
|
||||||
|
see changelogs
|
||||||
|
-L, --changelogs-by-author
|
||||||
|
see changelogs by author
|
||||||
|
-S, --my-daily-stats
|
||||||
|
see your current daily stats
|
||||||
|
-V, --csv-output-by-branch
|
||||||
|
output daily stats by branch in CSV format
|
||||||
|
-j, --json-output
|
||||||
|
save git log as a JSON formatted file to a specified area
|
||||||
|
|
||||||
|
LIST OPTIONS
|
||||||
|
-b, --branch-tree
|
||||||
|
show an ASCII graph of the git repo branch history
|
||||||
|
-D, --branches-by-date
|
||||||
|
show branches by date
|
||||||
|
-C, --contributors
|
||||||
|
see a list of everyone who contributed to the repo
|
||||||
|
-n, --new-contributors
|
||||||
|
list everyone who made their first contribution since a specified date
|
||||||
|
-a, --commits-per-author
|
||||||
|
displays a list of commits per author
|
||||||
|
-d, --commits-per-day
|
||||||
|
displays a list of commits per day
|
||||||
|
-m, --commits-by-month
|
||||||
|
displays a list of commits per month
|
||||||
|
-Y, --commits-by-year
|
||||||
|
displays a list of commits per year
|
||||||
|
-w, --commits-by-weekday
|
||||||
|
displays a list of commits per weekday
|
||||||
|
-W, --commits-by-author-by-weekday
|
||||||
|
displays a list of commits per weekday by author
|
||||||
|
-o, --commits-by-hour
|
||||||
|
displays a list of commits per hour
|
||||||
|
-A, --commits-by-author-by-hour
|
||||||
|
displays a list of commits per hour by author
|
||||||
|
-z, --commits-by-timezone
|
||||||
|
displays a list of commits per timezone
|
||||||
|
-Z, --commits-by-author-by-timezone
|
||||||
|
displays a list of commits per timezone by author
|
||||||
|
|
||||||
|
SUGGEST OPTIONS
|
||||||
|
-r, --suggest-reviewers
|
||||||
|
show the best people to contact to review code
|
||||||
|
-h, -?, --help
|
||||||
|
display this help text in the terminal
|
||||||
|
|
||||||
|
ADDITIONAL USAGE
|
||||||
|
You can set _GIT_SINCE and _GIT_UNTIL to limit the git time log
|
||||||
|
ex: export _GIT_SINCE=\"2017-01-20\"
|
||||||
|
You can set _GIT_LIMIT for limited output log
|
||||||
|
ex: export _GIT_LIMIT=20
|
||||||
|
You can set _GIT_LOG_OPTIONS for git log options
|
||||||
|
ex: export _GIT_LOG_OPTIONS=\"--ignore-all-space --ignore-blank-lines\"
|
||||||
|
You can exclude directories or files from the stats by using pathspec
|
||||||
|
ex: export _GIT_PATHSPEC=':!pattern'
|
||||||
|
You can set _GIT_MERGE_VIEW to view merge commits with normal commits
|
||||||
|
ex: export _GIT_MERGE_VIEW=enable
|
||||||
|
You can also set _GIT_MERGE_VIEW to only show merge commits
|
||||||
|
ex: export _GIT_MERGE_VIEW=exclusive
|
||||||
|
You can change to the legacy color scheme by toggling the variable \"_MENU_THEME\" between \"default\" and \"legacy\".
|
||||||
|
You can completely disable the color theme by setting the \"_MENU_THEME\" variable to \"none\".
|
||||||
|
ex: export _MENU_THEME=legacy
|
||||||
|
You can set _GIT_BRANCH to set the branch of the stats
|
||||||
|
ex: export _GIT_BRANCH=master
|
||||||
|
You can set _GIT_IGNORE_AUTHORS to filter out specific authors
|
||||||
|
ex: export _GIT_IGNORE_AUTHORS=\"(author1|author2)\"
|
||||||
|
You can sort contribution stats by field \"name\", \"commits\", \"insertions\", \"deletions\", or \"lines\" - total lines changed and order - \"asc\", \"desc\"
|
||||||
|
ex: export _GIT_SORT_BY=\"name-asc\""
|
||||||
|
|
||||||
assert_raises "$src fail" 1
|
assert_raises "$src fail" 1
|
||||||
|
|
||||||
assert_contains "$src --suggest-reviewers" "Suggested code reviewers (based on git history)" 127
|
assert_contains "$src --suggest-reviewers" "Suggested code reviewers (based on git history)"
|
||||||
assert_raises "$src --suggest-reviewers" 0
|
assert_success "$src --suggest-reviewers"
|
||||||
|
|
||||||
assert_contains "$src --detailed-git-stats" "Contribution stats" 127
|
assert_contains "$src --detailed-git-stats" "Contribution stats (by author) on the current branch"
|
||||||
assert_raises "$src --detailed-git-stats" 0
|
assert_success "$src --detailed-git-stats"
|
||||||
|
|
||||||
assert_contains "$src --commits-per-day" "Git commits per date" 127
|
assert_contains "$src --commits-per-day" "Git commits per date"
|
||||||
assert_raises "$src --commits-per-day" 0
|
assert_success "$src --commits-per-day"
|
||||||
|
|
||||||
|
assert_startswith "$src --commits-by-year" "Git commits by year"
|
||||||
|
assert_success "$src --commits-by-year"
|
||||||
|
|
||||||
|
export LC_TIME=POSIX
|
||||||
|
assert_startswith "$src --commits-by-year" "Git commits by year"
|
||||||
|
assert_success "$src --commits-by-year"
|
||||||
|
|
||||||
assert_end
|
assert_end
|
||||||
|
|||||||
16
tests/test-git/resetgit
Executable file
16
tests/test-git/resetgit
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Initialises a new local Git repo for test purpose if one does not exist already
|
||||||
|
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
||||||
|
{
|
||||||
|
git init
|
||||||
|
git config user.name "$(printf %s 'Test Git,\nfor test purpose')"
|
||||||
|
git config user.email "TestGit\o/@example.org"
|
||||||
|
|
||||||
|
printf 'test-git\n========\n' > README.md
|
||||||
|
git add README.md
|
||||||
|
git commit -m 'added readme (o\w/o)' -m 'in markdown, no \r\n, only \n' -m 'a very "simple" readme'
|
||||||
|
testChars="$(printf 'tab [%b] form feed [%b] line feed [%b] carriage return [%b]' '\x09' '\x0C' '\x0A' '\x0D')"
|
||||||
|
git notes add -m 'Some notes' -m 'out of ascii: été au cœur' -m "$testChars"
|
||||||
|
git log
|
||||||
|
} >/dev/null 2>&1
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user