3 test_description
='blame output in various formats on a simple case'
5 TEST_PASSES_SANITIZE_LEAK
=true
8 test_expect_success
'setup' '
17 git commit -a -m two &&
18 ID1=$(git rev-parse HEAD^) &&
19 shortID1="^$(git rev-parse HEAD^ |cut -c 1-17)" &&
20 ID2=$(git rev-parse HEAD) &&
21 shortID2="$(git rev-parse HEAD |cut -c 1-18)"
25 $shortID1 (A U Thor 2005-04-07 15:13:13 -0700 1) a
26 $shortID2 (A U Thor 2005-04-07 15:14:13 -0700 2) b
27 $shortID2 (A U Thor 2005-04-07 15:14:13 -0700 3) c
28 $shortID2 (A U Thor 2005-04-07 15:14:13 -0700 4) d
30 test_expect_success
'normal blame output' '
31 git blame --abbrev=17 file >actual &&
32 test_cmp expect actual
35 COMMIT1
="author A U Thor
36 author-mail <author@example.com>
37 author-time 1112911993
40 committer-mail <committer@example.com>
41 committer-time 1112911993
46 COMMIT2
="author A U Thor
47 author-mail <author@example.com>
48 author-time 1112912053
51 committer-mail <committer@example.com>
52 committer-time 1112912053
70 test_expect_success
'blame --porcelain output' '
71 git blame --porcelain file >actual &&
72 test_cmp expect actual
89 test_expect_success
'blame --line-porcelain output' '
90 git blame --line-porcelain file >actual &&
91 test_cmp expect actual
94 test_expect_success
'--porcelain detects first non-blank line as subject' '
96 GIT_INDEX_FILE=.git/tmp-index &&
97 export GIT_INDEX_FILE &&
98 echo "This is it" >single-file &&
99 git add single-file &&
100 tree=$(git write-tree) &&
101 commit=$(printf "%s\n%s\n%s\n\n\n \noneline\n\nbody\n" \
103 "author A <a@b.c> 123456789 +0000" \
104 "committer C <c@d.e> 123456789 +0000" |
105 git hash-object -w -t commit --stdin) &&
106 git blame --porcelain $commit -- single-file >output &&
107 grep "^summary oneline$" output