From 289e162318bbf4b0f90dd70371046e1b20d4c0be Mon Sep 17 00:00:00 2001 From: Thomas Rast Date: Thu, 19 Feb 2009 12:13:38 +0100 Subject: Test log --graph So far there were no tests checking that log --graph actually works. Note that the tests strip trailing whitespace, as the current --graph emits trailing whitespace on lines that do not contain anything but graph lines. Signed-off-by: Thomas Rast Signed-off-by: Junio C Hamano --- t/t4202-log.sh | 148 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) (limited to 't/t4202-log.sh') diff --git a/t/t4202-log.sh b/t/t4202-log.sh index 7b976ee36d..93966f78f8 100755 --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@ -134,5 +134,153 @@ test_expect_success 'log --grep -i' ' test_cmp expect actual ' +cat > expect <actual && + test_cmp expect actual +' + +test_expect_success 'set up merge history' ' + git checkout -b side HEAD~4 && + test_commit side-1 1 1 && + test_commit side-2 2 2 && + git checkout master && + git merge side +' + +cat > expect <<\EOF +* Merge branch 'side' +|\ +| * side-2 +| * side-1 +* | Second +* | sixth +* | fifth +* | fourth +|/ +* third +* second +* initial +EOF + +test_expect_success 'log --graph with merge' ' + git log --graph --date-order --pretty=tformat:%s | + sed "s/ *$//" >actual && + test_cmp expect actual +' + +cat > expect <<\EOF +* commit master +|\ Merge: A B +| | Author: A U Thor +| | +| | Merge branch 'side' +| | +| * commit side +| | Author: A U Thor +| | +| | side-2 +| | +| * commit tags/side-1 +| | Author: A U Thor +| | +| | side-1 +| | +* | commit master~1 +| | Author: A U Thor +| | +| | Second +| | +* | commit master~2 +| | Author: A U Thor +| | +| | sixth +| | +* | commit master~3 +| | Author: A U Thor +| | +| | fifth +| | +* | commit master~4 +|/ Author: A U Thor +| +| fourth +| +* commit tags/side-1~1 +| Author: A U Thor +| +| third +| +* commit tags/side-1~2 +| Author: A U Thor +| +| second +| +* commit tags/side-1~3 + Author: A U Thor + + initial +EOF + +test_expect_success 'log --graph with full output' ' + git log --graph --date-order --pretty=short | + git name-rev --name-only --stdin | + sed "s/Merge:.*/Merge: A B/;s/ *$//" >actual && + test_cmp expect actual +' + +test_expect_success 'set up more tangled history' ' + git checkout -b tangle HEAD~6 && + test_commit tangle-a tangle-a a && + git merge master~3 && + git merge side~1 && + git checkout master && + git merge tangle +' + +cat > expect <<\EOF +* Merge branch 'tangle' +|\ +| * Merge branch 'side' (early part) into tangle +| |\ +| * \ Merge branch 'master' (early part) into tangle +| |\ \ +| * | | tangle-a +* | | | Merge branch 'side' +|\ \ \ \ +| * | | | side-2 +| | | |/ +| | |/| +| |/| | +| * | | side-1 +* | | | Second +* | | | sixth +| | |/ +| |/| +|/| | +* | | fifth +* | | fourth +|/ / +* | third +|/ +* second +* initial +EOF + +test_expect_success 'log --graph with merge' ' + git log --graph --date-order --pretty=tformat:%s | + sed "s/ *$//" >actual && + test_cmp expect actual +' + test_done -- cgit v1.2.3 From bb93afd5153948e58d6b09c86e7c106a65dbfb65 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Tue, 24 Feb 2009 23:06:37 +0200 Subject: Add tests for git log --pretty, --format and --oneline. More specifically; --pretty=format, tformat and new %foo shortcut. Signed-off-by: Felipe Contreras Signed-off-by: Junio C Hamano --- t/t4202-log.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 't/t4202-log.sh') diff --git a/t/t4202-log.sh b/t/t4202-log.sh index 7b976ee36d..6d43459dd1 100755 --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@ -37,6 +37,46 @@ test_expect_success setup ' ' +printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial" > expect +test_expect_success 'pretty' ' + + git log --pretty="format:%s" > actual && + test_cmp expect actual +' + +printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial\n" > expect +test_expect_success 'pretty (tformat)' ' + + git log --pretty="tformat:%s" > actual && + test_cmp expect actual +' + +test_expect_success 'pretty (shortcut)' ' + + git log --pretty="%s" > actual && + test_cmp expect actual +' + +test_expect_success 'format' ' + + git log --format="%s" > actual && + test_cmp expect actual +' + +cat > expect << EOF +804a787 sixth +394ef78 fifth +5d31159 fourth +2fbe8c0 third +f7dab8e second +3a2fdcb initial +EOF +test_expect_success 'oneline' ' + + git log --oneline > actual && + test_cmp expect actual +' + test_expect_success 'diff-filter=A' ' actual=$(git log --pretty="format:%s" --diff-filter=A HEAD) && -- cgit v1.2.3