3 # Copyright (c) 2019 Doan Tran Cong Danh
6 test_description='rebase with changing encoding
20 iconv -f "$2" -t "$3" "$TEST_DIRECTORY/t3434/$1" >expect &&
21 git cat-file commit HEAD >raw &&
22 sed "1,/^$/d" raw >actual &&
23 test_cmp expect actual
26 test_expect_success setup '
39 test_expect_success 'rebase --rebase-merges update encoding eucJP to UTF-8' '
40 git switch -c merge-eucJP-UTF-8 first &&
41 git config i18n.commitencoding eucJP &&
42 git merge -F "$TEST_DIRECTORY/t3434/eucJP.txt" second &&
43 git config i18n.commitencoding UTF-8 &&
44 git rebase --rebase-merges master &&
45 compare_msg eucJP.txt eucJP UTF-8
48 test_expect_failure 'rebase --rebase-merges update encoding eucJP to ISO-2022-JP' '
49 git switch -c merge-eucJP-ISO-2022-JP first &&
50 git config i18n.commitencoding eucJP &&
51 git merge -F "$TEST_DIRECTORY/t3434/eucJP.txt" second &&
52 git config i18n.commitencoding ISO-2022-JP &&
53 git rebase --rebase-merges master &&
54 compare_msg eucJP.txt eucJP ISO-2022-JP
57 test_rebase_continue_update_encode () {
61 test_expect_success "rebase --continue update from $old to $new" '
62 (git rebase --abort || : abort current git-rebase failure) &&
63 git switch -c conflict-$old-$new one &&
64 echo for-conflict >two.t &&
66 git config i18n.commitencoding $old &&
67 git commit -F "$TEST_DIRECTORY/t3434/$msgfile" &&
68 git config i18n.commitencoding $new &&
69 test_must_fail git rebase -m master &&
70 test -f .git/rebase-merge/message &&
71 git stripspace <.git/rebase-merge/message >two.t &&
73 git rebase --continue &&
74 compare_msg $msgfile $old $new &&
75 : git-commit assume invalid utf-8 is latin1 &&
80 test_rebase_continue_update_encode ISO-8859-1 UTF-8 ISO8859-1.txt
81 test_rebase_continue_update_encode eucJP UTF-8 eucJP.txt
82 test_rebase_continue_update_encode eucJP ISO-2022-JP eucJP.txt