From patchwork Fri Nov 8 09:43:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?xJBvw6BuIFRy4bqnbiBDw7RuZyBEYW5o?= X-Patchwork-Id: 11234439 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 200081575 for ; Fri, 8 Nov 2019 09:44:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F2BD2214DA for ; Fri, 8 Nov 2019 09:44:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qZW5slsw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730948AbfKHJoD (ORCPT ); Fri, 8 Nov 2019 04:44:03 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:44252 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730260AbfKHJoC (ORCPT ); Fri, 8 Nov 2019 04:44:02 -0500 Received: by mail-pl1-f193.google.com with SMTP id az9so2938186plb.11 for ; Fri, 08 Nov 2019 01:44:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=v3TdOumY/m4q9FNT+e55xkfcHPvyByZumqEpjtNQCZQ=; b=qZW5slswV3cF8WfygliauXLxufrBPdlgSTPIpmX29/cWxfQ6lk5PR5jdxggY6dbnfG kqRxAMKsiMGu2tBHnN1UJ4ZqTMwy/kaiH9MGBv8fOk6sxHc+EAtyOHWHhpasb8fbcv+9 ilRrhgiBIyVHed+hOC2UvwktOAShuY2tjyMG+WpEPp1xBlBkdfeC5lIFy1NoVCEeUYak CHqg8GlR0YzJYrHAvSjyBepBJq1HkZx6K3UhVLEb5sDuF3hwvpva95jbJSfWMdreCGy0 cgednxEdD3TphaaNpS9BRLIadrTwyWeDu6ZqQ2HDMg+p/gSsEE8NX7IYN1iu2mZrgUAn ov7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=v3TdOumY/m4q9FNT+e55xkfcHPvyByZumqEpjtNQCZQ=; b=AESYGbuDizTZY7a+8/UqWQYnfKZTg2iCsiyiIkNGot7mDDuk9Xb8FI42xKIm82HaGE 88NmXNOEmPRRCziKxIFjRyodhm/a+0sLVeWrHgzNMvHnRWPMTAKSgIibGvvy25YEc4zA R63kYenE4tN0TYieQp8KXcORBXkhdPnfCL+ow3K0OsMaWYQHpLd//0rcBstAcZnUrQf7 JAc3WwiQoM+sv2uDWvHwjagqpS+3lcR1mLQge8arerTECt4dibl+fog+4bTZk9SKS7lo Ux6Bu+/CbNPn4WgmWFHMvyyhgQyzAqdfrjbUGu22vmy8BR63nDF6lV/K8dLthxI2p88/ piuQ== X-Gm-Message-State: APjAAAUry4GWdUxAkx/rcylM7Ig2Dx09A5ghJpb7m7+4J0tEHtzLMSM5 wMWKQduHRTLBBtvwqbEFJAZQUx6U X-Google-Smtp-Source: APXvYqwzBeF9eDA8+E1ptTqiO9dm8GHdSSBF/NVTlV76UfVNEyBijrRUGvhftrHPklAXq2Gru03ijw== X-Received: by 2002:a17:90a:eb18:: with SMTP id j24mr12492370pjz.85.1573206241854; Fri, 08 Nov 2019 01:44:01 -0800 (PST) Received: from localhost.localdomain ([2402:800:6375:16b7:502d:9b82:436:143a]) by smtp.gmail.com with ESMTPSA id e198sm6995821pfh.83.2019.11.08.01.44.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Nov 2019 01:44:01 -0800 (PST) From: Doan Tran Cong Danh To: git@vger.kernel.org Cc: Doan Tran Cong Danh Subject: [PATCH v5 1/9] t0028: eliminate non-standard usage of printf Date: Fri, 8 Nov 2019 16:43:43 +0700 Message-Id: X-Mailer: git-send-email 2.24.0.8.g2e95ca57d2.dirty In-Reply-To: References: <20191031092618.29073-1-congdanhqx@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org man 1p printf: In addition to the escape sequences shown in the Base Definitions volume of POSIX.1‐2008, Chapter 5, File Format Notation ('\\', '\a', '\b', '\f', '\n', '\r', '\t', '\v'), "\ddd", where ddd is a one, two, or three-digit octal number, shall be written as a byte with the numeric value specified by the octal number. printf '\xfe\xff' is an extension of some shell. Dash, a popular yet simple shell, do not implement this extension. This wasn't caught by most people running the tests, even though common shells like dash don't handle hex escapes, because their systems don't trigger the NO_UTF16_BOM prereq. But systems with musl libc do; when combined with dash, the test fails. Correct it. Signed-off-by: Doan Tran Cong Danh --- t/t0028-working-tree-encoding.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t0028-working-tree-encoding.sh b/t/t0028-working-tree-encoding.sh index 7aa0945d8d..bfc4fb9af5 100755 --- a/t/t0028-working-tree-encoding.sh +++ b/t/t0028-working-tree-encoding.sh @@ -17,7 +17,7 @@ test_lazy_prereq NO_UTF32_BOM ' write_utf16 () { if test_have_prereq NO_UTF16_BOM then - printf '\xfe\xff' + printf '\376\377' fi && iconv -f UTF-8 -t UTF-16 } @@ -25,7 +25,7 @@ write_utf16 () { write_utf32 () { if test_have_prereq NO_UTF32_BOM then - printf '\x00\x00\xfe\xff' + printf '\0\0\376\377' fi && iconv -f UTF-8 -t UTF-32 } From patchwork Fri Nov 8 09:43:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?xJBvw6BuIFRy4bqnbiBDw7RuZyBEYW5o?= X-Patchwork-Id: 11234441 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 14CE914E5 for ; Fri, 8 Nov 2019 09:44:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E64D6214DA for ; Fri, 8 Nov 2019 09:44:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jlrnWy2h" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731147AbfKHJoF (ORCPT ); Fri, 8 Nov 2019 04:44:05 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:38522 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730260AbfKHJoE (ORCPT ); Fri, 8 Nov 2019 04:44:04 -0500 Received: by mail-pf1-f194.google.com with SMTP id c13so4216677pfp.5 for ; Fri, 08 Nov 2019 01:44:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aSqMjXUIfuiy0J4koP1iJB/SRR3I25ckk5HlB94mrCw=; b=jlrnWy2hjIIwzDHAcb7pSoK2lmAJY+oe/tgvrds0iVxURwW363sn7NOI43eV2KyqR5 VY7HkBSHzzWIi2Q7RqUL28iKnUSL5N7fg3f9SHddxzbz2SXqZ1tQiPbrzCSHBXp0AkQm tEQvhFiCAV5jDQ03sD0Yh2coDkjpngA3vAM+28IKHoOuP+tcXfcV9ZTzUoGMCt+6CIhk s8D0iZNO+QdVm9cmppnfvnVj4fDRyArdz/JSEY67sIXmqiO36kommCEHP/2sq7AloqlO GPetuTPybQNCmvhIHAuv0As+bI/AF7bhbOB02xVqngaypSBQyvQoW4GJqJx4H38pg8AY KsbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aSqMjXUIfuiy0J4koP1iJB/SRR3I25ckk5HlB94mrCw=; b=JVwznzPC8pRMRLlJfXqupcSIuam5hqHKAeR5mQqJU1/Xoi8Upd6dB65zJCWn8ItcVV kvWbCw0YWetmn/PJOQib6lfx821SMxL2Z9UDn6TVEAZpmTJKokmbf9FDSdYhHuQeJnIL eLC25rxGGINIQPxRxnXhgumZz0g4vj8Ip9oEOuxE9EpL4Qdi6+bch2VsLp2pftLHWzqO c6erbq3iauPu5fncckGWweg9FrdQgg/Sp/Y/5DDS3ER9K92uS+vVV/ylvO78ocI+QdOU Wf3e9+uG/t+HeKpeN7uZMbW4vpn0UeJPWE+Yx49d22D7vTtkrL6JNnq9TiAQ36dnsxr9 87Jw== X-Gm-Message-State: APjAAAXqbC/ef4fGWUafNFleBcm1d4weHMLBAPfI7CGOJ9S5GuW8jY3g YGPA/HPloHZGhpqFA1dfe9RNjUhO X-Google-Smtp-Source: APXvYqyIJ9frvZuJZ+jgfFns1p+L1g8ALxemxCH5/8LDg+YHhndOz8nbRk/557O6XBnzP52ifh2GMQ== X-Received: by 2002:a63:ec4b:: with SMTP id r11mr10593525pgj.147.1573206243347; Fri, 08 Nov 2019 01:44:03 -0800 (PST) Received: from localhost.localdomain ([2402:800:6375:16b7:502d:9b82:436:143a]) by smtp.gmail.com with ESMTPSA id e198sm6995821pfh.83.2019.11.08.01.44.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Nov 2019 01:44:02 -0800 (PST) From: Doan Tran Cong Danh To: git@vger.kernel.org Cc: Doan Tran Cong Danh Subject: [PATCH v5 2/9] configure.ac: define ICONV_OMITS_BOM if necessary Date: Fri, 8 Nov 2019 16:43:44 +0700 Message-Id: X-Mailer: git-send-email 2.24.0.8.g2e95ca57d2.dirty In-Reply-To: References: <20191031092618.29073-1-congdanhqx@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From commit 79444c9294, ("utf8: handle systems that don't write BOM for UTF-16", 2019-02-12), we're supporting those systems with iconv that omits BOM with: make ICONV_OMITS_BOM=Yes However, configure script wasn't taught to detect those systems. Teach configure to do so. Signed-off-by: Doan Tran Cong Danh --- configure.ac | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/configure.ac b/configure.ac index a43b476402..ecba7e6e51 100644 --- a/configure.ac +++ b/configure.ac @@ -844,12 +844,61 @@ AC_MSG_CHECKING([for old iconv()]) AC_COMPILE_IFELSE([OLDICONVTEST_SRC], [AC_MSG_RESULT([no])], [AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_OLD_ICONV, 1) OLD_ICONV=UnfortunatelyYes]) GIT_UNSTASH_FLAGS($ICONVDIR) GIT_CONF_SUBST([OLD_ICONV]) +# +# Define ICONV_OMITS_BOM if you are on a system which +# iconv omits bom for utf-{16,32} +if test -z "$NO_ICONV"; then +AC_CACHE_CHECK([whether iconv omits bom for utf-16 and utf-32], + [ac_cv_iconv_omits_bom], +[ +old_LIBS="$LIBS" +if test -n "$NEEDS_LIBICONV"; then + LIBS="$LIBS -liconv" +fi + +AC_RUN_IFELSE( + [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT + #include + #ifdef HAVE_OLD_ICONV + typedef const char *iconv_ibp; + #else + typedef char *iconv_ibp; + #endif + ], + [[ + int v; + iconv_t conv; + char in[] = "a"; iconv_ibp pin = in; + char out[20] = ""; char *pout = out; + size_t isz = sizeof in; + size_t osz = sizeof out; + + conv = iconv_open("UTF-16", "UTF-8"); + iconv(conv, &pin, &isz, &pout, &osz); + iconv_close(conv); + v = (unsigned char)(out[0]) + (unsigned char)(out[1]); + return v != 0xfe + 0xff; + ]])], + [ac_cv_iconv_omits_bom=no], + [ac_cv_iconv_omits_bom=yes]) + +LIBS="$old_LIBS" +]) +if test "x$ac_cv_iconv_omits_bom" = xyes; then + ICONV_OMITS_BOM=Yes +else + ICONV_OMITS_BOM= +fi +GIT_CONF_SUBST([ICONV_OMITS_BOM]) +fi + ## Checks for typedefs, structures, and compiler characteristics. AC_MSG_NOTICE([CHECKS for typedefs, structures, and compiler characteristics]) # From patchwork Fri Nov 8 09:43:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?xJBvw6BuIFRy4bqnbiBDw7RuZyBEYW5o?= X-Patchwork-Id: 11234447 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2D4DE1515 for ; Fri, 8 Nov 2019 09:44:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0C296218AE for ; Fri, 8 Nov 2019 09:44:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fcrAJLsF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731290AbfKHJoI (ORCPT ); Fri, 8 Nov 2019 04:44:08 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:36690 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730260AbfKHJoH (ORCPT ); Fri, 8 Nov 2019 04:44:07 -0500 Received: by mail-pl1-f193.google.com with SMTP id d7so1894234pls.3 for ; Fri, 08 Nov 2019 01:44:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cCOP+T5rQSDaMPRYqZOZ5Yhzl5wgPrsbjWG4h7kjtws=; b=fcrAJLsFJZQEA555Coytn2Gpr9nBeTm713me13A37is+fMAOt231WIsfHTF6v0kti9 2lAU044/vKrFpdGN9BJMUhMObI9qywNrXKAjRom9VLx2XGvtC5ppOq7g+JEBIuhh2pm7 065CgTNlAsuraGsdrW+RIcYZWsZBAck2RbTMU3HoPw4NQdWwlwuuTgbnL18xznlLkS9x 32iDH0F1kqUA7CbVL9/O+r8mLm3lxLq7/IRX2L5FR6VGxSu1u8KJJU2j+8ZAOyd4R/cH +EDMjgb1Fb15yzt5F+MZkAE6YZKZ6KnQJHk801+weS8e+rOmTzNacV4tCmnHnl0g76/e NbJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cCOP+T5rQSDaMPRYqZOZ5Yhzl5wgPrsbjWG4h7kjtws=; b=pzmCiAYHp8De2Jqqg6s2eQcqk3tlytzm1+UiMtY6+jFish0K/NjMTaeDNCP+vSPazf HdnR4ryF01+YvsD4t03SavOM9i8yf9CDRG9SEB7lKocfSNHl0fOzUCc6Sswk4l50kdWv pqBdLCrdO3oFIjW5B9cOCNkGoaaz0DlHdbYEZrASA6xbXMEfDus7BtFJB/wJYH75n657 XpAZ0UjV6E+DFA7HumlQcb7FAXHErKb0NBFPIUnPazbZYevIIy86jcW5PhAPfS92gA1o 81T+c4uIoq9/tUNUkhc6osJ3U8bCg476Y0Aq10Wo2f8u2zfXRyXQn5xSZYwIJ/tgs6jl Md/g== X-Gm-Message-State: APjAAAWqMChEGC6Wa6LiULQGbD+PK/bRf10a8MEmVEkiL7qL57O93Yps xF8i3edpnfxa1G42mWKUtqAUKrRU X-Google-Smtp-Source: APXvYqwd0vuBGP0QArFVJ+Y+HVCH7XReJRzFHF4bd3P+a/GbdFx/IyawemiM+pe0o90NAwMZ6RfyyA== X-Received: by 2002:a17:90a:c306:: with SMTP id g6mr12021043pjt.38.1573206245303; Fri, 08 Nov 2019 01:44:05 -0800 (PST) Received: from localhost.localdomain ([2402:800:6375:16b7:502d:9b82:436:143a]) by smtp.gmail.com with ESMTPSA id e198sm6995821pfh.83.2019.11.08.01.44.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Nov 2019 01:44:04 -0800 (PST) From: Doan Tran Cong Danh To: git@vger.kernel.org Cc: Doan Tran Cong Danh , Jeff King Subject: [PATCH v5 3/9] t3900: demonstrate git-rebase problem with multi encoding Date: Fri, 8 Nov 2019 16:43:45 +0700 Message-Id: <30f15075c405b9049790518b64f66cb1740184f1.1573205699.git.congdanhqx@gmail.com> X-Mailer: git-send-email 2.24.0.8.g2e95ca57d2.dirty In-Reply-To: References: <20191031092618.29073-1-congdanhqx@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org We're using fixup!/squash! 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 Signed-off-by: Doan Tran Cong Danh --- t/t3900-i18n-commit.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/t/t3900-i18n-commit.sh b/t/t3900-i18n-commit.sh index b92ff95977..dd56384b93 100755 --- a/t/t3900-i18n-commit.sh +++ b/t/t3900-i18n-commit.sh @@ -204,4 +204,33 @@ test_commit_autosquash_flags eucJP fixup test_commit_autosquash_flags ISO-2022-JP squash +test_commit_autosquash_multi_encoding () { + flag=$1 + old=$2 + 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 && + 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 rebase --autosquash -i HEAD^^^ && + git rev-list HEAD >actual && + test_line_count = 3 actual + ' +} + +test_commit_autosquash_multi_encoding fixup UTF-8 ISO-8859-1 1-UTF-8.txt +test_commit_autosquash_multi_encoding squash ISO-8859-1 UTF-8 ISO8859-1.txt +test_commit_autosquash_multi_encoding squash eucJP ISO-2022-JP eucJP.txt +test_commit_autosquash_multi_encoding fixup ISO-2022-JP UTF-8 ISO-2022-JP.txt + test_done From patchwork Fri Nov 8 09:43:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?xJBvw6BuIFRy4bqnbiBDw7RuZyBEYW5o?= X-Patchwork-Id: 11234445 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 531A81515 for ; Fri, 8 Nov 2019 09:44:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 317A0218AE for ; Fri, 8 Nov 2019 09:44:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gf7VRjLj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731358AbfKHJoI (ORCPT ); Fri, 8 Nov 2019 04:44:08 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:38571 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730884AbfKHJoH (ORCPT ); Fri, 8 Nov 2019 04:44:07 -0500 Received: by mail-pg1-f194.google.com with SMTP id 15so3628099pgh.5 for ; Fri, 08 Nov 2019 01:44:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=I6d1DUXlkPxPMpW7ps8CA8nF/TrGO3MWgHW+oDNIXGU=; b=gf7VRjLjkcpxi8LCLfdA3ZpkREEOFvzeucUREsx58oJhSIB1KgO8w/uWEk3jx+IgPC 3WmqDSE0Ff8stRJmzcppXvUQdETXNo4+6GAVgWyooNEJu8wgxGhlGrRsVjeppaKzv5jU tuJpzciNI2T55KZAUakS68yTkd2h4NIYvALvJS3LNna2FS8Dw4ONmrKNKAqEjflegyaH JsRa0u0G34O9OghOCwwrDtxiSk/0Ad82RbSWBhF9QS/kEtv6lstW5Zp8afBVNaJm/Z7z NayIXBQGZG+XkqqFqgnvb18LpP+Zndy3MCVOaoCjxRaRulnHSzEXvtmgiwFR0dYufrsg Tpkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=I6d1DUXlkPxPMpW7ps8CA8nF/TrGO3MWgHW+oDNIXGU=; b=C6vULi2wkeuHegtgTvGQA8qzC1suT+HYtkluzB1mTLQvpeI9A9X7EjdxI5iSdekh6A 4qdaZI2S0lmbH6LSebs18vdanEu0gN8aggsoishqJC/QsHYEh8QCaotBUULLwGdQsOtg PPVXYQM3GNgsN0qAeu2xIu8Dgi/wOSSJBs194rvMDQWfoiTWyurKHLK5RCY4UhXVXGs5 v3A92L4LyN3Oy0Xd2SjoPGR4GqLhBK+6ydW1oem9T2cp+pxqYdrKMUzff4UIVjLvRZnl C2VVAQcgLrPrlcvIKj1deXkRueKJPeqQxQFyCuheVjmjz99JrvvbUTiLAiBSaSRpzcZV EhqA== X-Gm-Message-State: APjAAAU7t9bTEAiisF3Wd/x2OpzvMhoFKFZO9ZynbwpbaSNyZ9Nb/1tt k1+dq7Ktok71kj+BdzxGgaV4w1dV X-Google-Smtp-Source: APXvYqzt5fyNo8LEkW9rDiEtJhLu1SpKNMwloMTxCA2uLJG1tKc27jqBZ1DydUgr8ZShrnb+b+jndA== X-Received: by 2002:a17:90a:c2:: with SMTP id v2mr12078202pjd.19.1573206246940; Fri, 08 Nov 2019 01:44:06 -0800 (PST) Received: from localhost.localdomain ([2402:800:6375:16b7:502d:9b82:436:143a]) by smtp.gmail.com with ESMTPSA id e198sm6995821pfh.83.2019.11.08.01.44.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Nov 2019 01:44:06 -0800 (PST) From: Doan Tran Cong Danh To: git@vger.kernel.org Cc: Doan Tran Cong Danh Subject: [PATCH v5 4/9] sequencer: reencode to utf-8 before arrange rebase's todo list Date: Fri, 8 Nov 2019 16:43:46 +0700 Message-Id: <17165b81e53e45b0abe9d5a03d7f214a28043cc8.1573205699.git.congdanhqx@gmail.com> X-Mailer: git-send-email 2.24.0.8.g2e95ca57d2.dirty In-Reply-To: References: <20191031092618.29073-1-congdanhqx@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On musl libc, ISO-2022-JP encoder is too eager to switch back to 1 byte encoding, musl's iconv always switch back after every combining character. Comparing glibc and musl's output for this command $ sed q t/t3900/ISO-2022-JP.txt| iconv -f ISO-2022-JP -t utf-8 | iconv -f utf-8 -t ISO-2022-JP | xxd glibc: 00000000: 1b24 4224 4f24 6c24 5224 5b24 551b 2842 .$B$O$l$R$[$U.(B 00000010: 0a . musl: 00000000: 1b24 4224 4f1b 2842 1b24 4224 6c1b 2842 .$B$O.(B.$B$l.(B 00000010: 1b24 4224 521b 2842 1b24 4224 5b1b 2842 .$B$R.(B.$B$[.(B 00000020: 1b24 4224 551b 2842 0a .$B$U.(B. Although musl iconv's output isn't optimal, it's still correct. From commit 7d509878b8, ("pretty.c: format string with truncate respects logOutputEncoding", 2014-05-21), we're encoding the message to utf-8 first, then format it and convert the message to the actual output encoding on git commit --squash. 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 noticed by a test added in the previous commit. Signed-off-by: Doan Tran Cong Danh --- sequencer.c | 2 +- t/t3900-i18n-commit.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sequencer.c b/sequencer.c index 9d5964fd81..69430fe23f 100644 --- a/sequencer.c +++ b/sequencer.c @@ -5169,7 +5169,7 @@ int todo_list_rearrange_squash(struct todo_list *todo_list) *commit_todo_item_at(&commit_todo, item->commit) = item; parse_commit(item->commit); - commit_buffer = get_commit_buffer(item->commit, NULL); + commit_buffer = logmsg_reencode(item->commit, NULL, "UTF-8"); find_commit_subject(commit_buffer, &subject); format_subject(&buf, subject, " "); subject = subjects[i] = strbuf_detach(&buf, &subject_len); diff --git a/t/t3900-i18n-commit.sh b/t/t3900-i18n-commit.sh index dd56384b93..a518281b04 100755 --- a/t/t3900-i18n-commit.sh +++ b/t/t3900-i18n-commit.sh @@ -209,7 +209,7 @@ test_commit_autosquash_multi_encoding () { old=$2 new=$3 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 && From patchwork Fri Nov 8 09:43:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?xJBvw6BuIFRy4bqnbiBDw7RuZyBEYW5o?= X-Patchwork-Id: 11234449 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E30BA14E5 for ; Fri, 8 Nov 2019 09:44:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C1D3B218AE for ; Fri, 8 Nov 2019 09:44:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jXKyJCZr" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731430AbfKHJoJ (ORCPT ); Fri, 8 Nov 2019 04:44:09 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:37588 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730308AbfKHJoJ (ORCPT ); Fri, 8 Nov 2019 04:44:09 -0500 Received: by mail-pg1-f194.google.com with SMTP id z24so3629573pgu.4 for ; Fri, 08 Nov 2019 01:44:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8F0cPDRY1pwzQHZq+1t2iHqI8+yhrhOMfl9ZH3X7uNE=; b=jXKyJCZrnopM1BLtfqRfTo4uOfShpSzGUtfbM8k5EXgLjl3fGskMTg4idh7AxokYrX F1vMl97yFt4weKFrQmB8hl1hOr1Tu5xToWKa4ytkWF4cD3ZL/4iY7tueg0qazxGrUHUb 24cpNKqMB5+nCriJiz50auzMafUMoxKJaiwAuALUSSYsMORDAfAM7Syf146VamJ1zAmE VAY9pdu69sVnrOtslolxDxwMIWwjAKtioZStbfDad11guSAQFlOTFWt9YspZeIHbI9VN A7kYZsDzBFRDVgw3wzb5m8Lf5jncLC/JZPh6GXFqhtPe9+p0SXeviZdVY/+RnWUSxXji tXEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8F0cPDRY1pwzQHZq+1t2iHqI8+yhrhOMfl9ZH3X7uNE=; b=kJ/w85jfMDuoDZ56vQvXqZz9w5WukH7mIPEviL+uTF6xMJ/5YyU7tXj0DaMj0vCNno C2pqZIXmc9w9Uk7qobBjocua0QI6AokZ8d1MmhS80+vZj++FXWNGY9ZdHn7+Wzkvxpdd Skw/BQuJxo2ReGSX3qxKU+YBIMy6N33x47at1+KQV1XJsZbdyR2CphG5U0+p5VNr5ZZT j+v5IO63Br+5nEFOCg8Z7YzButsPMSTmgpqSUmoUrGYrPZIvC7o+9n9ssv1XoDOmFNQA itj+d0WqyNWj8Eaaui+iT0fbSE7hbC/AEt+EyrB2Nft9Fi7ZTc0jG3YOS7mlV7RTxAiP vL7A== X-Gm-Message-State: APjAAAW1RS9qcTXFYe16ogOKtskVyWBkWhCcODL/i3jWiWHXtGCpxTan AyUneHVDBNaGwB7vAyGAhE1loDrr X-Google-Smtp-Source: APXvYqzoveMJR/mPZkrpL6f0MSbBQXTmPYSMmMVFlvUy+yaREO7RcCuzGmabNPbX2mHf81+hatU0tQ== X-Received: by 2002:a65:66c7:: with SMTP id c7mr10516923pgw.407.1573206248560; Fri, 08 Nov 2019 01:44:08 -0800 (PST) Received: from localhost.localdomain ([2402:800:6375:16b7:502d:9b82:436:143a]) by smtp.gmail.com with ESMTPSA id e198sm6995821pfh.83.2019.11.08.01.44.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Nov 2019 01:44:07 -0800 (PST) From: Doan Tran Cong Danh To: git@vger.kernel.org Cc: Doan Tran Cong Danh Subject: [PATCH v5 5/9] sequencer: reencode revert/cherry-pick's todo list Date: Fri, 8 Nov 2019 16:43:47 +0700 Message-Id: <40fa7594923d877c780f28ebc73f28cf16ab8568.1573205699.git.congdanhqx@gmail.com> X-Mailer: git-send-email 2.24.0.8.g2e95ca57d2.dirty In-Reply-To: References: <20191031092618.29073-1-congdanhqx@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Keep revert/cherry-pick's todo list in line with rebase todo list. Signed-off-by: Doan Tran Cong Danh --- sequencer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sequencer.c b/sequencer.c index 69430fe23f..a19954f2bf 100644 --- a/sequencer.c +++ b/sequencer.c @@ -2564,14 +2564,17 @@ static int walk_revs_populate_todo(struct todo_list *todo_list, enum todo_command command = opts->action == REPLAY_PICK ? TODO_PICK : TODO_REVERT; const char *command_string = todo_command_info[command].str; + const char *encoding; struct commit *commit; if (prepare_revs(opts)) return -1; + encoding = get_log_output_encoding(); + while ((commit = get_revision(opts->revs))) { struct todo_item *item = append_new_todo(todo_list); - const char *commit_buffer = get_commit_buffer(commit, NULL); + const char *commit_buffer = logmsg_reencode(commit, NULL, encoding); const char *subject; int subject_len; From patchwork Fri Nov 8 09:43:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?xJBvw6BuIFRy4bqnbiBDw7RuZyBEYW5o?= X-Patchwork-Id: 11234451 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 499E114E5 for ; Fri, 8 Nov 2019 09:44:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 24489214DA for ; Fri, 8 Nov 2019 09:44:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lHg3dWpu" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731669AbfKHJoL (ORCPT ); Fri, 8 Nov 2019 04:44:11 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:37591 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730308AbfKHJoL (ORCPT ); Fri, 8 Nov 2019 04:44:11 -0500 Received: by mail-pg1-f196.google.com with SMTP id z24so3629594pgu.4 for ; Fri, 08 Nov 2019 01:44:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=w/EPyeP704tKZka9pJBgLXi0JJ9dfgrr7Zt7ihMK4AA=; b=lHg3dWpu2PX3p6il6fViP3fmcz7Hhzf+INuN5kkOgBn1WcSy7Ilr3t4xGrvaH2zAML /y6Yhq9JR6HLAl6rJ19bMDqjauEI4cemcfsgUGfiDu6JigLytGMvuBBffV36GFLD/DyS xhn9MsU37AmWV/2IDAUmFg/yz4GIrmXCtOzp+T626HZjMmurHwhRzOzLeYiedNWl/XvE phruch1vJkjAej4cGUbl5YJPn1d051nP2aRYhNSyACx8ID+fhrAa0D5i0/C+U5ziaZiV ftDE8AnGKLyKEYY61VhaEyWIygbnyoNk7ZWYARWTPAY7DBvpJuXCXI3N2umKz/25D8on UpSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=w/EPyeP704tKZka9pJBgLXi0JJ9dfgrr7Zt7ihMK4AA=; b=lpmDaSM2yS/bK/X5eo+MeIyl9o7VgxP4ppad0ZjzL9n7V0XTz1nB6XNNPURgXp1DZD b48RE6BHxAmAMHJy3XU2VRc2kkRgiIbOeZukolgHm5xv9cKsXW9/xmP4afwxKvFsytJ5 rg/OF+kSFtjlSdla1+dS/iq1V7dXbhwfKHpnNLXjkdgfleq/ezk86IDb21ave56IMCS5 DwVTp6AwUfGajhSPJ2VxSVHza8Efm8RpAXTdxybbuybxw1YHu3d8nnldXaxUFDzYC4Dl ShfdhqmsO4OT7jdjLyQuTlzMerhC2JoTDKyqmUMBicIBMt1IwvmvIAhGhk843nFFGNWX IMaA== X-Gm-Message-State: APjAAAWlhCN5svJLEfOr0LXT808yMULgVSLjGqV3Y7G9oMOKSlT/i1nj BwFn0ZNKo1G3VMJKBOdJH3iP+y9o X-Google-Smtp-Source: APXvYqwk14mhILbzRc4HGBHFcfHSHQu6SBRca+1HBOyJzY9b93qcnDLEW5a+JUtUBohmqeoqyB8MAw== X-Received: by 2002:a62:ce4b:: with SMTP id y72mr918173pfg.9.1573206250037; Fri, 08 Nov 2019 01:44:10 -0800 (PST) Received: from localhost.localdomain ([2402:800:6375:16b7:502d:9b82:436:143a]) by smtp.gmail.com with ESMTPSA id e198sm6995821pfh.83.2019.11.08.01.44.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Nov 2019 01:44:09 -0800 (PST) From: Doan Tran Cong Danh To: git@vger.kernel.org Cc: Doan Tran Cong Danh Subject: [PATCH v5 6/9] sequencer: reencode squashing commit's message Date: Fri, 8 Nov 2019 16:43:48 +0700 Message-Id: X-Mailer: git-send-email 2.24.0.8.g2e95ca57d2.dirty In-Reply-To: References: <20191031092618.29073-1-congdanhqx@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On fixup/squash-ing rebase, git will create new commit in i18n.commitencoding, reencode the commit message to that said encode. Signed-off-by: Doan Tran Cong Danh --- sequencer.c | 8 +++++--- t/t3900-i18n-commit.sh | 10 +++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/sequencer.c b/sequencer.c index a19954f2bf..833a928929 100644 --- a/sequencer.c +++ b/sequencer.c @@ -1576,6 +1576,7 @@ static int update_squash_messages(struct repository *r, struct strbuf buf = STRBUF_INIT; int res; const char *message, *body; + const char *encoding = get_commit_output_encoding(); if (opts->current_fixup_count > 0) { struct strbuf header = STRBUF_INIT; @@ -1602,7 +1603,7 @@ static int update_squash_messages(struct repository *r, return error(_("need a HEAD to fixup")); if (!(head_commit = lookup_commit_reference(r, &head))) return error(_("could not read HEAD")); - if (!(head_message = get_commit_buffer(head_commit, NULL))) + if (!(head_message = logmsg_reencode(head_commit, NULL, encoding))) return error(_("could not read HEAD's commit message")); find_commit_subject(head_message, &body); @@ -1623,7 +1624,7 @@ static int update_squash_messages(struct repository *r, unuse_commit_buffer(head_commit, head_message); } - if (!(message = get_commit_buffer(commit, NULL))) + if (!(message = logmsg_reencode(commit, NULL, encoding))) return error(_("could not read commit message of %s"), oid_to_hex(&commit->object.oid)); find_commit_subject(message, &body); @@ -4154,9 +4155,10 @@ static int commit_staged_changes(struct repository *r, */ struct commit *commit; const char *path = rebase_path_squash_msg(); + const char *encoding = get_commit_output_encoding(); if (parse_head(r, &commit) || - !(p = get_commit_buffer(commit, NULL)) || + !(p = logmsg_reencode(commit, NULL, encoding)) || write_message(p, strlen(p), path, 0)) { unuse_commit_buffer(commit, p); return error(_("could not write file: " diff --git a/t/t3900-i18n-commit.sh b/t/t3900-i18n-commit.sh index a518281b04..d277a9f4b7 100755 --- a/t/t3900-i18n-commit.sh +++ b/t/t3900-i18n-commit.sh @@ -224,7 +224,15 @@ test_commit_autosquash_multi_encoding () { 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 && + 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 && + test_cmp expect actual ' } From patchwork Fri Nov 8 09:43:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?xJBvw6BuIFRy4bqnbiBDw7RuZyBEYW5o?= X-Patchwork-Id: 11234453 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D8B6D1515 for ; Fri, 8 Nov 2019 09:44:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B5C3E214DA for ; Fri, 8 Nov 2019 09:44:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AY9TW298" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731835AbfKHJoN (ORCPT ); Fri, 8 Nov 2019 04:44:13 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:36731 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730308AbfKHJoM (ORCPT ); Fri, 8 Nov 2019 04:44:12 -0500 Received: by mail-pf1-f195.google.com with SMTP id v19so4231856pfm.3 for ; Fri, 08 Nov 2019 01:44:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LLzDtpst56qSBMMluFonWzNqrGxP4CrCsTzz0xGk6Yk=; b=AY9TW298+RoxconG3OafUzp3ogEyLOdI4jbI5puTesZyS0LgV5z/jvmtcsVxDeER3B O2IwjIlRoPj4fPvVak9jzUy9nQNg9ZTqfR2Nrtvlrfwu+M11wAVBxZTNcZBGK+W/HnI0 Zkya3QQwFy0bKCp4co7t1gYxHwyhr9OuXL9U1lpfdQDUvKVGZNXt3CBLqULSrl9eQPii u6LE5igZt9DLpBMldHQCXXYymLmk5XBytMXohX3YsbNvGisQDrNfyfXfnOZmZGjHTxyj iyLcFTkpPbAQ44CWytJE9s4iRSkd68BQzLnwNrTolckS3VhuomPQl3/XjBxPnQx+mW2E /sEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LLzDtpst56qSBMMluFonWzNqrGxP4CrCsTzz0xGk6Yk=; b=X37XrVuF+F4qGV2uML8OQHGaYw0qW0mHwGK+TqAieO5R3L4LaH6trQ5yPrFWCYwrW0 lHvMMH+RAQdB/gaK84AA89KrXhB3DPB+IGzndYePypwWTGiMFFMWp37TtNDXEhZydl3S zY/AKIQbR1enczTH4lx7moAJFrCVcWTZjG+C9vk9Bzem+YwA91Th9Rn5RmFIHdrJq6F/ n+nQE/mznxsZWEX5LjWmYnYIHnvxKTm9XQgu59nTodbo86xQkw6TugKCywOMWcT2PZiS tI9LkhOsknMYpZ3FIM0UbMa8NUzRKc6NXbXMk8tAbpxGIkp+Tpzn1wtXwZyEuqt90xf5 AVjw== X-Gm-Message-State: APjAAAXfRrPQnkBPwp84LOGCeONCh+hfPv36HWI7G6nclpV+VNj2t9X/ SZ7y5V1+vdqKG2mnr2Jfb+TgKSKv X-Google-Smtp-Source: APXvYqyh842mFwxWHjASR7XA560WEJQHDducj3dat/vez9NbdJuMcNZvtv9BabkY4qFs769YsHq04Q== X-Received: by 2002:a63:535a:: with SMTP id t26mr10943028pgl.215.1573206251569; Fri, 08 Nov 2019 01:44:11 -0800 (PST) Received: from localhost.localdomain ([2402:800:6375:16b7:502d:9b82:436:143a]) by smtp.gmail.com with ESMTPSA id e198sm6995821pfh.83.2019.11.08.01.44.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Nov 2019 01:44:11 -0800 (PST) From: Doan Tran Cong Danh To: git@vger.kernel.org Cc: Doan Tran Cong Danh Subject: [PATCH v5 7/9] sequencer: reencode old merge-commit message Date: Fri, 8 Nov 2019 16:43:49 +0700 Message-Id: X-Mailer: git-send-email 2.24.0.8.g2e95ca57d2.dirty In-Reply-To: References: <20191031092618.29073-1-congdanhqx@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org During rebasing, old merge's message (encoded in old encoding) 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 unusable message for this new merge. Correct it. This change also notice a breakage with git-rebase label system. Signed-off-by: Doan Tran Cong Danh --- Notes: eucJP.txt is copied from t3900 sequencer.c | 3 ++- t/t3433-rebase-i18n.sh | 57 +++++++++++++++++++++++++++++++++++++++++ t/t3433/eucJP.txt | Bin 0 -> 68 bytes 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100755 t/t3433-rebase-i18n.sh create mode 100644 t/t3433/eucJP.txt GIT binary patch literal 68 zcmZ2-e#x69mzLaKa+Ql~$@V43mMmHFddayZYZfkovW_oY%ys|3$+JKuZexpect && + git cat-file commit HEAD >raw && + sed "1,/^$/d" raw >actual && + test_cmp expect actual +} + +test_expect_success setup ' + test_commit one && + git branch first && + test_commit two && + git switch first && + test_commit three && + git branch second && + test_commit four && + git switch second && + test_commit five && + test_commit six +' + +test_expect_success 'rebase --rebase-merges update encoding eucJP to UTF-8' ' + git switch -c merge-eucJP-UTF-8 first && + git config i18n.commitencoding eucJP && + git merge -F "$TEST_DIRECTORY/t3433/eucJP.txt" second && + git config i18n.commitencoding UTF-8 && + git rebase --rebase-merges master && + compare_msg eucJP.txt eucJP UTF-8 +' + +test_expect_failure 'rebase --rebase-merges update encoding eucJP to ISO-2022-JP' ' + git switch -c merge-eucJP-ISO-2022-JP first && + git config i18n.commitencoding eucJP && + git merge -F "$TEST_DIRECTORY/t3433/eucJP.txt" second && + git config i18n.commitencoding ISO-2022-JP && + git rebase --rebase-merges master && + compare_msg eucJP.txt eucJP ISO-2022-JP +' + +test_done diff --git a/t/t3433/eucJP.txt b/t/t3433/eucJP.txt new file mode 100644 index 0000000000000000000000000000000000000000..546f2aac01b67e39d19de601f5586097b34a8325 From patchwork Fri Nov 8 09:43:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?xJBvw6BuIFRy4bqnbiBDw7RuZyBEYW5o?= X-Patchwork-Id: 11234455 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 864F91515 for ; Fri, 8 Nov 2019 09:44:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6506D214DA for ; Fri, 8 Nov 2019 09:44:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mufSRlh8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731490AbfKHJoO (ORCPT ); Fri, 8 Nov 2019 04:44:14 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:39135 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730308AbfKHJoO (ORCPT ); Fri, 8 Nov 2019 04:44:14 -0500 Received: by mail-pf1-f193.google.com with SMTP id x28so4210360pfo.6 for ; Fri, 08 Nov 2019 01:44:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yKnLgcZe0BdMrQUXufyDk7d3i1eZPKwHaujDWgWewzo=; b=mufSRlh8+Xzlai/4oMa3agBxzMm9NV4iWaaTBGpi4rCJPz5FtIHACVGb01g0eX5XCT SDHyqYp9nWB/FeLMgp5ivW712s98+qCUMIvrorFBgdbxl1rXuWHESDTEL9+S8ugOzG6F KHruSnpngasM2oSBmM9v37e2q+nwLBwTeoss3jMfT3jlB7dp9olhrHBjhO2ppk65temH 5ZU8j0hq+kq4JbpZFaIaOj6ejplR1jZryipkJJE4cRM2aqY0NdckBFfrrte3jfkDeW2J GKDML3X9HDwNIKPdn8egZjOo03KkXmWTf+j2JeTfSS+K0dOhDUjzDHxOLE972JoWfber /GPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yKnLgcZe0BdMrQUXufyDk7d3i1eZPKwHaujDWgWewzo=; b=UKAj5RkEEyP8JBvbquvGEZvUonL0JhD/Y2gmy7umu5toRZ5FeMzH6iLtQhu7HfgcJZ cwV3jrlIin7qbp3suWNJOMy20nL21aaC6430Rm81MSSw3A6wd8CP4oLnNZFOqiPZdmlU /eYlUIbm8SkK/OB0ijYdIy9ttRrhdMAH/uyjP/zXP2EHkEEeT+v1tfTUzZ/pN38o97bM pf795yChWYMOFqzFy0xdm1O6Je6Y6B0rwR1xN2q2OpjQ+LOv1GrBXDtwE/U2rSQsLYLE 2soAi1RmQ6slRW/FccEly79eVLD1CvDd/Q4fVspc2W0dPfvWj0VMgJxkmpHN94vshWjy Hsjw== X-Gm-Message-State: APjAAAWilJLsV+asAudlHn3y4xIm8/oHDyfT2jxfZcFPMOEl7aPqsnSN jV0lhBNODDge0SCWuGHhO5yViXSV X-Google-Smtp-Source: APXvYqyRNek4Fug/wWrSV5+F45+z9Ot64ozHTTxJQ0oYGg7gcORIh/i/BqcunettILOFEnA3VlYsYg== X-Received: by 2002:a63:a055:: with SMTP id u21mr11012662pgn.0.1573206253106; Fri, 08 Nov 2019 01:44:13 -0800 (PST) Received: from localhost.localdomain ([2402:800:6375:16b7:502d:9b82:436:143a]) by smtp.gmail.com with ESMTPSA id e198sm6995821pfh.83.2019.11.08.01.44.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Nov 2019 01:44:12 -0800 (PST) From: Doan Tran Cong Danh To: git@vger.kernel.org Cc: Doan Tran Cong Danh Subject: [PATCH v5 8/9] sequencer: reencode commit message for am/rebase --show-current-patch Date: Fri, 8 Nov 2019 16:43:50 +0700 Message-Id: <2e95ca57d2f701752fdc46d72c0ea1af031f8d53.1573205699.git.congdanhqx@gmail.com> X-Mailer: git-send-email 2.24.0.8.g2e95ca57d2.dirty In-Reply-To: References: <20191031092618.29073-1-congdanhqx@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The message file will be used as commit message for the git-{am,rebase} --continue. Signed-off-by: Doan Tran Cong Danh --- Notes: ISO8859-1.txt is copied from t3900 sequencer.c | 3 ++- t/t3433-rebase-i18n.sh | 27 +++++++++++++++++++++++++++ t/t3433/ISO8859-1.txt | Bin 0 -> 15 bytes 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 t/t3433/ISO8859-1.txt GIT binary patch literal 15 XcmX?d`r`R(TwDi}o~OJ>OXmUrN~8!! literal 0 HcmV?d00001 diff --git a/sequencer.c b/sequencer.c index d735d09f98..4d12ad3cc6 100644 --- a/sequencer.c +++ b/sequencer.c @@ -2972,7 +2972,8 @@ 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 *commit_buffer = logmsg_reencode(commit, NULL, encoding); find_commit_subject(commit_buffer, &subject); res |= write_message(subject, strlen(subject), buf.buf, 1); unuse_commit_buffer(commit, commit_buffer); diff --git a/t/t3433-rebase-i18n.sh b/t/t3433-rebase-i18n.sh index bff5a68d25..537d18c330 100755 --- a/t/t3433-rebase-i18n.sh +++ b/t/t3433-rebase-i18n.sh @@ -54,4 +54,31 @@ test_expect_failure 'rebase --rebase-merges update encoding eucJP to ISO-2022-JP compare_msg eucJP.txt eucJP ISO-2022-JP ' +test_rebase_continue_update_encode () { + old=$1 + new=$2 + msgfile=$3 + test_expect_success "rebase --continue update from $old to $new" ' + (git rebase --abort || : abort current git-rebase failure) && + git switch -c conflict-$old-$new one && + echo for-conflict >two.t && + git add two.t && + git config i18n.commitencoding $old && + git commit -F "$TEST_DIRECTORY/t3433/$msgfile" && + git config i18n.commitencoding $new && + test_must_fail git rebase -m master && + test -f .git/rebase-merge/message && + git stripspace <.git/rebase-merge/message >two.t && + git add two.t && + git rebase --continue && + compare_msg $msgfile $old $new && + : git-commit assume invalid utf-8 is latin1 && + test_cmp expect two.t + ' +} + +test_rebase_continue_update_encode ISO-8859-1 UTF-8 ISO8859-1.txt +test_rebase_continue_update_encode eucJP UTF-8 eucJP.txt +test_rebase_continue_update_encode eucJP ISO-2022-JP eucJP.txt + test_done diff --git a/t/t3433/ISO8859-1.txt b/t/t3433/ISO8859-1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cbef0ee6f430c611134a06a6dd6c12fbea589d5 From patchwork Fri Nov 8 09:43:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?xJBvw6BuIFRy4bqnbiBDw7RuZyBEYW5o?= X-Patchwork-Id: 11234459 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C5A8F1515 for ; Fri, 8 Nov 2019 09:44:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A20C0214DA for ; Fri, 8 Nov 2019 09:44:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eTVlNpTV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731845AbfKHJoQ (ORCPT ); Fri, 8 Nov 2019 04:44:16 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:46903 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730308AbfKHJoQ (ORCPT ); Fri, 8 Nov 2019 04:44:16 -0500 Received: by mail-pl1-f194.google.com with SMTP id l4so3749913plt.13 for ; Fri, 08 Nov 2019 01:44:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=R2cv6W7pwwevfjzqI2cdatUqk/ZCUseSEgHm6Y1tDlk=; b=eTVlNpTV1YnlNQVdFVDblQPFUYlc3+5uqAcZ8BZoNFnDR9LMXt/tKdKGLYFpaJjJ5s aZ5+GE+eT0s7OpYFKILBQ9Ia4YqhjrR84uPS4i8JpJlTx/tHrWDHQW0Ci8OrcEQwS/zH rQinrfZyWvftyz0FdjIDPmJtFeF6G0kz/NJ7ZSYWHkTHh++fZ/6OhTSjr4zUZ04lbzbw CGLWDz/WJIOe042ah8hx9bsH+4+vGxiV692KEmhOT36QaKU8aUP6z1U/0uXzUZc41MHI Crgd6Hzbk7no8F8drH8HkR7LXBHejrUj/SmRRxS+zQIrwDzD+jAUQoGwwHVs/hAQD+Wm retQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=R2cv6W7pwwevfjzqI2cdatUqk/ZCUseSEgHm6Y1tDlk=; b=TsY0Rakg1EjZo3ospUGgsOjCi4PVj5EY34XD7r26SbflLMFsOa1xQHUSWeDY7BzAuS pP9w2Uu9Ap7oVnRP0QWONNhcbSEuB3b4jD80bo4oWjQ+6xGFCxG8fSw2elO1UBhEKP6s LVQWICv5tOraxEabIbvlnFlEbIvx0ggwgZW6PV1HFhZDHvD3E22S3qUpsBmiFfIKw8Ns r8yDbyZ+B+Gb7g3j33HlYLYO0ZC15Msiujm+c9hl3iKyKPbUXJn35lWJkWTZVkJMVJwR Op2DK8eN0A2l6f9j+SDd9X6Kld41TRRZGSav2XkDcE7ZEX8n6Kw9wudypr1jkOuZ/863 O7aw== X-Gm-Message-State: APjAAAWFF2D3Cm3jCqT7HMq03mhTJmK9HnQ9mscH7Ac+MOC1h5LTqnQU PO0pN3gw64UHL4gm/0m8EJLLd1y/ X-Google-Smtp-Source: APXvYqzUm1ub9VrlNvOsvR8RRxPLJQE6Tl3H910MRobDkpJigJkkDn6mEMTuiPOHFw2svY8cTt1ufg== X-Received: by 2002:a17:90a:d352:: with SMTP id i18mr12480072pjx.42.1573206254763; Fri, 08 Nov 2019 01:44:14 -0800 (PST) Received: from localhost.localdomain ([2402:800:6375:16b7:502d:9b82:436:143a]) by smtp.gmail.com with ESMTPSA id e198sm6995821pfh.83.2019.11.08.01.44.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Nov 2019 01:44:14 -0800 (PST) From: Doan Tran Cong Danh To: git@vger.kernel.org Cc: Doan Tran Cong Danh Subject: [PATCH v5 9/9] sequencer: fallback to sane label in making rebase todo list Date: Fri, 8 Nov 2019 16:43:51 +0700 Message-Id: <860dee65f49ea7eacf5a0c7c8ffe59095a51b1ce.1573205699.git.congdanhqx@gmail.com> X-Mailer: git-send-email 2.24.0.8.g2e95ca57d2.dirty In-Reply-To: References: <20191031092618.29073-1-congdanhqx@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In later stage of rebasing, we will make a ref in refs/rewritten/