Compare commits

..

23 Commits

Author SHA1 Message Date
arzzen
340ed6b078 Fix: show help page when not inside a git repository
Ensure the usage function is called to display the help page if the script is not run inside a git repository.

#168
2024-10-06 14:35:07 +02:00
Tom Ice
cf239e5523 Update README.md
* Update README.md's screenshots to show new features added since last screenshots were taken
2024-09-19 20:45:36 -04:00
Tom Ice
a0f495894b Merge pull request #173 from laxdog/master
Fix stats for situation where there are no inserts / deletes
2024-09-19 16:20:32 -04:00
Tom Ice
4faf233ad1 Merge pull request #170 from funnelfiasco/issue169-add_new_contributors
Add a list of new contributors
2024-09-19 16:20:00 -04:00
Ben Cotton
7d5087795e Address more feedback
* Add date examples to prompts
* Update tests

Signed-off-by: Ben Cotton <bcotton@funnelfiasco.com>
2024-09-19 14:28:41 -04:00
Ben Cotton
fe2df31c36 Address review feedback
* Indicate how we're sorting new contributors
* Don't fork for `date` checks
* Include reference in the manpage

Signed-off-by: Ben Cotton <bcotton@funnelfiasco.com>
2024-09-19 11:57:38 -04:00
Michael Robinson
615563459f Fix stats for situation where there are no inserts / deletes 2024-09-17 15:39:48 +01:00
Ben Cotton
8c1d81a29d Add a list of new contributors
This reports generates a list of all contributors whose first commit was
after a specified date.

Fixes #169

Signed-off-by: Ben Cotton <bcotton@funnelfiasco.com>
2024-06-26 09:59:46 -04:00
Tom Ice
9f96cecf42 Merge pull request #167 from tomice/master
Update documentation for clarity
2024-05-17 22:05:55 -04:00
Tom Ice
5b01b5e055 Update documentation for clarity
* Added additional information to better explain how to use this
  on macOS.

* Updated some of the deps used

* Minor adjustments in the README.md

Addresses Issue #166
2024-05-16 15:23:16 -04:00
arzzen
32a84903ff Merge pull request #165 from chenrui333/patch-1
improve macos error message wrt gnu date
2024-04-29 15:46:11 +02:00
Rui Chen
cd6d67df06 improve macos error message wrt gnu date 2024-04-28 11:17:22 -04:00
Tom Ice
00d13c0b79 Merge pull request #164 from tomice/master
Handle error where BSD date is being used
Create new repo if running tests in non-git area
2024-04-27 13:43:51 -04:00
Tom Ice
b525ed3b5c Create new repo if running tests in non-git area
* When running "make test" in the root directory of this codebase,
  an error will occur as this shell script requires a repo to be
  initialized before it can properly execute.

  This was done in the past, but at some point, it was removed.
  This adds the feature back, tests if we are in a git directory
  by using a built-in git command, and only performs this action
  if a git repo doesn't already exist. All actions are sent to
  /dev/null so the testing should look opaque to the end user.

  Note that tests will still fail if a user is missing a required
  utility to perform the functionality of git-quick-stats.

* Fixed a typo in the man page

Fixes #162
2024-04-20 17:31:12 -04:00
Tom Ice
41a8542aaa Handle error where BSD date is being used
* Users on macOS and other older distributions of Linux and Unix
  cannot fully utilize this application as a handful of date/time
  strings in here are specific to the GNU utility found on most
  modern version of Linux.

  Until every date/time case is handled between the BSD version of
  date and the GNU version of date, let's error out akin to how we
  do it if the user doesn't have every utility installed to run
  this script.

  Users can get around this by using package managers on macOS such
  as homebrew, macports, etc and making sure that 'date' points to
  the GNU version of date instead of the BSD version. Linux and
  Unix users can get around this by installing the GNU version of
  date, as well.

* Removed checking OSTYPE in the format_date() function as checking
  if someone is on a machine that identifies as Darwin is not enough
  to handle other edge cases where an older version of BSD date
  might be present on the system.
2024-04-20 14:15:07 -04:00
arzzen
7b1e0b2a65 Merge pull request #157 from Dica-Developer/41
calculate the day before the given since date
2024-01-10 08:13:40 +01:00
Martin Schaaf
43bc82520e calculate the day before the given since date as it excludes the given daten the inclusion is wanted 2024-01-09 16:40:28 +01:00
arzzen
d33ede9bcc Merge pull request #142 from cam-rod/timezone-format
Update formatting and sort commits by timezone
2023-12-22 16:18:52 +01:00
arzzen
7f24d202b9 Merge pull request #155 from fox-forks/hyperupcall-document-defualt-git-limit
docs: Document default `_GIT_LIMIT` value
2023-12-22 16:17:22 +01:00
Edwin Kofler
62b128a3ce docs: Document default _GIT_LIMIT value 2023-11-18 17:44:29 -08:00
arzzen
8515fe3a94 cleanup 2023-10-24 18:13:00 +02:00
arzzen
37bfde67ed Merge pull request #153 from arzzen/arzzen-patch-1 2023-10-24 15:33:53 +02:00
Cameron Rodriguez
6cdca7c7c7 Sort, use more stable formatting for commits by timezone
Switch to `git log` for formatting commits sorted by timezone, to avoid
odd formatting cases. Also sorts timezones from negative to positive.
2023-04-04 22:30:35 -04:00
5 changed files with 175 additions and 66 deletions

View File

@@ -1,12 +1,12 @@
# GIT quick statistics [![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](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 on Open Collective](https://opencollective.com/git-quick-stats/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/git-quick-stats/sponsors/badge.svg)](#sponsors) [![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](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) [![Travis](https://api.travis-ci.org/arzzen/git-quick-stats.svg?branch=master)](https://travis-ci.org/arzzen/git-quick-stats) [![Homebrew package](https://repology.org/badge/version-for-repo/homebrew/git-quick-stats.svg)](https://formulae.brew.sh/formula/git-quick-stats#default) [![Linuxbrew package](https://repology.org/badge/version-for-repo/linuxbrew/git-quick-stats.svg)](https://repology.org/metapackage/git-quick-stats/packages)
[![Backers on Open Collective](https://opencollective.com/git-quick-stats/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/git-quick-stats/sponsors/badge.svg)](#sponsors) [![Homebrew package](https://repology.org/badge/version-for-repo/homebrew/git-quick-stats.svg)](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 dont think there is a single person alive who knows them all. Probably not even [Linus Torvalds](https://github.com/torvalds) himself :).
![mainMenuScreenshot](https://user-images.githubusercontent.com/8818630/154823670-f42a111b-45f4-47fc-aea7-80059827c8e6.png)
> 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 :).
![mainMenuScreenshot](https://github.com/user-attachments/assets/05a20ff1-44f6-4e44-9d62-c2c089f9ff4e)
## Table of Contents
@@ -54,9 +54,9 @@
## Screenshots
![commitsByWeekdayScreenshot](https://user-images.githubusercontent.com/8818630/154823677-e34ca867-ae61-4755-bf89-c877f809c591.png)
![commitsByWeekdayScreenshot](https://github.com/user-attachments/assets/3a55f3ac-8801-4bbf-9b3a-92b53a64631e)
![commitsByHourScreenshot](https://user-images.githubusercontent.com/8818630/154823679-bdadc26c-c644-4a01-b625-85e330f85d41.png)
![commitsByHourScreenshot](https://github.com/user-attachments/assets/d7de5280-8bb9-4391-9c6c-7e688f2df171)
## 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
@@ -157,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
@@ -210,7 +212,7 @@ You can change to the legacy color scheme by toggling the variable `_MENU_THEME`
export _MENU_THEME="legacy"
```
![legacyThemeScreenshot](https://user-images.githubusercontent.com/8818630/154823711-3dd0c268-f3cb-42e5-9094-0eb8e45d1761.png)
![legacyThemeScreenshot](https://github.com/user-attachments/assets/3b319c1a-827f-47b8-bbfa-b8b59a39deef)
## Installation
@@ -243,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:
@@ -276,6 +294,7 @@ awk
basename
cat
column
date
echo
git
grep
@@ -290,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
@@ -372,6 +395,3 @@ Support this project by becoming a sponsor. Your logo will show up here with a l
[![sponsor7](https://opencollective.com/git-quick-stats/sponsor/7/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/7/website)
[![sponsor8](https://opencollective.com/git-quick-stats/sponsor/8/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/8/website)
[![sponsor9](https://opencollective.com/git-quick-stats/sponsor/9/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/9/website)
[![61999966](https://user-images.githubusercontent.com/6382002/130024560-65bb49a6-c7e9-48f9-8427-a29d8ff2a3db.png)](https://quaestor.com/?utm_source=github&utm_category=sponsor)

View File

@@ -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
}
################################################################################
@@ -107,16 +123,17 @@ function optionPicked() {
# ARGS: $* (required): String
# OUTS: String
################################################################################
format_date() {
local date="${1}"
local outf="${2}"
local datef="${3:-"%b %d %H:%M:%S %Y %Z"}" # Tue Oct 24 13:34:22 2023 +0300
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
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}")"
elif [[ "$OSTYPE" == "darwin"* ]]; then
local resp="$(date -j -f "${datef}" "${date}" "+${outf}")"
fi
printf "%s" "${resp}"
printf "%s" "${resp}"
}
################################################################################
@@ -165,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
@@ -257,18 +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 weekday by author\\n"
printf %b "${NUMS} 17)${TEXT} Git commits per hour\\n"
printf %b "${NUMS} 18)${TEXT} Git commits per hour by author\\n"
printf %b "${NUMS} 19)${TEXT} Git commits per timezone\\n"
printf %b "${NUMS} 20)${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} 21)${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
@@ -320,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) {
@@ -416,7 +440,7 @@ function changelogs() {
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
}
@@ -481,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) {
@@ -668,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
@@ -905,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
}
################################################################################
@@ -938,7 +986,11 @@ function suggestReviewers() {
checkUtils
# Check if we are currently in a git repo.
git rev-parse --is-inside-work-tree > /dev/null
if ! git rev-parse --is-inside-work-tree > /dev/null 2>&1; then
echo "Not inside a git repository."
usage
exit 1
fi
# Parse non-interative commands
if [[ "$#" -eq 1 ]]; then
@@ -987,6 +1039,20 @@ 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;;
@@ -1066,29 +1132,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) author=""
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
commitsByWeekday "${author}"; showMenu;;
17) commitsByHour; showMenu;;
18) author=""
18) commitsByHour; showMenu;;
19) author=""
while [[ -z "${author}" ]]; do
read -r -p "Which author? " author
done
commitsByHour "${author}"; showMenu;;
19) commitsByTimezone; showMenu;;
20) author=""
20) commitsByTimezone; showMenu;;
21) author=""
while [[ -z "${author}" ]]; do
read -r -p "Which author? " author
done
commitsByTimezone "${author}"; showMenu;;
21) suggestReviewers; showMenu;;
22) suggestReviewers; showMenu;;
q|"\n") exit;;
*) clear; optionPicked "Pick an option from the menu"; showMenu;;
esac

View File

@@ -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,7 +100,7 @@ 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
\fB\-W\fR, \fB\-\-commits\-by\-author\-by\-weekday\fR
.IP
displays a list of commits per weekday by author
.HP

View File

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

View File

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