]>
Commit | Line | Data |
---|---|---|
5772b0c7 ĐTCD |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2019 Doan Tran Cong Danh | |
4 | # | |
5 | ||
6 | test_description='rebase with changing encoding | |
7 | ||
8 | Initial setup: | |
9 | ||
10 | 1 - 2 master | |
11 | \ | |
12 | 3 - 4 first | |
13 | \ | |
14 | 5 - 6 second | |
15 | ' | |
16 | ||
17 | . ./test-lib.sh | |
18 | ||
19 | compare_msg () { | |
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 | |
24 | } | |
25 | ||
26 | test_expect_success setup ' | |
27 | test_commit one && | |
28 | git branch first && | |
29 | test_commit two && | |
30 | git switch first && | |
31 | test_commit three && | |
32 | git branch second && | |
33 | test_commit four && | |
34 | git switch second && | |
35 | test_commit five && | |
36 | test_commit six | |
37 | ' | |
38 | ||
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 | |
46 | ' | |
47 | ||
12029dc5 | 48 | test_expect_success 'rebase --rebase-merges update encoding eucJP to ISO-2022-JP' ' |
5772b0c7 ĐTCD |
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 | |
55 | ' | |
56 | ||
52f52e5a ĐTCD |
57 | test_rebase_continue_update_encode () { |
58 | old=$1 | |
59 | new=$2 | |
60 | msgfile=$3 | |
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 && | |
65 | git add 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 && | |
72 | git add two.t && | |
73 | git rebase --continue && | |
74 | compare_msg $msgfile $old $new && | |
75 | : git-commit assume invalid utf-8 is latin1 && | |
76 | test_cmp expect two.t | |
77 | ' | |
78 | } | |
79 | ||
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 | |
83 | ||
5772b0c7 | 84 | test_done |