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
23 iconv -f "$2" -t "$3" "$TEST_DIRECTORY/t3434/$1" >expect
&&
24 git cat-file commit HEAD
>raw
&&
25 sed "1,/^$/d" raw
>actual
&&
26 test_cmp expect actual
29 test_expect_success setup
'
42 test_expect_success
'rebase --rebase-merges update encoding eucJP to UTF-8' '
43 git switch -c merge-eucJP-UTF-8 first &&
44 git config i18n.commitencoding eucJP &&
45 git merge -F "$TEST_DIRECTORY/t3434/eucJP.txt" second &&
46 git config i18n.commitencoding UTF-8 &&
47 git rebase --rebase-merges main &&
48 compare_msg eucJP.txt eucJP UTF-8
51 test_expect_success
'rebase --rebase-merges update encoding eucJP to ISO-2022-JP' '
52 git switch -c merge-eucJP-ISO-2022-JP first &&
53 git config i18n.commitencoding eucJP &&
54 git merge -F "$TEST_DIRECTORY/t3434/eucJP.txt" second &&
55 git config i18n.commitencoding ISO-2022-JP &&
56 git rebase --rebase-merges main &&
57 compare_msg eucJP.txt eucJP ISO-2022-JP
60 test_rebase_continue_update_encode
() {
64 test_expect_success
"rebase --continue update from $old to $new" '
65 (git rebase --abort || : abort current git-rebase failure) &&
66 git switch -c conflict-$old-$new one &&
67 echo for-conflict >two.t &&
69 git config i18n.commitencoding $old &&
70 git commit -F "$TEST_DIRECTORY/t3434/$msgfile" &&
71 git config i18n.commitencoding $new &&
72 test_must_fail git rebase -m main &&
73 test -f .git/rebase-merge/message &&
74 git stripspace -s <.git/rebase-merge/message >two.t &&
76 git rebase --continue &&
77 compare_msg $msgfile $old $new &&
78 : git-commit assume invalid utf-8 is latin1 &&
83 test_rebase_continue_update_encode ISO-8859-1 UTF-8 ISO8859-1.txt
84 test_rebase_continue_update_encode eucJP UTF-8 eucJP.txt
85 test_rebase_continue_update_encode eucJP ISO-2022-JP eucJP.txt