1#!/bin/sh23test_description='git blame'4. ./test-lib.sh56PROG='git blame -c'7. "$TEST_DIRECTORY"/annotate-tests.sh89PROG='git blame -c -e'10test_expect_success 'blame --show-email' '11check_count \12"<A@test.git>" 1 \13"<B@test.git>" 1 \14"<B1@test.git>" 1 \15"<B2@test.git>" 1 \16"<author@example.com>" 1 \17"<C@test.git>" 1 \18"<D@test.git>" 1 \19"<E at test dot git>" 120'2122test_expect_success 'setup showEmail tests' '23echo "bin: test number 1" >one &&24git add one &&25GIT_AUTHOR_NAME=name1 \26GIT_AUTHOR_EMAIL=email1@test.git \27git commit -m First --date="2010-01-01 01:00:00" &&28cat >expected_n <<-\EOF &&29(name1 2010-01-01 01:00:00 +0000 1) bin: test number 130EOF31cat >expected_e <<-\EOF32(<email1@test.git> 2010-01-01 01:00:00 +0000 1) bin: test number 133EOF34'3536find_blame () {37sed -e 's/^[^(]*//'38}3940test_expect_success 'blame with no options and no config' '41git blame one >blame &&42find_blame <blame >result &&43test_cmp expected_n result44'4546test_expect_success 'blame with showemail options' '47git blame --show-email one >blame1 &&48find_blame <blame1 >result &&49test_cmp expected_e result &&50git blame -e one >blame2 &&51find_blame <blame2 >result &&52test_cmp expected_e result &&53git blame --no-show-email one >blame3 &&54find_blame <blame3 >result &&55test_cmp expected_n result56'5758test_expect_success 'blame with showEmail config false' '59git config blame.showEmail false &&60git blame one >blame1 &&61find_blame <blame1 >result &&62test_cmp expected_n result &&63git blame --show-email one >blame2 &&64find_blame <blame2 >result &&65test_cmp expected_e result &&66git blame -e one >blame3 &&67find_blame <blame3 >result &&68test_cmp expected_e result &&69git blame --no-show-email one >blame4 &&70find_blame <blame4 >result &&71test_cmp expected_n result72'7374test_expect_success 'blame with showEmail config true' '75git config blame.showEmail true &&76git blame one >blame1 &&77find_blame <blame1 >result &&78test_cmp expected_e result &&79git blame --no-show-email one >blame2 &&80find_blame <blame2 >result &&81test_cmp expected_n result82'8384test_done