Skip to content

Commit bfdfa3d

Browse files
jrngitster
authored andcommitted
t4203 (mailmap): stop hardcoding commit ids and dates
A seemingly innocuous change like adding test_tick somewhere can completely upset the final mailmap test, since it checks commit hashes and dates. Make the test less fragile by fuzzing away the unpredictable parts and leaving in the authors (which is what the test is about, anyway). Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent d8d2eb7 commit bfdfa3d

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

t/t4203-mailmap.sh

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ test_description='.mailmap configurations'
44

55
. ./test-lib.sh
66

7+
fuzz_blame () {
8+
sed "
9+
s/$_x05[0-9a-f][0-9a-f][0-9a-f]/OBJID/g
10+
s/$_x05[0-9a-f][0-9a-f]/OBJI/g
11+
s/[-0-9]\{10\} [:0-9]\{8\} [-+][0-9]\{4\}/DATE/g
12+
" "$@"
13+
}
14+
715
test_expect_success setup '
816
echo one >one &&
917
git add one &&
@@ -233,18 +241,18 @@ test_expect_success 'Log output (complex mapping)' '
233241

234242
# git blame
235243
cat >expect <<\EOF
236-
^3a2fdcb (A U Thor 2005-04-07 15:13:13 -0700 1) one
237-
7de6f99b (Some Dude 2005-04-07 15:13:13 -0700 2) two
238-
5815879d (Other Author 2005-04-07 15:14:13 -0700 3) three
239-
ff859d96 (Other Author 2005-04-07 15:15:13 -0700 4) four
240-
5ab6d4fa (Santa Claus 2005-04-07 15:16:13 -0700 5) five
241-
38a42d8b (Santa Claus 2005-04-07 15:17:13 -0700 6) six
242-
8ddc0386 (CTO 2005-04-07 15:18:13 -0700 7) seven
244+
^OBJI (A U Thor DATE 1) one
245+
OBJID (Some Dude DATE 2) two
246+
OBJID (Other Author DATE 3) three
247+
OBJID (Other Author DATE 4) four
248+
OBJID (Santa Claus DATE 5) five
249+
OBJID (Santa Claus DATE 6) six
250+
OBJID (CTO DATE 7) seven
243251
EOF
244-
245252
test_expect_success 'Blame output (complex mapping)' '
246253
git blame one >actual &&
247-
test_cmp expect actual
254+
fuzz_blame actual >actual.fuzz &&
255+
test_cmp expect actual.fuzz
248256
'
249257

250258
test_done

0 commit comments

Comments
 (0)