3 # Copyright (c) 2019 Doan Tran Cong Danh
6 test_description
='rebase with changing encoding
17 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
=main
18 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
20 TEST_PASSES_SANITIZE_LEAK
=true
24 iconv -f "$2" -t "$3" "$TEST_DIRECTORY/t3434/$1" >expect
&&
25 git cat-file commit HEAD
>raw
&&
26 sed "1,/^$/d" raw
>actual
&&
27 test_cmp expect actual
30 test_expect_success setup
'
43 test_expect_success
'rebase --rebase-merges update encoding eucJP to UTF-8' '
44 git switch -c merge-eucJP-UTF-8 first &&
45 git config i18n.commitencoding eucJP &&
46 git merge -F "$TEST_DIRECTORY/t3434/eucJP.txt" second &&
47 git config i18n.commitencoding UTF-8 &&
48 git rebase --rebase-merges main &&
49 compare_msg eucJP.txt eucJP UTF-8
52 test_expect_success
'rebase --rebase-merges update encoding eucJP to ISO-2022-JP' '
53 git switch -c merge-eucJP-ISO-2022-JP first &&
54 git config i18n.commitencoding eucJP &&
55 git merge -F "$TEST_DIRECTORY/t3434/eucJP.txt" second &&
56 git config i18n.commitencoding ISO-2022-JP &&
57 git rebase --rebase-merges main &&
58 compare_msg eucJP.txt eucJP ISO-2022-JP
61 test_rebase_continue_update_encode
() {
65 test_expect_success
"rebase --continue update from $old to $new" '
66 (git rebase --abort || : abort current git-rebase failure) &&
67 git switch -c conflict-$old-$new one &&
68 echo for-conflict >two.t &&
70 git config i18n.commitencoding $old &&
71 git commit -F "$TEST_DIRECTORY/t3434/$msgfile" &&
72 git config i18n.commitencoding $new &&
73 test_must_fail git rebase -m main &&
74 test -f .git/rebase-merge/message &&
75 git stripspace -s <.git/rebase-merge/message >two.t &&
77 git rebase --continue &&
78 compare_msg $msgfile $old $new &&
79 : git-commit assume invalid utf-8 is latin1 &&
84 test_rebase_continue_update_encode ISO-8859-1 UTF-8 ISO8859-1.txt
85 test_rebase_continue_update_encode eucJP UTF-8 eucJP.txt
86 test_rebase_continue_update_encode eucJP ISO-2022-JP eucJP.txt