Skip to content

Commit b7bb322

Browse files
committed
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()
2 parents bcaaf97 + 2d02bc9 commit b7bb322

File tree

3 files changed

+22
-15
lines changed

3 files changed

+22
-15
lines changed

Documentation/gitmailmap.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ gitmailmap - Map author/committer names and/or E-Mail addresses
77

88
SYNOPSIS
99
--------
10-
$GIT_WORK_DIR/.mailmap
10+
$GIT_WORK_TREE/.mailmap
1111

1212

1313
DESCRIPTION

t/t4203-mailmap.sh

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,8 @@ test_expect_success 'Log output with --use-mailmap' '
637637
Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
638638
EOF
639639
640-
git log --use-mailmap | grep Author >actual &&
640+
git log --use-mailmap >log &&
641+
grep Author log >actual &&
641642
test_cmp expect actual
642643
'
643644

@@ -654,7 +655,8 @@ test_expect_success 'Log output with log.mailmap' '
654655
Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
655656
EOF
656657
657-
git -c log.mailmap=True log | grep Author >actual &&
658+
git -c log.mailmap=True log >log &&
659+
grep Author log >actual &&
658660
test_cmp expect actual
659661
'
660662

@@ -668,7 +670,8 @@ test_expect_success 'log.mailmap=false disables mailmap' '
668670
Author: nick1 <[email protected]>
669671
Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
670672
EOF
671-
git -c log.mailmap=false log | grep Author >actual &&
673+
git -c log.mailmap=false log >log &&
674+
grep Author log >actual &&
672675
test_cmp expect actual
673676
'
674677

@@ -682,7 +685,8 @@ test_expect_success '--no-use-mailmap disables mailmap' '
682685
Author: nick1 <[email protected]>
683686
Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
684687
EOF
685-
git log --no-use-mailmap | grep Author > actual &&
688+
git log --no-use-mailmap >log &&
689+
grep Author log >actual &&
686690
test_cmp expect actual
687691
'
688692

@@ -693,7 +697,8 @@ test_expect_success 'Grep author with --use-mailmap' '
693697
Author: Santa Claus <[email protected]>
694698
Author: Santa Claus <[email protected]>
695699
EOF
696-
git log --use-mailmap --author Santa | grep Author >actual &&
700+
git log --use-mailmap --author Santa >log &&
701+
grep Author log >actual &&
697702
test_cmp expect actual
698703
'
699704

@@ -705,13 +710,15 @@ test_expect_success 'Grep author with log.mailmap' '
705710
Author: Santa Claus <[email protected]>
706711
EOF
707712
708-
git -c log.mailmap=True log --author Santa | grep Author >actual &&
713+
git -c log.mailmap=True log --author Santa >log &&
714+
grep Author log >actual &&
709715
test_cmp expect actual
710716
'
711717

712718
test_expect_success 'log.mailmap is true by default these days' '
713719
test_config mailmap.file complex.map &&
714-
git log --author Santa | grep Author >actual &&
720+
git log --author Santa >log &&
721+
grep Author log >actual &&
715722
test_cmp expect actual
716723
'
717724

@@ -742,11 +749,11 @@ test_expect_success 'Blame --porcelain output (complex mapping)' '
742749
EOF
743750
744751
git blame --porcelain one >actual.blame &&
745-
grep -E \
746-
-e "[0-9]+ [0-9]+ [0-9]+$" \
747-
-e "^author .*$" \
748-
actual.blame >actual.grep &&
749-
cut -d " " -f2-4 <actual.grep >actual.fuzz &&
752+
753+
NUM="[0-9][0-9]*" &&
754+
sed -n <actual.blame >actual.fuzz \
755+
-e "s/^author //p" \
756+
-e "s/^$OID_REGEX \\($NUM $NUM $NUM\\)$/\\1/p" &&
750757
test_cmp expect actual.fuzz
751758
'
752759

t/test-lib-functions.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ debug () {
188188
# "<file>"
189189
# --signoff
190190
# Invoke "git commit" with --signoff
191-
# --author=<author>
192-
# Invoke "git commit" with --author=<author>
191+
# --author <author>
192+
# Invoke "git commit" with --author <author>
193193
#
194194
# This will commit a file with the given contents and the given commit
195195
# message, and tag the resulting commit with the given tag name.

0 commit comments

Comments
 (0)