The series is shifting from fixing test that failed on musl based Linux to correct the internal working encoding and output encoding of git-am git-cherry-pick git-rebase and git-revert. Change from v4: - Update commit message per review - Add test for last 2 patches - Notice a breakage with git rebase --rebase-merges (see patch 7) Doan Tran Cong Danh (9): t0028: eliminate non-standard usage of printf configure.ac: define ICONV_OMITS_BOM if necessary t3900: demonstrate git-rebase problem with multi encoding sequencer: reencode to utf-8 before arrange rebase's todo list sequencer: reencode revert/cherry-pick's todo list sequencer: reencode squashing commit's message sequencer: reencode old merge-commit message sequencer: reencode commit message for am/rebase --show-current-patch sequencer: fallback to sane label in making rebase todo list configure.ac | 49 ++++++++++++++++++ sequencer.c | 32 ++++++++---- t/t0028-working-tree-encoding.sh | 4 +- t/t3433-rebase-i18n.sh | 84 +++++++++++++++++++++++++++++++ t/t3433/ISO8859-1.txt | Bin 0 -> 15 bytes t/t3433/eucJP.txt | Bin 0 -> 68 bytes t/t3900-i18n-commit.sh | 37 ++++++++++++++ 7 files changed, 195 insertions(+), 11 deletions(-) create mode 100755 t/t3433-rebase-i18n.sh create mode 100644 t/t3433/ISO8859-1.txt create mode 100644 t/t3433/eucJP.txt Range-diff against v4: 1: daa0c27d28 = 1: b3d6c4e720 t0028: eliminate non-standard usage of printf 2: c50964f413 ! 2: fe63a6bc44 configure.ac: define ICONV_OMITS_BOM if necessary @@ Commit message make ICONV_OMITS_BOM=Yes - However, typing the flag all the time is cumbersome and error-prone. + However, configure script wasn't taught to detect those systems. - Add a check into configure script to detect this flag automatically. + Teach configure to do so. Signed-off-by: Doan Tran Cong Danh <congdanhqx@xxxxxxxxx> 3: 47888f236c ! 3: 30f15075c4 t3900: demonstrate git-rebase problem with multi encoding @@ t/t3900-i18n-commit.sh: test_commit_autosquash_flags eucJP fixup + new=$3 + msg=$4 + test_expect_failure "commit --$flag into $old from $new" ' -+ git checkout -b '$flag-$old-$new' C0 && -+ git config i18n.commitencoding '$old' && -+ echo '$old' >>F && -+ git commit -a -F "$TEST_DIRECTORY/t3900/'$msg'" && ++ git checkout -b $flag-$old-$new C0 && ++ git config i18n.commitencoding $old && ++ echo $old >>F && ++ git commit -a -F "$TEST_DIRECTORY"/t3900/$msg && + test_tick && + echo intermediate stuff >>G && + git add G && + git commit -a -m "intermediate commit" && + test_tick && -+ git config i18n.commitencoding '$new' && -+ echo '$new-$flag' >>F && -+ git commit -a --'$flag' HEAD^ && ++ git config i18n.commitencoding $new && ++ echo $new-$flag >>F && ++ git commit -a --$flag HEAD^ && + git rebase --autosquash -i HEAD^^^ && + git rev-list HEAD >actual && + test_line_count = 3 actual 4: 42115f1e33 ! 4: 17165b81e5 sequencer: reencode to utf-8 before arrange rebase's todo list @@ Commit message Thus, t3900::test_commit_autosquash_flags is failing on musl libc. Reencode to utf-8 before arranging rebase's todo list. - By doing this, we also remove a breakage introduced in the previous - commit. + + By doing this, we also remove a breakage noticed by a test added in the + previous commit. Signed-off-by: Doan Tran Cong Danh <congdanhqx@xxxxxxxxx> @@ t/t3900-i18n-commit.sh: test_commit_autosquash_multi_encoding () { msg=$4 - test_expect_failure "commit --$flag into $old from $new" ' + test_expect_success "commit --$flag into $old from $new" ' - git checkout -b '$flag-$old-$new' C0 && - git config i18n.commitencoding '$old' && - echo '$old' >>F && + git checkout -b $flag-$old-$new C0 && + git config i18n.commitencoding $old && + echo $old >>F && 5: 5a871d7226 = 5: 40fa759492 sequencer: reencode revert/cherry-pick's todo list 6: 1c6194a598 ! 6: ed6cfab5d2 sequencer: reencode squashing commit's message @@ sequencer.c: static int commit_staged_changes(struct repository *r, ## t/t3900-i18n-commit.sh ## @@ t/t3900-i18n-commit.sh: test_commit_autosquash_multi_encoding () { - old=$2 - new=$3 - msg=$4 -+ squash_msg= -+ if test $flag = squash; then -+ squash_msg=' -+ subject="squash! $(head -1 expect)" && -+ printf "\n%s\n" "$subject" >> expect && -+ ' -+ fi - test_expect_success "commit --$flag into $old from $new" ' - git checkout -b '$flag-$old-$new' C0 && - git config i18n.commitencoding '$old' && -@@ t/t3900-i18n-commit.sh: test_commit_autosquash_multi_encoding () { - git commit -a --'$flag' HEAD^ && + git commit -a --$flag HEAD^ && git rebase --autosquash -i HEAD^^^ && git rev-list HEAD >actual && - test_line_count = 3 actual + test_line_count = 3 actual && -+ iconv -f '$old' -t utf-8 "$TEST_DIRECTORY/t3900/'$msg'" >expect && -+ '"$squash_msg"' ++ iconv -f $old -t UTF-8 "$TEST_DIRECTORY"/t3900/$msg >expect && ++ if test $flag = squash; then ++ subject="$(head -1 expect)" && ++ printf "\nsquash! %s\n" "$subject" >>expect ++ fi && + git cat-file commit HEAD^ >raw && -+ (sed "1,/^$/d" raw | iconv -f '$new' -t utf-8) >actual && ++ (sed "1,/^$/d" raw | iconv -f $new -t utf-8) >actual && + test_cmp expect actual ' } 7: 95df3cdadf < -: ---------- sequencer: reencode old merge-commit message 8: 0606b2408d < -: ---------- sequencer: reencode commit message for am/rebase --show-current-patch -: ---------- > 7: def9adf97e sequencer: reencode old merge-commit message -: ---------- > 8: 2e95ca57d2 sequencer: reencode commit message for am/rebase --show-current-patch -: ---------- > 9: 860dee65f4 sequencer: fallback to sane label in making rebase todo list -- 2.24.0.8.g2e95ca57d2.dirty