@matheusbsbs / matheus-bagliano / commits / bfdfa3d414
Fork 0

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>

Jonathan Nieder committed Oct 15, 2010 at 12:12 UTC bfdfa3d414539e78f049fceab46767f3a0281721
1 file changed +17 -9
t/t4203-mailmap.sh
+17 -9
@@ -4,6 +4,14 @@ test_description='.mailmap configurations'
4
5 . ./test-lib.sh
6
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 +
15 test_expect_success setup '
16 echo one >one &&
17 git add one &&
@@ -233,18 +241,18 @@ test_expect_success 'Log output (complex mapping)' '
241
242 # git blame
243 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
251 EOF
244 -
252 test_expect_success 'Blame output (complex mapping)' '
253 git blame one >actual &&
247 - test_cmp expect actual
254 + fuzz_blame actual >actual.fuzz &&
255 + test_cmp expect actual.fuzz
256 '
257
258 test_done