Update draft release notes to 1.6.1
[git.git] / t / t8005-blame-i18n.sh
blob4470a92bb235420a2a0123eca5b57e06039ff011
1 #!/bin/sh
3 test_description='git blame encoding conversion'
4 . ./test-lib.sh
6 . "$TEST_DIRECTORY"/t8005/utf8.txt
7 . "$TEST_DIRECTORY"/t8005/cp1251.txt
8 . "$TEST_DIRECTORY"/t8005/sjis.txt
10 test_expect_success 'setup the repository' '
11 # Create the file
12 echo "UTF-8 LINE" > file &&
13 git add file &&
14 git commit --author "$UTF8_NAME <utf8@localhost>" -m "$UTF8_MSG" &&
16 echo "CP1251 LINE" >> file &&
17 git add file &&
18 git config i18n.commitencoding cp1251 &&
19 git commit --author "$CP1251_NAME <cp1251@localhost>" -m "$CP1251_MSG" &&
21 echo "SJIS LINE" >> file &&
22 git add file &&
23 git config i18n.commitencoding shift-jis &&
24 git commit --author "$SJIS_NAME <sjis@localhost>" -m "$SJIS_MSG"
27 cat >expected <<EOF
28 author $SJIS_NAME
29 summary $SJIS_MSG
30 author $SJIS_NAME
31 summary $SJIS_MSG
32 author $SJIS_NAME
33 summary $SJIS_MSG
34 EOF
36 test_expect_success \
37 'blame respects i18n.commitencoding' '
38 git blame --incremental file | \
39 grep "^\(author\|summary\) " > actual &&
40 test_cmp actual expected
43 cat >expected <<EOF
44 author $CP1251_NAME
45 summary $CP1251_MSG
46 author $CP1251_NAME
47 summary $CP1251_MSG
48 author $CP1251_NAME
49 summary $CP1251_MSG
50 EOF
52 test_expect_success \
53 'blame respects i18n.logoutputencoding' '
54 git config i18n.logoutputencoding cp1251 &&
55 git blame --incremental file | \
56 grep "^\(author\|summary\) " > actual &&
57 test_cmp actual expected
60 cat >expected <<EOF
61 author $UTF8_NAME
62 summary $UTF8_MSG
63 author $UTF8_NAME
64 summary $UTF8_MSG
65 author $UTF8_NAME
66 summary $UTF8_MSG
67 EOF
69 test_expect_success \
70 'blame respects --encoding=utf-8' '
71 git blame --incremental --encoding=utf-8 file | \
72 grep "^\(author\|summary\) " > actual &&
73 test_cmp actual expected
76 cat >expected <<EOF
77 author $SJIS_NAME
78 summary $SJIS_MSG
79 author $CP1251_NAME
80 summary $CP1251_MSG
81 author $UTF8_NAME
82 summary $UTF8_MSG
83 EOF
85 test_expect_success \
86 'blame respects --encoding=none' '
87 git blame --incremental --encoding=none file | \
88 grep "^\(author\|summary\) " > actual &&
89 test_cmp actual expected
92 test_done