Merge branch 'ab/mailmap'

Clean-up docs, codepaths and tests around mailmap.

* ab/mailmap: (22 commits)
  shortlog: remove unused(?) "repo-abbrev" feature
  mailmap doc + tests: document and test for case-insensitivity
  mailmap tests: add tests for empty "<>" syntax
  mailmap tests: add tests for whitespace syntax
  mailmap tests: add a test for comment syntax
  mailmap doc + tests: add better examples & test them
  tests: refactor a few tests to use "test_commit --append"
  test-lib functions: add an --append option to test_commit
  test-lib functions: add --author support to test_commit
  test-lib functions: document arguments to test_commit
  test-lib functions: expand "test_commit" comment template
  mailmap: test for silent exiting on missing file/blob
  mailmap tests: get rid of overly complex blame fuzzing
  mailmap tests: add a test for "not a blob" error
  mailmap tests: remove redundant entry in test
  mailmap tests: improve --stdin tests
  mailmap tests: modernize syntax & test idioms
  mailmap tests: use our preferred whitespace syntax
  mailmap doc: start by mentioning the comment syntax
  check-mailmap doc: note config options
  ...
This commit is contained in:
Junio C Hamano
2021-01-25 14:19:19 -08:00
22 changed files with 789 additions and 447 deletions

View File

@ -178,19 +178,28 @@ debug () {
GIT_DEBUGGER="${GIT_DEBUGGER}" "$@" <&6 >&5 2>&7
}
# Call test_commit with the arguments
# [-C <directory>] <message> [<file> [<contents> [<tag>]]]"
# Usage: test_commit [options] <message> [<file> [<contents> [<tag>]]]
# -C <dir>:
# Run all git commands in directory <dir>
# --notick
# Do not call test_tick before making a commit
# --append
# Use "echo >>" instead of "echo >" when writing "<contents>" to
# "<file>"
# --signoff
# Invoke "git commit" with --signoff
# --author=<author>
# Invoke "git commit" with --author=<author>
#
# This will commit a file with the given contents and the given commit
# message, and tag the resulting commit with the given tag name.
#
# <file>, <contents>, and <tag> all default to <message>.
#
# If the first argument is "-C", the second argument is used as a path for
# the git invocations.
test_commit () {
notick= &&
append= &&
author= &&
signoff= &&
indir= &&
while test $# != 0
@ -199,6 +208,13 @@ test_commit () {
--notick)
notick=yes
;;
--append)
append=yes
;;
--author)
author="$2"
shift
;;
--signoff)
signoff="$1"
;;
@ -214,13 +230,20 @@ test_commit () {
done &&
indir=${indir:+"$indir"/} &&
file=${2:-"$1.t"} &&
echo "${3-$1}" > "$indir$file" &&
if test -n "$append"
then
echo "${3-$1}" >>"$indir$file"
else
echo "${3-$1}" >"$indir$file"
fi &&
git ${indir:+ -C "$indir"} add "$file" &&
if test -z "$notick"
then
test_tick
fi &&
git ${indir:+ -C "$indir"} commit $signoff -m "$1" &&
git ${indir:+ -C "$indir"} commit \
${author:+ --author "$author"} \
$signoff -m "$1" &&
git ${indir:+ -C "$indir"} tag "${4:-$1}"
}