]>
Commit | Line | Data |
---|---|---|
69cd8f63 AG |
1 | #!/bin/sh |
2 | ||
3 | test_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 | ||
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" && | |
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 | ||
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 | |
35 | ||
0be43ded JK |
36 | filter_author_summary () { |
37 | sed -n -e '/^author /p' -e '/^summary /p' "$@" | |
38 | } | |
39 | ||
f57a8715 | 40 | test_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 | ||
47 | cat >expected <<EOF | |
54bc13ce JH |
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 | |
69cd8f63 AG |
54 | EOF |
55 | ||
f57a8715 | 56 | test_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 | ||
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 | |
72 | ||
f57a8715 | 73 | test_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 | ||
80 | cat >expected <<EOF | |
81 | author $SJIS_NAME | |
82 | summary $SJIS_MSG | |
54bc13ce JH |
83 | author $EUC_JAPAN_NAME |
84 | summary $EUC_JAPAN_MSG | |
69cd8f63 AG |
85 | author $UTF8_NAME |
86 | summary $UTF8_MSG | |
87 | EOF | |
88 | ||
f57a8715 | 89 | test_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 | ||
96 | test_done |