@matheusbsbs / matheus-bagliano / commits / e4b95b3b5f
Fork 0

t3900: demonstrate git-rebase problem with multi encoding

We're using fixup!/squash! <subject> to mark if current commit will be used to be fixed up or squashed to a previous commit. However, if we're changing i18n.commitencoding after making the original commit but before making the fixing up, we couldn't find the original commit to do the fixup/squash. Add a test to demonstrate that problem. Helped-by: Jeff King <peff@peff.net> Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Doan Tran Cong Danh committed Nov 8, 2019 at 16:43 UTC e4b95b3b5fb36bfa3db4408dd469a123c6efc51f
1 file changed +29
t/t3900-i18n-commit.sh
+29
@@ -204,4 +204,33 @@ test_commit_autosquash_flags eucJP fixup
204
205 test_commit_autosquash_flags ISO-2022-JP squash
206
207 +test_commit_autosquash_multi_encoding () {
208 + flag=$1
209 + old=$2
210 + new=$3
211 + msg=$4
212 + test_expect_failure "commit --$flag into $old from $new" '
213 + git checkout -b $flag-$old-$new C0 &&
214 + git config i18n.commitencoding $old &&
215 + echo $old >>F &&
216 + git commit -a -F "$TEST_DIRECTORY"/t3900/$msg &&
217 + test_tick &&
218 + echo intermediate stuff >>G &&
219 + git add G &&
220 + git commit -a -m "intermediate commit" &&
221 + test_tick &&
222 + git config i18n.commitencoding $new &&
223 + echo $new-$flag >>F &&
224 + git commit -a --$flag HEAD^ &&
225 + git rebase --autosquash -i HEAD^^^ &&
226 + git rev-list HEAD >actual &&
227 + test_line_count = 3 actual
228 + '
229 +}
230 +
231 +test_commit_autosquash_multi_encoding fixup UTF-8 ISO-8859-1 1-UTF-8.txt
232 +test_commit_autosquash_multi_encoding squash ISO-8859-1 UTF-8 ISO8859-1.txt
233 +test_commit_autosquash_multi_encoding squash eucJP ISO-2022-JP eucJP.txt
234 +test_commit_autosquash_multi_encoding fixup ISO-2022-JP UTF-8 ISO-2022-JP.txt
235 +
236 test_done