#!/bin/sh test_description='blame output in various formats on a simple case' . ./test-lib.sh test_expect_success 'setup' ' echo a >file && git add file && test_tick && git commit -m one && echo b >>file && echo c >>file && echo d >>file && test_tick && git commit -a -m two && ID1=$(git rev-parse HEAD^) && shortID1="^$(git rev-parse HEAD^ |cut -c 1-17)" && ID2=$(git rev-parse HEAD) && shortID2="$(git rev-parse HEAD |cut -c 1-18)" ' cat >expect <actual && test_cmp expect actual ' COMMIT1="author A U Thor author-mail author-time 1112911993 author-tz -0700 committer C O Mitter committer-mail committer-time 1112911993 committer-tz -0700 summary one boundary filename file" COMMIT2="author A U Thor author-mail author-time 1112912053 author-tz -0700 committer C O Mitter committer-mail committer-time 1112912053 committer-tz -0700 summary two previous $ID1 file filename file" cat >expect <actual && test_cmp expect actual ' cat >expect <actual && test_cmp expect actual ' test_expect_success '--porcelain detects first non-blank line as subject' ' ( GIT_INDEX_FILE=.git/tmp-index && export GIT_INDEX_FILE && echo "This is it" >single-file && git add single-file && tree=$(git write-tree) && commit=$(printf "%s\n%s\n%s\n\n\n \noneline\n\nbody\n" \ "tree $tree" \ "author A 123456789 +0000" \ "committer C 123456789 +0000" | git hash-object -w -t commit --stdin) && git blame --porcelain $commit -- single-file >output && grep "^summary oneline$" output ) ' test_done