Merge branch 'ab/mailmap-fixup'

Follow-up fixes and improvements to ab/mailmap topic.

* ab/mailmap-fixup:
  t4203: make blame output massaging more robust
  mailmap doc: use correct environment variable 'GIT_WORK_TREE'
  t4203: stop losing return codes of git commands
  test-lib-functions.sh: fix usage for test_commit()
This commit is contained in:
Junio C Hamano 2021-01-25 14:19:20 -08:00
commit b7bb322cba
3 changed files with 22 additions and 15 deletions

View File

@ -7,7 +7,7 @@ gitmailmap - Map author/committer names and/or E-Mail addresses
SYNOPSIS SYNOPSIS
-------- --------
$GIT_WORK_DIR/.mailmap $GIT_WORK_TREE/.mailmap
DESCRIPTION DESCRIPTION

View File

@ -637,7 +637,8 @@ test_expect_success 'Log output with --use-mailmap' '
Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
EOF EOF
git log --use-mailmap | grep Author >actual && git log --use-mailmap >log &&
grep Author log >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -654,7 +655,8 @@ test_expect_success 'Log output with log.mailmap' '
Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
EOF EOF
git -c log.mailmap=True log | grep Author >actual && git -c log.mailmap=True log >log &&
grep Author log >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -668,7 +670,8 @@ test_expect_success 'log.mailmap=false disables mailmap' '
Author: nick1 <bugs@company.xx> Author: nick1 <bugs@company.xx>
Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
EOF EOF
git -c log.mailmap=false log | grep Author >actual && git -c log.mailmap=false log >log &&
grep Author log >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -682,7 +685,8 @@ test_expect_success '--no-use-mailmap disables mailmap' '
Author: nick1 <bugs@company.xx> Author: nick1 <bugs@company.xx>
Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
EOF EOF
git log --no-use-mailmap | grep Author > actual && git log --no-use-mailmap >log &&
grep Author log >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -693,7 +697,8 @@ test_expect_success 'Grep author with --use-mailmap' '
Author: Santa Claus <santa.claus@northpole.xx> Author: Santa Claus <santa.claus@northpole.xx>
Author: Santa Claus <santa.claus@northpole.xx> Author: Santa Claus <santa.claus@northpole.xx>
EOF EOF
git log --use-mailmap --author Santa | grep Author >actual && git log --use-mailmap --author Santa >log &&
grep Author log >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -705,13 +710,15 @@ test_expect_success 'Grep author with log.mailmap' '
Author: Santa Claus <santa.claus@northpole.xx> Author: Santa Claus <santa.claus@northpole.xx>
EOF EOF
git -c log.mailmap=True log --author Santa | grep Author >actual && git -c log.mailmap=True log --author Santa >log &&
grep Author log >actual &&
test_cmp expect actual test_cmp expect actual
' '
test_expect_success 'log.mailmap is true by default these days' ' test_expect_success 'log.mailmap is true by default these days' '
test_config mailmap.file complex.map && test_config mailmap.file complex.map &&
git log --author Santa | grep Author >actual && git log --author Santa >log &&
grep Author log >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -742,11 +749,11 @@ test_expect_success 'Blame --porcelain output (complex mapping)' '
EOF EOF
git blame --porcelain one >actual.blame && git blame --porcelain one >actual.blame &&
grep -E \
-e "[0-9]+ [0-9]+ [0-9]+$" \ NUM="[0-9][0-9]*" &&
-e "^author .*$" \ sed -n <actual.blame >actual.fuzz \
actual.blame >actual.grep && -e "s/^author //p" \
cut -d " " -f2-4 <actual.grep >actual.fuzz && -e "s/^$OID_REGEX \\($NUM $NUM $NUM\\)$/\\1/p" &&
test_cmp expect actual.fuzz test_cmp expect actual.fuzz
' '

View File

@ -188,8 +188,8 @@ debug () {
# "<file>" # "<file>"
# --signoff # --signoff
# Invoke "git commit" with --signoff # Invoke "git commit" with --signoff
# --author=<author> # --author <author>
# Invoke "git commit" with --author=<author> # Invoke "git commit" with --author <author>
# #
# This will commit a file with the given contents and the given commit # This will commit a file with the given contents and the given commit
# message, and tag the resulting commit with the given tag name. # message, and tag the resulting commit with the given tag name.