]> git.ipfire.org Git - thirdparty/git.git/blame - t/t8005-blame-i18n.sh
path.c: don't call the match function without value in trie_find()
[thirdparty/git.git] / t / t8005-blame-i18n.sh
CommitLineData
69cd8f63
AG
1#!/bin/sh
2
3test_description='git blame encoding conversion'
4. ./test-lib.sh
5
6. "$TEST_DIRECTORY"/t8005/utf8.txt
54bc13ce 7. "$TEST_DIRECTORY"/t8005/euc-japan.txt
69cd8f63
AG
8. "$TEST_DIRECTORY"/t8005/sjis.txt
9
10test_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" &&
15
54bc13ce 16 echo "EUC-JAPAN LINE" >> file &&
69cd8f63 17 git add file &&
54bc13ce
JH
18 git config i18n.commitencoding eucJP &&
19 git commit --author "$EUC_JAPAN_NAME <euc-japan@localhost>" -m "$EUC_JAPAN_MSG" &&
69cd8f63
AG
20
21 echo "SJIS LINE" >> file &&
22 git add file &&
bdb0a7e4 23 git config i18n.commitencoding SJIS &&
69cd8f63
AG
24 git commit --author "$SJIS_NAME <sjis@localhost>" -m "$SJIS_MSG"
25'
26
27cat >expected <<EOF
28author $SJIS_NAME
29summary $SJIS_MSG
30author $SJIS_NAME
31summary $SJIS_MSG
32author $SJIS_NAME
33summary $SJIS_MSG
34EOF
35
0be43ded
JK
36filter_author_summary () {
37 sed -n -e '/^author /p' -e '/^summary /p' "$@"
38}
39
f57a8715 40test_expect_success !MINGW \
69cd8f63 41 'blame respects i18n.commitencoding' '
0be43ded
JK
42 git blame --incremental file >output &&
43 filter_author_summary output >actual &&
44 test_cmp expected actual
69cd8f63
AG
45'
46
47cat >expected <<EOF
54bc13ce
JH
48author $EUC_JAPAN_NAME
49summary $EUC_JAPAN_MSG
50author $EUC_JAPAN_NAME
51summary $EUC_JAPAN_MSG
52author $EUC_JAPAN_NAME
53summary $EUC_JAPAN_MSG
69cd8f63
AG
54EOF
55
f57a8715 56test_expect_success !MINGW \
69cd8f63 57 'blame respects i18n.logoutputencoding' '
54bc13ce 58 git config i18n.logoutputencoding eucJP &&
0be43ded
JK
59 git blame --incremental file >output &&
60 filter_author_summary output >actual &&
61 test_cmp expected actual
69cd8f63
AG
62'
63
64cat >expected <<EOF
65author $UTF8_NAME
66summary $UTF8_MSG
67author $UTF8_NAME
68summary $UTF8_MSG
69author $UTF8_NAME
70summary $UTF8_MSG
71EOF
72
f57a8715 73test_expect_success !MINGW \
bdb0a7e4 74 'blame respects --encoding=UTF-8' '
0be43ded
JK
75 git blame --incremental --encoding=UTF-8 file >output &&
76 filter_author_summary output >actual &&
77 test_cmp expected actual
69cd8f63
AG
78'
79
80cat >expected <<EOF
81author $SJIS_NAME
82summary $SJIS_MSG
54bc13ce
JH
83author $EUC_JAPAN_NAME
84summary $EUC_JAPAN_MSG
69cd8f63
AG
85author $UTF8_NAME
86summary $UTF8_MSG
87EOF
88
f57a8715 89test_expect_success !MINGW \
69cd8f63 90 'blame respects --encoding=none' '
0be43ded
JK
91 git blame --incremental --encoding=none file >output &&
92 filter_author_summary output >actual &&
93 test_cmp expected actual
69cd8f63
AG
94'
95
96test_done