Merge branch 'es/worktree-repair-copied' into cw/worktrees-relative
[git/gitster.git] / t / t8005-blame-i18n.sh
blob75da219ed1be95c8279b363816d46bc3e2686fc3
1 #!/bin/sh
3 test_description='git blame encoding conversion'
4 . ./test-lib.sh
6 . "$TEST_DIRECTORY"/t8005/utf8.txt
7 . "$TEST_DIRECTORY"/t8005/euc-japan.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 "EUC-JAPAN LINE" >> file &&
17 git add file &&
18 git config i18n.commitencoding eucJP &&
19 git commit --author "$EUC_JAPAN_NAME <euc-japan@localhost>" -m "$EUC_JAPAN_MSG" &&
21 echo "SJIS LINE" >> file &&
22 git add file &&
23 git config i18n.commitencoding SJIS &&
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 filter_author_summary () {
37 sed -n -e '/^author /p' -e '/^summary /p' "$@"
40 test_expect_success !MINGW \
41 'blame respects i18n.commitencoding' '
42 git blame --incremental file >output &&
43 filter_author_summary output >actual &&
44 test_cmp expected actual
47 cat >expected <<EOF
48 author $EUC_JAPAN_NAME
49 summary $EUC_JAPAN_MSG
50 author $EUC_JAPAN_NAME
51 summary $EUC_JAPAN_MSG
52 author $EUC_JAPAN_NAME
53 summary $EUC_JAPAN_MSG
54 EOF
56 test_expect_success !MINGW \
57 'blame respects i18n.logoutputencoding' '
58 git config i18n.logoutputencoding eucJP &&
59 git blame --incremental file >output &&
60 filter_author_summary output >actual &&
61 test_cmp expected actual
64 cat >expected <<EOF
65 author $UTF8_NAME
66 summary $UTF8_MSG
67 author $UTF8_NAME
68 summary $UTF8_MSG
69 author $UTF8_NAME
70 summary $UTF8_MSG
71 EOF
73 test_expect_success !MINGW \
74 'blame respects --encoding=UTF-8' '
75 git blame --incremental --encoding=UTF-8 file >output &&
76 filter_author_summary output >actual &&
77 test_cmp expected actual
80 cat >expected <<EOF
81 author $SJIS_NAME
82 summary $SJIS_MSG
83 author $EUC_JAPAN_NAME
84 summary $EUC_JAPAN_MSG
85 author $UTF8_NAME
86 summary $UTF8_MSG
87 EOF
89 test_expect_success !MINGW \
90 'blame respects --encoding=none' '
91 git blame --incremental --encoding=none file >output &&
92 filter_author_summary output >actual &&
93 test_cmp expected actual
96 test_done