add tests for various blame formats

We don't seem to have any tests for "blame --porcelain". Let's at least do a trivial test on a simple example. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed May 9, 2011 at 09:33 UTC 838466b8f7f9e8752a14114d5c4b1d685e0c6c25
1 file changed +71
t/t8008-blame-formats.sh new
+71
@@ -0,0 +1,71 @@
1 +#!/bin/sh
2 +
3 +test_description='blame output in various formats on a simple case'
4 +. ./test-lib.sh
5 +
6 +test_expect_success 'setup' '
7 + echo a >file &&
8 + git add file
9 + test_tick &&
10 + git commit -m one &&
11 + echo b >>file &&
12 + echo c >>file &&
13 + echo d >>file &&
14 + test_tick &&
15 + git commit -a -m two
16 +'
17 +
18 +cat >expect <<'EOF'
19 +^baf5e0b (A U Thor 2005-04-07 15:13:13 -0700 1) a
20 +8825379d (A U Thor 2005-04-07 15:14:13 -0700 2) b
21 +8825379d (A U Thor 2005-04-07 15:14:13 -0700 3) c
22 +8825379d (A U Thor 2005-04-07 15:14:13 -0700 4) d
23 +EOF
24 +test_expect_success 'normal blame output' '
25 + git blame file >actual &&
26 + test_cmp expect actual
27 +'
28 +
29 +ID1=baf5e0b3869e0b2b2beb395a3720c7b51eac94fc
30 +COMMIT1='author A U Thor
31 +author-mail <author@example.com>
32 +author-time 1112911993
33 +author-tz -0700
34 +committer C O Mitter
35 +committer-mail <committer@example.com>
36 +committer-time 1112911993
37 +committer-tz -0700
38 +summary one
39 +boundary
40 +filename file'
41 +ID2=8825379dfb8a1267b58e8e5bcf69eec838f685ec
42 +COMMIT2='author A U Thor
43 +author-mail <author@example.com>
44 +author-time 1112912053
45 +author-tz -0700
46 +committer C O Mitter
47 +committer-mail <committer@example.com>
48 +committer-time 1112912053
49 +committer-tz -0700
50 +summary two
51 +previous baf5e0b3869e0b2b2beb395a3720c7b51eac94fc file
52 +filename file'
53 +
54 +cat >expect <<EOF
55 +$ID1 1 1 1
56 +$COMMIT1
57 + a
58 +$ID2 2 2 3
59 +$COMMIT2
60 + b
61 +$ID2 3 3
62 + c
63 +$ID2 4 4
64 + d
65 +EOF
66 +test_expect_success 'blame --porcelain output' '
67 + git blame --porcelain file >actual &&
68 + test_cmp expect actual
69 +'
70 +
71 +test_done