Subject: [PATCH v4 0/8] Correct internal working and output encoding

From: Doan Tran Cong Danh <[email-masked]>
Date: Thu, 7 Nov 2019 09:56:11 +0700

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 v3:
- Fix grammar and spelling in commit message.
- Add mising semicolon (I ran the test with dirty workspace right before
  making last change). Everything is OK this time, though.

Cc: Eric Sunshine <[email-masked]>

Apparantly, I couldn't spell unusable.

Doan Tran Cong Danh (8):
  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

 configure.ac                     | 49 ++++++++++++++++++++++++++++++++
 sequencer.c                      | 21 +++++++++-----
 t/t0028-working-tree-encoding.sh |  4 +--
 t/t3900-i18n-commit.sh           | 41 ++++++++++++++++++++++++++
 4 files changed, 106 insertions(+), 9 deletions(-)

Range-diff against v3:
1:  b3d6c4e720 = 1:  b3d6c4e720 t0028: eliminate non-standard usage of printf
2:  f07566c60c = 2:  f07566c60c configure.ac: define ICONV_OMITS_BOM if necessary
3:  662e5bd545 ! 3:  ca869cef57 t3900: demonstrate git-rebase problem with multi encoding
    @@ t/t3900-i18n-commit.sh: test_commit_autosquash_flags eucJP fixup
     +		git config i18n.commitencoding '$new' &&
     +		echo '$new-$flag' >>F &&
     +		git commit -a --'$flag' HEAD^ &&
    -+		git config --unset-all i18n.commitencoding &&
     +		git rebase --autosquash -i HEAD^^^ &&
     +		git rev-list HEAD >actual &&
     +		test_line_count = 3 actual
4:  6a51fdd29c = 4:  15c33fc245 sequencer: reencode to utf-8 before arrange rebase's todo list
5:  d382e35e4e = 5:  304ac6c289 sequencer: reencode revert/cherry-pick's todo list
6:  340902eb67 ! 6:  97ab88e5d8 sequencer: reencode squashing commit's message
    @@ t/t3900-i18n-commit.sh: test_commit_autosquash_multi_encoding () {
      		git checkout -b '$flag-$old-$new' C0 &&
      		git config i18n.commitencoding '$old' &&
     @@ t/t3900-i18n-commit.sh: test_commit_autosquash_multi_encoding () {
    - 		git config --unset-all i18n.commitencoding &&
    + 		git commit -a --'$flag' HEAD^ &&
      		git rebase --autosquash -i HEAD^^^ &&
      		git rev-list HEAD >actual &&
     -		test_line_count = 3 actual
7:  7f0df0f685 ! 7:  f295d32d7b sequencer: reencode old merge-commit message
    @@ Commit message
         will be used as message for new merge commit (created by rebase).
     
         In case of the value of i18n.commitencoding has been changed after the
    -    old merge time. We will receive an usable message for this new merge.
    +    old merge time. We will receive an unusable message for this new merge.
     
         Correct it.
     
8:  69ec40bb1d ! 8:  36796e2b67 sequencer: reencode commit message for am/rebase --show-current-patch
    @@ sequencer.c: static int make_patch(struct repository *r,
      	strbuf_addf(&buf, "%s/message", get_dir(opts));
      	if (!file_exists(buf.buf)) {
     -		const char *commit_buffer = get_commit_buffer(commit, NULL);
    -+		const char *encoding = get_commit_output_encoding()
    ++		const char *encoding = get_commit_output_encoding();
     +		const char *commit_buffer = logmsg_reencode(commit, NULL, encoding);
      		find_commit_subject(commit_buffer, &subject);
      		res |= write_message(subject, strlen(subject), buf.buf, 1);
-- 
2.24.0.8.g36796e2b67