Interested in helping open source friends on HP-UX?
[git/mjg.git] / t / t8005-blame-i18n.sh
blob8c3ab2810487c8ea6dcef893378978558aced713
1 #!/bin/sh
3 test_description='git blame encoding conversion'
4 . ./test-lib.sh
6 if ! test_have_prereq ICONV; then
7 skip_all='skipping i18n tests, iconv not available'
8 test_done
9 fi
11 . "$TEST_DIRECTORY"/t8005/utf8.txt
12 . "$TEST_DIRECTORY"/t8005/euc-japan.txt
13 . "$TEST_DIRECTORY"/t8005/sjis.txt
15 test_expect_success 'setup the repository' '
16 # Create the file
17 echo "UTF-8 LINE" > file &&
18 git add file &&
19 git commit --author "$UTF8_NAME <utf8@localhost>" -m "$UTF8_MSG" &&
21 echo "EUC-JAPAN LINE" >> file &&
22 git add file &&
23 git config i18n.commitencoding eucJP &&
24 git commit --author "$EUC_JAPAN_NAME <euc-japan@localhost>" -m "$EUC_JAPAN_MSG" &&
26 echo "SJIS LINE" >> file &&
27 git add file &&
28 git config i18n.commitencoding SJIS &&
29 git commit --author "$SJIS_NAME <sjis@localhost>" -m "$SJIS_MSG"
32 cat >expected <<EOF
33 author $SJIS_NAME
34 summary $SJIS_MSG
35 author $SJIS_NAME
36 summary $SJIS_MSG
37 author $SJIS_NAME
38 summary $SJIS_MSG
39 EOF
41 test_expect_success !MINGW \
42 'blame respects i18n.commitencoding' '
43 git blame --incremental file | \
44 egrep "^(author|summary) " > actual &&
45 test_cmp actual expected
48 cat >expected <<EOF
49 author $EUC_JAPAN_NAME
50 summary $EUC_JAPAN_MSG
51 author $EUC_JAPAN_NAME
52 summary $EUC_JAPAN_MSG
53 author $EUC_JAPAN_NAME
54 summary $EUC_JAPAN_MSG
55 EOF
57 test_expect_success !MINGW \
58 'blame respects i18n.logoutputencoding' '
59 git config i18n.logoutputencoding eucJP &&
60 git blame --incremental file | \
61 egrep "^(author|summary) " > actual &&
62 test_cmp actual expected
65 cat >expected <<EOF
66 author $UTF8_NAME
67 summary $UTF8_MSG
68 author $UTF8_NAME
69 summary $UTF8_MSG
70 author $UTF8_NAME
71 summary $UTF8_MSG
72 EOF
74 test_expect_success !MINGW \
75 'blame respects --encoding=UTF-8' '
76 git blame --incremental --encoding=UTF-8 file | \
77 egrep "^(author|summary) " > actual &&
78 test_cmp actual expected
81 cat >expected <<EOF
82 author $SJIS_NAME
83 summary $SJIS_MSG
84 author $EUC_JAPAN_NAME
85 summary $EUC_JAPAN_MSG
86 author $UTF8_NAME
87 summary $UTF8_MSG
88 EOF
90 test_expect_success !MINGW \
91 'blame respects --encoding=none' '
92 git blame --incremental --encoding=none file | \
93 egrep "^(author|summary) " > actual &&
94 test_cmp actual expected
97 test_done