]> git.ipfire.org Git - thirdparty/git.git/blame - t/t8002-blame.sh
Merge branch 'jk/pending-keep-tag-name' into maint
[thirdparty/git.git] / t / t8002-blame.sh
CommitLineData
8752d11d
FK
1#!/bin/sh
2
5be60078 3test_description='git blame'
8752d11d
FK
4. ./test-lib.sh
5
6PROG='git blame -c'
bfdbee98 7. "$TEST_DIRECTORY"/annotate-tests.sh
8752d11d 8
1b8cdce9 9PROG='git blame -c -e'
e37f39c1
ES
10test_expect_success 'blame --show-email' '
11 check_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>" 1
1b8cdce9
KB
20'
21
8b504db3
QN
22test_expect_success 'setup showEmail tests' '
23 echo "bin: test number 1" >one &&
24 git add one &&
25 GIT_AUTHOR_NAME=name1 \
26 GIT_AUTHOR_EMAIL=email1@test.git \
27 git commit -m First --date="2010-01-01 01:00:00" &&
28 cat >expected_n <<-\EOF &&
29 (name1 2010-01-01 01:00:00 +0000 1) bin: test number 1
30 EOF
31 cat >expected_e <<-\EOF
32 (<email1@test.git> 2010-01-01 01:00:00 +0000 1) bin: test number 1
33 EOF
34'
35
36find_blame () {
37 sed -e 's/^[^(]*//'
38}
39
40test_expect_success 'blame with no options and no config' '
41 git blame one >blame &&
42 find_blame <blame >result &&
43 test_cmp expected_n result
44'
45
46test_expect_success 'blame with showemail options' '
47 git blame --show-email one >blame1 &&
48 find_blame <blame1 >result &&
49 test_cmp expected_e result &&
50 git blame -e one >blame2 &&
51 find_blame <blame2 >result &&
52 test_cmp expected_e result &&
53 git blame --no-show-email one >blame3 &&
54 find_blame <blame3 >result &&
55 test_cmp expected_n result
56'
57
58test_expect_success 'blame with showEmail config false' '
59 git config blame.showEmail false &&
60 git blame one >blame1 &&
61 find_blame <blame1 >result &&
62 test_cmp expected_n result &&
63 git blame --show-email one >blame2 &&
64 find_blame <blame2 >result &&
65 test_cmp expected_e result &&
66 git blame -e one >blame3 &&
67 find_blame <blame3 >result &&
68 test_cmp expected_e result &&
69 git blame --no-show-email one >blame4 &&
70 find_blame <blame4 >result &&
71 test_cmp expected_n result
72'
73
74test_expect_success 'blame with showEmail config true' '
75 git config blame.showEmail true &&
76 git blame one >blame1 &&
77 find_blame <blame1 >result &&
78 test_cmp expected_e result &&
79 git blame --no-show-email one >blame2 &&
80 find_blame <blame2 >result &&
81 test_cmp expected_n result
82'
83
8752d11d 84test_done