3 test_description='git blame'
7 . "$TEST_DIRECTORY"/annotate-tests.sh
9 test_expect_success 'blame untracked file in empty repo' '
11 test_must_fail git blame untracked
14 PROG='git blame -c -e'
15 test_expect_success 'blame --show-email' '
21 "<author@example.com>" 1 \
24 "<E at test dot git>" 1
27 test_expect_success 'setup showEmail tests' '
28 echo "bin: test number 1" >one &&
30 GIT_AUTHOR_NAME=name1 \
31 GIT_AUTHOR_EMAIL=email1@test.git \
32 git commit -m First --date="2010-01-01 01:00:00" &&
33 cat >expected_n <<-\EOF &&
34 (name1 2010-01-01 01:00:00 +0000 1) bin: test number 1
36 cat >expected_e <<-\EOF
37 (<email1@test.git> 2010-01-01 01:00:00 +0000 1) bin: test number 1
45 test_expect_success 'blame with no options and no config' '
46 git blame one >blame &&
47 find_blame <blame >result &&
48 test_cmp expected_n result
51 test_expect_success 'blame with showemail options' '
52 git blame --show-email one >blame1 &&
53 find_blame <blame1 >result &&
54 test_cmp expected_e result &&
55 git blame -e one >blame2 &&
56 find_blame <blame2 >result &&
57 test_cmp expected_e result &&
58 git blame --no-show-email one >blame3 &&
59 find_blame <blame3 >result &&
60 test_cmp expected_n result
63 test_expect_success 'blame with showEmail config false' '
64 git config blame.showEmail false &&
65 git blame one >blame1 &&
66 find_blame <blame1 >result &&
67 test_cmp expected_n result &&
68 git blame --show-email one >blame2 &&
69 find_blame <blame2 >result &&
70 test_cmp expected_e result &&
71 git blame -e one >blame3 &&
72 find_blame <blame3 >result &&
73 test_cmp expected_e result &&
74 git blame --no-show-email one >blame4 &&
75 find_blame <blame4 >result &&
76 test_cmp expected_n result
79 test_expect_success 'blame with showEmail config true' '
80 git config blame.showEmail true &&
81 git blame one >blame1 &&
82 find_blame <blame1 >result &&
83 test_cmp expected_e result &&
84 git blame --no-show-email one >blame2 &&
85 find_blame <blame2 >result &&
86 test_cmp expected_n result