archive: handle commits with an empty tree
[git/jnareb-git.git] / t / t8008-blame-formats.sh
blobd15f8b3d473416eaed24ed92396d567aa785c3d8
1 #!/bin/sh
3 test_description='blame output in various formats on a simple case'
4 . ./test-lib.sh
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
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
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'
54 cat >expect <<EOF
55 $ID1 1 1 1
56 $COMMIT1
58 $ID2 2 2 3
59 $COMMIT2
61 $ID2 3 3
63 $ID2 4 4
65 EOF
66 test_expect_success 'blame --porcelain output' '
67 git blame --porcelain file >actual &&
68 test_cmp expect actual
71 cat >expect <<EOF
72 $ID1 1 1 1
73 $COMMIT1
75 $ID2 2 2 3
76 $COMMIT2
78 $ID2 3 3
79 $COMMIT2
81 $ID2 4 4
82 $COMMIT2
84 EOF
85 test_expect_success 'blame --line-porcelain output' '
86 git blame --line-porcelain file >actual &&
87 test_cmp expect actual
90 test_done