From 838466b8f7f9e8752a14114d5c4b1d685e0c6c25 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Mon, 9 May 2011 09:33:30 -0400 Subject: 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 Signed-off-by: Junio C Hamano --- t/t8008-blame-formats.sh | 71 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100755 t/t8008-blame-formats.sh (limited to 't') diff --git a/t/t8008-blame-formats.sh b/t/t8008-blame-formats.sh new file mode 100755 index 0000000000..387d1a6b98 --- /dev/null +++ b/t/t8008-blame-formats.sh @@ -0,0 +1,71 @@ +#!/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 +' + +cat >expect <<'EOF' +^baf5e0b (A U Thor 2005-04-07 15:13:13 -0700 1) a +8825379d (A U Thor 2005-04-07 15:14:13 -0700 2) b +8825379d (A U Thor 2005-04-07 15:14:13 -0700 3) c +8825379d (A U Thor 2005-04-07 15:14:13 -0700 4) d +EOF +test_expect_success 'normal blame output' ' + git blame file >actual && + test_cmp expect actual +' + +ID1=baf5e0b3869e0b2b2beb395a3720c7b51eac94fc +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' +ID2=8825379dfb8a1267b58e8e5bcf69eec838f685ec +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 baf5e0b3869e0b2b2beb395a3720c7b51eac94fc file +filename file' + +cat >expect <actual && + test_cmp expect actual +' + +test_done -- cgit v1.2.1 From ed747dd5216ba1fe6fa59da9585dcd6cced202bb Mon Sep 17 00:00:00 2001 From: Jeff King Date: Mon, 9 May 2011 09:34:42 -0400 Subject: blame: add --line-porcelain output format This is just like --porcelain, except that we always output the commit information for each line, not just the first time it is referenced. This can make quick and dirty scripts much easier to write; see the example added to the blame documentation. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/t8008-blame-formats.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 't') diff --git a/t/t8008-blame-formats.sh b/t/t8008-blame-formats.sh index 387d1a6b98..d15f8b3d47 100755 --- a/t/t8008-blame-formats.sh +++ b/t/t8008-blame-formats.sh @@ -68,4 +68,23 @@ test_expect_success 'blame --porcelain output' ' test_cmp expect actual ' +cat >expect <actual && + test_cmp expect actual +' + test_done -- cgit v1.2.1