]>
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 | ||
36 | test_expect_success \ | |
37 | 'blame respects i18n.commitencoding' ' | |
38 | git blame --incremental file | \ | |
0b05dc2b | 39 | egrep "^(author|summary) " > actual && |
69cd8f63 AG |
40 | test_cmp actual expected |
41 | ' | |
42 | ||
43 | cat >expected <<EOF | |
54bc13ce JH |
44 | author $EUC_JAPAN_NAME |
45 | summary $EUC_JAPAN_MSG | |
46 | author $EUC_JAPAN_NAME | |
47 | summary $EUC_JAPAN_MSG | |
48 | author $EUC_JAPAN_NAME | |
49 | summary $EUC_JAPAN_MSG | |
69cd8f63 AG |
50 | EOF |
51 | ||
52 | test_expect_success \ | |
53 | 'blame respects i18n.logoutputencoding' ' | |
54bc13ce | 54 | git config i18n.logoutputencoding eucJP && |
69cd8f63 | 55 | git blame --incremental file | \ |
0b05dc2b | 56 | egrep "^(author|summary) " > actual && |
69cd8f63 AG |
57 | test_cmp actual expected |
58 | ' | |
59 | ||
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 | |
68 | ||
69 | test_expect_success \ | |
bdb0a7e4 BC |
70 | 'blame respects --encoding=UTF-8' ' |
71 | git blame --incremental --encoding=UTF-8 file | \ | |
0b05dc2b | 72 | egrep "^(author|summary) " > actual && |
69cd8f63 AG |
73 | test_cmp actual expected |
74 | ' | |
75 | ||
76 | cat >expected <<EOF | |
77 | author $SJIS_NAME | |
78 | summary $SJIS_MSG | |
54bc13ce JH |
79 | author $EUC_JAPAN_NAME |
80 | summary $EUC_JAPAN_MSG | |
69cd8f63 AG |
81 | author $UTF8_NAME |
82 | summary $UTF8_MSG | |
83 | EOF | |
84 | ||
85 | test_expect_success \ | |
86 | 'blame respects --encoding=none' ' | |
87 | git blame --incremental --encoding=none file | \ | |
0b05dc2b | 88 | egrep "^(author|summary) " > actual && |
69cd8f63 AG |
89 | test_cmp actual expected |
90 | ' | |
91 | ||
92 | test_done |