mirror of
https://github.com/git-quick-stats/git-quick-stats.git
synced 2025-12-21 12:13:52 +01:00
Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
46
README.md
46
README.md
@@ -1,12 +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) [](https://formulae.brew.sh/formula/git-quick-stats#default) [](https://repology.org/metapackage/git-quick-stats/packages)
|
||||
[](#backers) [](#sponsors) [](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.
|
||||
>
|
||||
> 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
|
||||
|
||||
@@ -54,9 +54,9 @@
|
||||
|
||||
## Screenshots
|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
## Usage
|
||||
|
||||
@@ -116,6 +116,8 @@ LIST OPTIONS
|
||||
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
|
||||
@@ -126,6 +128,8 @@ LIST OPTIONS
|
||||
displays a list of commits per month
|
||||
-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
|
||||
@@ -155,7 +159,7 @@ Once set, run `git quick-stats` as normal. Note that this affects all stats that
|
||||
|
||||
### 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
|
||||
export _GIT_LIMIT=20
|
||||
@@ -208,7 +212,7 @@ You can change to the legacy color scheme by toggling the variable `_MENU_THEME`
|
||||
export _MENU_THEME="legacy"
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
## Installation
|
||||
|
||||
@@ -241,12 +245,28 @@ sudo make reinstall
|
||||
|
||||
### 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
|
||||
brew install git-quick-stats
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
If you are installing with Cygwin, use these scripts:
|
||||
@@ -274,6 +294,7 @@ awk
|
||||
basename
|
||||
cat
|
||||
column
|
||||
date
|
||||
echo
|
||||
git
|
||||
grep
|
||||
@@ -288,7 +309,11 @@ uniq
|
||||
|
||||
### 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
|
||||
|
||||
@@ -370,6 +395,3 @@ Support this project by becoming a sponsor. Your logo will show up here with a l
|
||||
[](https://opencollective.com/git-quick-stats/sponsor/7/website)
|
||||
[](https://opencollective.com/git-quick-stats/sponsor/8/website)
|
||||
[](https://opencollective.com/git-quick-stats/sponsor/9/website)
|
||||
|
||||
[](https://quaestor.com/?utm_source=github&utm_category=sponsor)
|
||||
|
||||
|
||||
167
git-quick-stats
167
git-quick-stats
@@ -82,13 +82,29 @@ _theme="${_MENU_THEME:=default}"
|
||||
################################################################################
|
||||
function checkUtils() {
|
||||
readonly MSG="not found. Please make sure this is installed and in PATH."
|
||||
readonly UTILS="awk basename cat column echo git grep head printf seq sort \
|
||||
tput tr uniq"
|
||||
readonly UTILS="awk basename cat column date echo git grep head printf seq \
|
||||
sort tput tr uniq"
|
||||
|
||||
for u in $UTILS
|
||||
do
|
||||
command -v "$u" >/dev/null 2>&1 || { echo >&2 "$u ${MSG}"; exit 1; }
|
||||
done
|
||||
|
||||
# NOTE: The --version flag is only available in GNU date which is required
|
||||
# for how the current date/time strings are used in this shell script.
|
||||
# To fully support the legacy BSD date found in a default install within
|
||||
# macOS and older distributions of Linux and Unix, a handful of helper
|
||||
# functions can probably be created to handle every case of incompatibility
|
||||
# between the two. Until that's implemented, it is probably best to warn
|
||||
# the user that this will not work rather than having it silently bomb out
|
||||
# during runtime.
|
||||
if ! date --version >/dev/null 2>&1; then
|
||||
echo "ERROR: GNU date is required."
|
||||
echo "If you're on macOS, please install it using 'brew install coreutils'."
|
||||
echo "Ensure that your PATH is configured to use GNU date as well."
|
||||
echo "See the README.md for further details."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
################################################################################
|
||||
@@ -102,6 +118,24 @@ function optionPicked() {
|
||||
echo -e "${msg}\n"
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# DESC: Format date string
|
||||
# ARGS: $* (required): String
|
||||
# OUTS: String
|
||||
################################################################################
|
||||
function format_date() {
|
||||
# NOTE: While this works where it's implemented within the changelogs()
|
||||
# function the first time, it then bombs out when it reaches the -d flag
|
||||
# in the second half of that same code as BSD date cannot handle -d, nor
|
||||
# can it handle a string such as DATE - 1 day.
|
||||
local date="${1}"
|
||||
local outf="${2}"
|
||||
local datef="${3:-"%b %d %H:%M:%S %Y %Z"}" # Tue Oct 24 13:34:22 2023 +0300
|
||||
local resp="$(date -d "${date}" "+${outf}")"
|
||||
|
||||
printf "%s" "${resp}"
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# DESC: Help information printed to stdout during non-interactive mode
|
||||
# ARGS: None
|
||||
@@ -148,6 +182,8 @@ LIST OPTIONS
|
||||
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
|
||||
@@ -158,6 +194,8 @@ LIST OPTIONS
|
||||
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
|
||||
@@ -238,17 +276,19 @@ function showMenu() {
|
||||
printf %b "${NUMS} 8)${TEXT} Branch tree view (last $_limit)\\n"
|
||||
printf %b "${NUMS} 9)${TEXT} All branches (sorted by most recent commit)\\n"
|
||||
printf %b "${NUMS} 10)${TEXT} All contributors (sorted by name)\\n"
|
||||
printf %b "${NUMS} 11)${TEXT} Git commits per author\\n"
|
||||
printf %b "${NUMS} 12)${TEXT} Git commits per date\\n"
|
||||
printf %b "${NUMS} 13)${TEXT} Git commits per month\\n"
|
||||
printf %b "${NUMS} 14)${TEXT} Git commits per year\\n"
|
||||
printf %b "${NUMS} 15)${TEXT} Git commits per weekday\\n"
|
||||
printf %b "${NUMS} 16)${TEXT} Git commits per hour\\n"
|
||||
printf %b "${NUMS} 17)${TEXT} Git commits per hour by author\\n"
|
||||
printf %b "${NUMS} 18)${TEXT} Git commits per timezone\\n"
|
||||
printf %b "${NUMS} 19)${TEXT} Git commits per timezone by author\\n"
|
||||
printf %b "${NUMS} 11)${TEXT} New contributors (sorted by email)\\n"
|
||||
printf %b "${NUMS} 12)${TEXT} Git commits per author\\n"
|
||||
printf %b "${NUMS} 13)${TEXT} Git commits per date\\n"
|
||||
printf %b "${NUMS} 14)${TEXT} Git commits per month\\n"
|
||||
printf %b "${NUMS} 15)${TEXT} Git commits per year\\n"
|
||||
printf %b "${NUMS} 16)${TEXT} Git commits per weekday\\n"
|
||||
printf %b "${NUMS} 17)${TEXT} Git commits per weekday by author\\n"
|
||||
printf %b "${NUMS} 18)${TEXT} Git commits per hour\\n"
|
||||
printf %b "${NUMS} 19)${TEXT} Git commits per hour by author\\n"
|
||||
printf %b "${NUMS} 20)${TEXT} Git commits per timezone\\n"
|
||||
printf %b "${NUMS} 21)${TEXT} Git commits per timezone by author\\n"
|
||||
printf %b "\\n${TITLES} Suggest:\\n"
|
||||
printf %b "${NUMS} 20)${TEXT} Code reviewers (based on git history)\\n"
|
||||
printf %b "${NUMS} 22)${TEXT} Code reviewers (based on git history)\\n"
|
||||
printf %b "\\n${HELP_TXT}Please enter a menu option or ${EXIT_TXT}press Enter to exit.\\n"
|
||||
printf %b "${TEXT}> ${NORMAL}"
|
||||
read -r opt
|
||||
@@ -300,11 +340,15 @@ function detailedGitStats() {
|
||||
if(more["total"] > 0) {
|
||||
printf "\t insertions: %d\t(%.0f%%)\n", more[author], \
|
||||
(more[author] / more["total"] * 100)
|
||||
} else {
|
||||
printf "\t insertions: %d\t(%.0f%%)\n", 0, 0
|
||||
}
|
||||
|
||||
if(less["total"] > 0) {
|
||||
printf "\t deletions: %d\t(%.0f%%)\n", less[author], \
|
||||
(less[author] / less["total"] * 100)
|
||||
} else {
|
||||
printf "\t deletions: %d\t(%.0f%%)\n", 0, 0
|
||||
}
|
||||
|
||||
if(file["total"] > 0) {
|
||||
@@ -391,11 +435,12 @@ function changelogs() {
|
||||
--date=short "${_author}" "$_since" "$_until" $_log_options $_pathspec \
|
||||
| sort -u -r | head -n $_limit \
|
||||
| while read DATE; do
|
||||
echo -e "\n[$DATE]"
|
||||
day=$(format_date "$DATE" "%A" "%Y-%m-%d")
|
||||
echo -e "\n[$DATE - $day]"
|
||||
GIT_PAGER=cat git -c log.showSignature=false log \
|
||||
--use-mailmap $_merges \
|
||||
--format=" * %s (%aN)" "${_author}" \
|
||||
--since=$DATE --until=$next
|
||||
--since==$(date -d "$DATE - 1 day" +"%Y-%m-%d") --until=$next
|
||||
next=$DATE
|
||||
done
|
||||
}
|
||||
@@ -460,11 +505,15 @@ function csvOutput() {
|
||||
if(more["total"] > 0) {
|
||||
printf "%d,%.0f%%,", more[author], \
|
||||
(more[author] / more["total"] * 100)
|
||||
} else {
|
||||
printf "0,0%%,"
|
||||
}
|
||||
|
||||
if(less["total"] > 0) {
|
||||
printf "%d,%.0f%%,", less[author], \
|
||||
(less[author] / less["total"] * 100)
|
||||
} else {
|
||||
printf "0,0%%,"
|
||||
}
|
||||
|
||||
if(file["total"] > 0) {
|
||||
@@ -647,6 +696,26 @@ function contributors() {
|
||||
--format='%aN' $_log_options $_pathspec | sort -u | cat -n
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# DESC: Lists all new contributors to a repo since the specified time
|
||||
# ARGS: $newDate (required): Cutoff date for being considered "new"
|
||||
# OUTS: None
|
||||
################################################################################
|
||||
function newContributors() {
|
||||
optionPicked "New contributors since $newDate:"
|
||||
local contributors=$(git -c log.showSignature=false log --use-mailmap $_merges \
|
||||
"$_since" "$_until" --format='%aE' $_log_options \
|
||||
$_pathspec | sort -u)
|
||||
for c in $contributors; do
|
||||
local firstCommit=$(git -c log.showSignature=false log --author="$c" \
|
||||
--reverse --use-mailmap $_merges "$_since" "$_until" \
|
||||
--format='%at' $_log_options $_pathspec | head -n 1)
|
||||
if [[ $firstCommit -ge $(date -d "$newDate" +%s) ]]; then
|
||||
echo "$c"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# DESC: Displays the number of commits and percentage contributed to the repo
|
||||
# per author and sorts them by contribution percentage
|
||||
@@ -781,14 +850,24 @@ function commitsByMonth() {
|
||||
# OUTS: None
|
||||
################################################################################
|
||||
function commitsByWeekday() {
|
||||
optionPicked "Git commits by weekday:"
|
||||
local author="${1:-}"
|
||||
local _author=""
|
||||
|
||||
if [[ -z "${author}" ]]; then
|
||||
optionPicked "Git commits by weekday:"
|
||||
_author="--author=**"
|
||||
else
|
||||
optionPicked "Git commits by weekday for author '${author}':"
|
||||
_author="--author=${author}"
|
||||
fi
|
||||
|
||||
echo -e "\tday\tsum"
|
||||
local i counter=1
|
||||
for i in Mon Tue Wed Thu Fri Sat Sun
|
||||
do
|
||||
echo -en "\t$counter\t$i\t"
|
||||
git -c log.showSignature=false shortlog -n $_merges --format='%ad %s' \
|
||||
"$_since" "$_until" $_log_options |
|
||||
"${_author}" "$_since" "$_until" $_log_options |
|
||||
grep -cE "^ * $i \w\w\w [0-9]{1,2} " || continue
|
||||
counter=$((counter+1))
|
||||
done | awk '{
|
||||
@@ -874,9 +953,9 @@ function commitsByTimezone() {
|
||||
fi
|
||||
|
||||
echo -e "Commits\tTimeZone"
|
||||
git -c log.showSignature=false shortlog -n $_merges --format='%ad %s' \
|
||||
git -c log.showSignature=false log $_merges --format='%ad %s' \
|
||||
"${_author}" "$_since" "$_until" --date=iso $_log_options $_pathspec \
|
||||
| cut -d " " -f 12 | grep -v -e '^[[:space:]]*$' | sort | uniq -c
|
||||
| cut -d " " -f 3 | grep -v -e '^[[:space:]]*$' | sort -n | uniq -c
|
||||
}
|
||||
|
||||
################################################################################
|
||||
@@ -956,11 +1035,31 @@ if [[ "$#" -eq 1 ]]; then
|
||||
-b|--branch-tree) branchTree;;
|
||||
-D|--branches-by-date) branchesByDate;;
|
||||
-C|--contributors) contributors;;
|
||||
-n|--new-contributors)
|
||||
newDate=""
|
||||
while [[ -z "${newDate}" ]]; do
|
||||
read -r -p "Since what date? (e.g. '2023-04-13', '13 April 2023', 'last Thursday') " newDate
|
||||
# Test if the date provide is valid and try again if it isn't.
|
||||
# date(1) is pretty accepting of time stamps but you never know
|
||||
# what people may try. This script doesn't provide any additional
|
||||
# output for a bad date since `date`'s STDERR already contains
|
||||
# useful information.
|
||||
if ! date -d "${newDate}" +%s > /dev/null 2>&1; then
|
||||
newDate=""
|
||||
fi
|
||||
done
|
||||
newContributors "${newDate}";;
|
||||
-a|--commits-per-author) commitsPerAuthor;;
|
||||
-d|--commits-per-day) commitsPerDay;;
|
||||
-Y|--commits-by-year ) commitsByYear;;
|
||||
-m|--commits-by-month) commitsByMonth;;
|
||||
-w|--commits-by-weekday) commitsByWeekday;;
|
||||
-W|--commits-by-author-by-weekday)
|
||||
author="${_GIT_AUTHOR:-}"
|
||||
while [[ -z "${author}" ]]; do
|
||||
read -r -p "Which author? " author
|
||||
done
|
||||
commitsByWeekday "${author}";;
|
||||
-o|--commits-by-hour) commitsByHour;;
|
||||
-A|--commits-by-author-by-hour)
|
||||
author="${_GIT_AUTHOR:-}"
|
||||
@@ -1029,24 +1128,38 @@ while [[ "${opt}" != "" ]]; do
|
||||
8) branchTree; showMenu;;
|
||||
9) branchesByDate; showMenu;;
|
||||
10) contributors; showMenu;;
|
||||
11) commitsPerAuthor; showMenu;;
|
||||
12) commitsPerDay; showMenu;;
|
||||
13) commitsByMonth; showMenu;;
|
||||
14) commitsByYear; showMenu;;
|
||||
15) commitsByWeekday; showMenu;;
|
||||
16) commitsByHour; showMenu;;
|
||||
11) newDate=""
|
||||
while [[ -z "${newDate}" ]]; do
|
||||
read -r -p "Since what date? (e.g. '2023-04-13', '13 April 2023', 'last Thursday') " newDate
|
||||
# Test if the date provide is valid and try again if it isn't.
|
||||
if ! date -d "${newDate}" +%s > /dev/null 2>&1; then
|
||||
newDate=""
|
||||
fi
|
||||
done
|
||||
newContributors "${newDate}"; showMenu;;
|
||||
12) commitsPerAuthor; showMenu;;
|
||||
13) commitsPerDay; showMenu;;
|
||||
14) commitsByMonth; showMenu;;
|
||||
15) commitsByYear; showMenu;;
|
||||
16) commitsByWeekday; showMenu;;
|
||||
17) author=""
|
||||
while [[ -z "${author}" ]]; do
|
||||
read -r -p "Which author? " author
|
||||
done
|
||||
commitsByHour "${author}"; showMenu;;
|
||||
18) commitsByTimezone; showMenu;;
|
||||
commitsByWeekday "${author}"; showMenu;;
|
||||
18) commitsByHour; showMenu;;
|
||||
19) author=""
|
||||
while [[ -z "${author}" ]]; do
|
||||
read -r -p "Which author? " author
|
||||
done
|
||||
commitsByHour "${author}"; showMenu;;
|
||||
20) commitsByTimezone; showMenu;;
|
||||
21) author=""
|
||||
while [[ -z "${author}" ]]; do
|
||||
read -r -p "Which author? " author
|
||||
done
|
||||
commitsByTimezone "${author}"; showMenu;;
|
||||
20) suggestReviewers; showMenu;;
|
||||
22) suggestReviewers; showMenu;;
|
||||
q|"\n") exit;;
|
||||
*) clear; optionPicked "Pick an option from the menu"; showMenu;;
|
||||
esac
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.TH git-quick-stats "1" "June 2021" "git-quick-stats" "User Commands"
|
||||
.TH git-quick-stats "1" "April 2024" "git-quick-stats" "User Commands"
|
||||
.SH NAME
|
||||
.B git\-quick\-stats
|
||||
\- Simple and efficient way to access various stats in a git repository.
|
||||
@@ -70,6 +70,11 @@ show branches by date
|
||||
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
|
||||
@@ -95,6 +100,11 @@ displays a list of commits per year
|
||||
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
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
#!/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
|
||||
|
||||
src="./git-quick-stats"
|
||||
@@ -42,6 +50,8 @@ LIST OPTIONS
|
||||
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
|
||||
@@ -52,6 +62,8 @@ LIST OPTIONS
|
||||
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
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
#!/bin/sh
|
||||
# Initialises a new local Git repo for test purpose.
|
||||
if test -d ../test-git/.git; then rm -Rf ../test-git/.git; fi
|
||||
#mkdir test-git
|
||||
cd ../test-git
|
||||
git init
|
||||
git config user.name "$(printf %s 'Test Git,\nfor test purpose')"
|
||||
git config user.email "TestGit\o/@example.org"
|
||||
# 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 '\n[user]\nname = test-git\nemail = test-git@example.org\n'> .git/config
|
||||
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')"
|
||||
#printf '# testChars [%s]\n' "$testChars">&2
|
||||
git notes add -m 'Some notes' -m 'out of ascii: été au cœur' -m "$testChars"
|
||||
git log
|
||||
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