3 test_description='blame output in various formats on a simple case'
6 test_expect_success 'setup' '
15 git commit -a -m two &&
16 ID1=$(git rev-parse HEAD^) &&
17 shortID1="^$(git rev-parse HEAD^ |cut -c 1-17)" &&
18 ID2=$(git rev-parse HEAD) &&
19 shortID2="$(git rev-parse HEAD |cut -c 1-18)"
23 $shortID1 (A U Thor 2005-04-07 15:13:13 -0700 1) a
24 $shortID2 (A U Thor 2005-04-07 15:14:13 -0700 2) b
25 $shortID2 (A U Thor 2005-04-07 15:14:13 -0700 3) c
26 $shortID2 (A U Thor 2005-04-07 15:14:13 -0700 4) d
28 test_expect_success 'normal blame output' '
29 git blame --abbrev=17 file >actual &&
30 test_cmp expect actual
33 COMMIT1="author A U Thor
34 author-mail <author@example.com>
35 author-time 1112911993
38 committer-mail <committer@example.com>
39 committer-time 1112911993
44 COMMIT2="author A U Thor
45 author-mail <author@example.com>
46 author-time 1112912053
49 committer-mail <committer@example.com>
50 committer-time 1112912053
68 test_expect_success 'blame --porcelain output' '
69 git blame --porcelain file >actual &&
70 test_cmp expect actual
87 test_expect_success 'blame --line-porcelain output' '
88 git blame --line-porcelain file >actual &&
89 test_cmp expect actual
92 test_expect_success '--porcelain detects first non-blank line as subject' '
94 GIT_INDEX_FILE=.git/tmp-index &&
95 export GIT_INDEX_FILE &&
96 echo "This is it" >single-file &&
97 git add single-file &&
98 tree=$(git write-tree) &&
99 commit=$(printf "%s\n%s\n%s\n\n\n \noneline\n\nbody\n" \
101 "author A <a@b.c> 123456789 +0000" \
102 "committer C <c@d.e> 123456789 +0000" |
103 git hash-object -w -t commit --stdin) &&
104 git blame --porcelain $commit -- single-file >output &&
105 grep "^summary oneline$" output