From patchwork Tue Jan 12 08:47:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12012779 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FDB7C433E6 for ; Tue, 12 Jan 2021 08:48:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E678A22D58 for ; Tue, 12 Jan 2021 08:48:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405636AbhALIse (ORCPT ); Tue, 12 Jan 2021 03:48:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389517AbhALIs1 (ORCPT ); Tue, 12 Jan 2021 03:48:27 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25C1EC061786 for ; Tue, 12 Jan 2021 00:47:47 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id r4so1262125wmh.5 for ; Tue, 12 Jan 2021 00:47:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=xDbTyy2k8ddneaa0zG+v58ARtgrWMBVCHMC1Twpq0lE=; b=hPi7AnNIysc6v3MA0FdR+uLRc9FcmArXo+MH4m99H2YAgzYtp/odyjUGP37/TkCSoK cz40UuXxaULb+z74R+hpvCMx6mdbgaRspV5Vy2CiBBIhnjnDuYxRscOcPN5sGDBpiQfs plful8j1nPaqde7xf8kwa6pfCur68KjFRpiM4aLmcJTcZT6vy0pQVEdOZlmW9JvUJ5do GOA/2WoR5YrElh7a53MNBBNHU2puKpsgCi9La3OulL6moEqV00QAgwYe21quyeC6422x v3N3PEF6+ZFaS+q0NCuSDMu96GH4HKgTytWFnOrOSKgqIlbgxS2Rzj89/EiTyB2yD3Jc 6f1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=xDbTyy2k8ddneaa0zG+v58ARtgrWMBVCHMC1Twpq0lE=; b=m2miV+mns2KjxDmF8krsrFvCbPlOJ1rNc3UV94q7WkD1jcvYKalHJm1UxO6y3nOZxJ RnX725vk7xK4yHF2kbyM69Qt1rGwrx7YaBP9Zyt2Rjytl/Jx4a/Bk0xIeNpiifamr9sq wBt2fAb+qvtrpHbqpTjQKJT+GnHdKQpuStqcgwP8KtrW0UDrzmRlUL5JWg+Guc+DBHYh lC2dzcmfPYNkKHP9zog26zy04BTiYzEUMph0mYorYUnZ/ayBYtdOlSNofGhxk6OwRWLT 1NCnKruC9yYqEQgtyCODG5Bh1tDB9YHC/qLyMTY7LF1qLvb1SneEPeUsWB/3tsQpalHu uOaA== X-Gm-Message-State: AOAM5311WFssJuQkEHlFl7GcPaumCa43a+8GFeEa2I6TD1bFWrFXstsr YxWP5bH2YA3CmnOyc8sj24qD2sYyjF4= X-Google-Smtp-Source: ABdhPJw8kiS+yiKpV/BrcX5kk+eYDHXVZWzK2DmxDwMk0olVKTDX5zIOMEbU5bA/2bX/ykOoTH14PA== X-Received: by 2002:a1c:988f:: with SMTP id a137mr2477467wme.130.1610441265639; Tue, 12 Jan 2021 00:47:45 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id u3sm4179541wre.54.2021.01.12.00.47.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 00:47:45 -0800 (PST) Message-Id: <004f90026031cb7ce71689481fabd27aa63485dd.1610441263.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 12 Jan 2021 08:47:32 +0000 Subject: [PATCH 01/11] tests: remove unnecessary GIT_TEST_GETTEXT_POISON=false constructs Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41j?= Duy , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= , SZEDER =?utf-8?b?R8OhYm9y?= , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin The idea of the `GETTEXT_POISON` mode is to test translated messages, at least _somewhat_. There is not really any point in turning off that mode by force, except _maybe_ to test the mode itself. So let's avoid overriding `GIT_TEST_GETTEXT_POISON` in the test suite unless testing the `GETTEXT_POISON` functionality itself. Signed-off-by: Johannes Schindelin --- t/t0017-env-helper.sh | 6 ++---- t/t1305-config-include.sh | 6 ++---- t/t7201-co.sh | 4 ++-- t/t9902-completion.sh | 1 - 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/t/t0017-env-helper.sh b/t/t0017-env-helper.sh index c1ecf6aeac6..e0931310306 100755 --- a/t/t0017-env-helper.sh +++ b/t/t0017-env-helper.sh @@ -85,10 +85,8 @@ test_expect_success 'env--helper reads config thanks to trace2' ' git config -f home/.gitconfig include.path cycle && git config -f home/cycle include.path .gitconfig && - test_must_fail \ - env HOME="$(pwd)/home" GIT_TEST_GETTEXT_POISON=false \ - git config -l 2>err && - grep "exceeded maximum include depth" err && + test_must_fail env HOME="$(pwd)/home" git config -l 2>err && + test_i18ngrep "exceeded maximum include depth" err && test_must_fail \ env HOME="$(pwd)/home" GIT_TEST_GETTEXT_POISON=true \ diff --git a/t/t1305-config-include.sh b/t/t1305-config-include.sh index f1e1b289f98..308c5d530b3 100755 --- a/t/t1305-config-include.sh +++ b/t/t1305-config-include.sh @@ -352,10 +352,8 @@ test_expect_success 'include cycles are detected' ' git init --bare cycle && git -C cycle config include.path cycle && git config -f cycle/cycle include.path config && - test_must_fail \ - env GIT_TEST_GETTEXT_POISON=false \ - git -C cycle config --get-all test.value 2>stderr && - grep "exceeded maximum include depth" stderr + test_must_fail git -C cycle config --get-all test.value 2>stderr && + test_i18ngrep "exceeded maximum include depth" stderr ' test_done diff --git a/t/t7201-co.sh b/t/t7201-co.sh index b36a93056fd..630406a73c5 100755 --- a/t/t7201-co.sh +++ b/t/t7201-co.sh @@ -245,8 +245,8 @@ test_expect_success 'checkout to detach HEAD' ' rev=$(git rev-parse --short renamer^) && git checkout -f renamer && git clean -f && - GIT_TEST_GETTEXT_POISON=false git checkout renamer^ 2>messages && - grep "HEAD is now at $rev" messages && + git checkout renamer^ 2>messages && + test_i18ngrep "HEAD is now at $rev" messages && test_line_count -gt 1 messages && H=$(git rev-parse --verify HEAD) && M=$(git show-ref -s --verify refs/heads/master) && diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index a1c4f1f6d40..e5adee27d41 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -2363,7 +2363,6 @@ test_expect_success 'sourcing the completion script clears cached commands' ' ' test_expect_success 'sourcing the completion script clears cached merge strategies' ' - GIT_TEST_GETTEXT_POISON=false && __git_compute_merge_strategies && verbose test -n "$__git_merge_strategies" && . "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" && From patchwork Tue Jan 12 08:47:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12012777 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5ED11C43381 for ; Tue, 12 Jan 2021 08:48:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 13FB022EBE for ; Tue, 12 Jan 2021 08:48:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405668AbhALIsk (ORCPT ); Tue, 12 Jan 2021 03:48:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405619AbhALIs2 (ORCPT ); Tue, 12 Jan 2021 03:48:28 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC442C061794 for ; Tue, 12 Jan 2021 00:47:47 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id q75so1274750wme.2 for ; Tue, 12 Jan 2021 00:47:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=AhtG3W2YUY58mimxwSeBbehCrJPBK9/gsdc2KTZkntU=; b=A9uqLftzEww/QYjccdKNmJogGDEyG4a3e1JozwvRwMBfGCo0JuDcmXI+cP39DJpHE6 Uxi8slBoCoFpcssJ+mlOfoSqd4pRLKO9GYxo8YAkqR/+lgWvZjEIkAIn/8t9ge/gNypV c/DKjJFueZkU6SoVblzLcMoanVK0nZeVLV69k5NDqG/LFvsfx1WqYRiT9SxFIpM1p9CA S7QLdX3xz8RkltggmXYr07HcDsbhgHPfYgLRy1+qGTdWpI7MiKOdck5+wQQy00/lAgrR S4eZCM6GftHgdbMoiS5z85+IicOFgyKLkgvm0j8gXIjmd/N4sNxlqugZqhir0BSH8x3V QkvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=AhtG3W2YUY58mimxwSeBbehCrJPBK9/gsdc2KTZkntU=; b=lcxaNFepA1KVVR7cvjAYxoWoLH8hflNCe1sjxith/Kn07i+q66kzORbLZgv1OFUGog XyZBGpHr2SiEY1bQG5rC8rCNoqbM+BEVYpu9qEox65vxQvPxldLMhalgOEySkEs/wrAE eE6H2QnaT434CI+Q9kzN/ZTq2gysFkC3tpuURrtQ0kWq9E5BxFl62YgdxqgPDrhGdX6S +ddPCRuvOFNrRbE9JQABokRkpu5pnJfBr7BPb4Uqy6ek/QTAPKhWwqDJKLg7XevbQfPB 2ovjHstAQYHghlsusdBv0Njlh0I721AQnnDch5Dk5O1Th8YhE120HlO2hvMyBbxaDqLG X0bg== X-Gm-Message-State: AOAM531EL08lS0AgqQJxvFY5V28GYeFse7GuWORIO1RfpsYLsTl8N+1/ ZGNbngXVJcIo6KMJesRxnWgWaD9vmKc= X-Google-Smtp-Source: ABdhPJw03g8/b/KJDDx6G1eHdbo4iUQ9yi3lVmWWQO2ACMTAsf+qNLcr98jF5KJcdV2o/jevaKVOKg== X-Received: by 2002:a1c:c2d4:: with SMTP id s203mr2466827wmf.58.1610441266531; Tue, 12 Jan 2021 00:47:46 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id c4sm2819778wmf.19.2021.01.12.00.47.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 00:47:46 -0800 (PST) Message-Id: In-Reply-To: References: Date: Tue, 12 Jan 2021 08:47:33 +0000 Subject: [PATCH 02/11] Support GIT_TEST_GETTEXT_POISON=rot13 Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41j?= Duy , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= , SZEDER =?utf-8?b?R8OhYm9y?= , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin Signed-off-by: Johannes Schindelin --- gettext.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- gettext.h | 5 +++-- 2 files changed, 66 insertions(+), 4 deletions(-) diff --git a/gettext.c b/gettext.c index 35d2c1218db..7e8966d8326 100644 --- a/gettext.c +++ b/gettext.c @@ -68,11 +68,72 @@ const char *get_preferred_languages(void) int use_gettext_poison(void) { static int poison_requested = -1; - if (poison_requested == -1) - poison_requested = git_env_bool("GIT_TEST_GETTEXT_POISON", 0); + if (poison_requested == -1) { + const char *v = getenv("GIT_TEST_GETTEXT_POISON"); + if (v && !strcmp(v, "rot13")) + poison_requested = 2; + else + poison_requested = + git_env_bool("GIT_TEST_GETTEXT_POISON", 0); + } return poison_requested; } +static inline char do_rot13(char c) +{ + if (c >= 'a' && c <= 'm') + return c + 'n' - 'a'; + if (c >= 'n' && c <= 'z') + return c + 'a' - 'n'; + if (c >= 'A' && c <= 'M') + return c + 'N' - 'A'; + if (c >= 'N' && c <= 'Z') + return c + 'A' - 'N'; + return c; +} + +const char *gettext_maybe_rot13(const char *msgid) +{ + static struct strbuf round_robin[4] = { + STRBUF_INIT, STRBUF_INIT, STRBUF_INIT, STRBUF_INIT + }; + static int current; + struct strbuf *buf; + + if (use_gettext_poison() != 2) + return "# GETTEXT POISON #"; + + buf = &round_robin[current++]; + if (current >= ARRAY_SIZE(round_robin)) + current = 0; + + strbuf_reset(buf); + while (*msgid) { + const char *p = strchrnul(msgid, '%'), *spec; + + while (*p && p[1] == '%') + p = strchrnul(p + 2, '%'); + + if (p != msgid) { + strbuf_addstr(buf, ""); + while (p != msgid) + strbuf_addch(buf, do_rot13(*(msgid++))); + strbuf_addstr(buf, ""); + } + + if (!*p) + break; + + spec = strpbrk(p + 1, "diouxXeEfFgGaAcsCSpnm%"); + if (!spec) + BUG("Unrecognized format string: %s", p); + strbuf_add(buf, p, spec + 1 - p); + msgid = spec + 1; + } + + return buf->buf; +} + #ifndef NO_GETTEXT static int test_vsnprintf(const char *fmt, ...) { diff --git a/gettext.h b/gettext.h index bee52eb1134..298adda7e15 100644 --- a/gettext.h +++ b/gettext.h @@ -29,6 +29,7 @@ #define FORMAT_PRESERVING(n) __attribute__((format_arg(n))) int use_gettext_poison(void); +const char *gettext_maybe_rot13(const char *msgid); #ifndef NO_GETTEXT void git_setup_gettext(void); @@ -48,14 +49,14 @@ static inline FORMAT_PRESERVING(1) const char *_(const char *msgid) { if (!*msgid) return ""; - return use_gettext_poison() ? "# GETTEXT POISON #" : gettext(msgid); + return use_gettext_poison() ? gettext_maybe_rot13(msgid) : gettext(msgid); } static inline FORMAT_PRESERVING(1) FORMAT_PRESERVING(2) const char *Q_(const char *msgid, const char *plu, unsigned long n) { if (use_gettext_poison()) - return "# GETTEXT POISON #"; + return gettext_maybe_rot13(n < 2 ? msgid : plu); return ngettext(msgid, plu, n); } From patchwork Tue Jan 12 08:47:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12012775 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 151BBC433E0 for ; Tue, 12 Jan 2021 08:48:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C6C9922E00 for ; Tue, 12 Jan 2021 08:48:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405664AbhALIsf (ORCPT ); Tue, 12 Jan 2021 03:48:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405621AbhALIse (ORCPT ); Tue, 12 Jan 2021 03:48:34 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFB7FC061795 for ; Tue, 12 Jan 2021 00:47:48 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id y187so1267323wmd.3 for ; Tue, 12 Jan 2021 00:47:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=McZIHHbGhZYOXSIckzfGJFUnBSPH/1f/sE7o+RtDLyg=; b=ElqYPc/YsmJKpV4sL9evavnmCZittV5fbQ2QG6lHP60NemsjBoOT6zhA9ojKZaBV3z BfRFhb9fPKtrRD3nzji6GPe6rwHzyGvT2ul9cQdEWAhF7pudpUqmNw1Lk+7cagWkjNjB cKIVUiYRJTepXcwoVMNy5/k0wGAu/+mwp8Eia+n4qKWy4/aEvmcFOSryhkcw3H4bxr7S I6cRtBJpfPyyvqSFjK2KqX2PNh3mV7XGmroOiFePew+2xlLeAQahIWHt6sE4YCva37XV yfRvbqIA6acDRaJsJn+W5ye0UQ9kkePMfUo6y8rr2RrCA69csn0yLjwlp6rpsaKvdeOX AtHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=McZIHHbGhZYOXSIckzfGJFUnBSPH/1f/sE7o+RtDLyg=; b=LpNc7jMY9Q0kFuU4AOZ3jmdgHG0fxBFSE0OTOVEN7vAUDZMd/fTyps6+6K0Vbz+JZA 6dVoD8rCOdKTbRyzVVeTaXTr73GoHzfhAMqRs+Ko0C+j7+/nz7lFTCr1Mbaq2tIj9mrX gZHtq/C5xPr2SedWsNPdL5jr0AiDZeT2tlaMysv4mtUEBMcGuGt6UVRqoo2k1LD3mgV4 tdStTQ+ZCXP1+97AIowDvajWSz3sWAnloGjL5VMi0hiPkuY90bx4yy2EsH8ifKNs98Tl qak+4H+RKeYATxrBik55OhRGvLdI0TvK/s5FkfZ3JXzdR+lTitfiC/KbOwnkd/bHNdo6 u1Eg== X-Gm-Message-State: AOAM531P3pduk7pgM9s3cuAvZf0lMXr5xWxFh82MXcA8Q3uv7ssr8o9T Y8dqVTxM5I5w4cUybQfeThKwk8sDX1E= X-Google-Smtp-Source: ABdhPJzCgEKV5N5ZRiWDUF4LL/D3jje9TMLZBCgmcrCOnOKLqfhOzO9wPM5EtT3s+GIedZZ5Ez+TiA== X-Received: by 2002:a7b:c8da:: with SMTP id f26mr2486531wml.50.1610441267572; Tue, 12 Jan 2021 00:47:47 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id o8sm3649130wrm.17.2021.01.12.00.47.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 00:47:46 -0800 (PST) Message-Id: <978567b137e85d672c9f0591667d643945aa2bbb.1610441263.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 12 Jan 2021 08:47:34 +0000 Subject: [PATCH 03/11] parse-options: add forgotten translations Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41j?= Duy , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= , SZEDER =?utf-8?b?R8OhYm9y?= , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin Signed-off-by: Johannes Schindelin --- parse-options-cb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parse-options-cb.c b/parse-options-cb.c index 4542d4d3f92..00862af486e 100644 --- a/parse-options-cb.c +++ b/parse-options-cb.c @@ -91,7 +91,7 @@ int parse_opt_commits(const struct option *opt, const char *arg, int unset) if (!arg) return -1; if (get_oid(arg, &oid)) - return error("malformed object name %s", arg); + return error(_("malformed object name %s"), arg); commit = lookup_commit_reference(the_repository, &oid); if (!commit) return error("no such commit %s", arg); @@ -110,7 +110,7 @@ int parse_opt_commit(const struct option *opt, const char *arg, int unset) if (!arg) return -1; if (get_oid(arg, &oid)) - return error("malformed object name %s", arg); + return error(_("malformed object name %s"), arg); commit = lookup_commit_reference(the_repository, &oid); if (!commit) return error("no such commit %s", arg); From patchwork Tue Jan 12 08:47:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12012795 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A6CFC43333 for ; Tue, 12 Jan 2021 08:49:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CD5C122E00 for ; Tue, 12 Jan 2021 08:49:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405734AbhALItc (ORCPT ); Tue, 12 Jan 2021 03:49:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405626AbhALIse (ORCPT ); Tue, 12 Jan 2021 03:48:34 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D605DC06179F for ; Tue, 12 Jan 2021 00:47:49 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id m4so194522wrx.9 for ; Tue, 12 Jan 2021 00:47:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=IWJCE3aEwPiWjDl6RkegeJ9uHFGUBjRTKjSijMhrrw0=; b=aofkLL7hH5wpdMLtgr6hFZG93ZREpKUg/tIPDBXDOyl7boZ1JWWNlG8PymnzmaWZvT bmFR+wacW0eVHhGaDhi1i7yECI4GumWHLGqR45U6DvvMcM57EfRHO0vCtahTd3XsqX5i P+PN1TKB5gNsCDLtYNShImY0a6fD2fsT7yJbLPUy9yq2pCargZ++N5Jf8C8O396M587+ zwX9UDYhRmf7VSzshsfpiOYL6xRJy6TlcLR3H0MZEmpyIf7tTvUoZaqoK71rQi/vMFyP ZA9wFeb5IDElqWA3CYoTCrnRnkdHrNaGvDrc2iMQVftDmVbifhm7+wNGRwruyIE+u0dL tvng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=IWJCE3aEwPiWjDl6RkegeJ9uHFGUBjRTKjSijMhrrw0=; b=U6usAv2WIRZKcL6z4t1whhdOE6b88e8qTemheBJIyaJgGaRctleVJZPkGBQnYWdTlp xB4gy88w/o8+Cpv5gxAtm9eKiTwD59mGTH3NUP62qEeZSny3IvscGKxwTn+iH5UvJcyi 2Mz/D7iBSteEhFG+w30mV9S22tT9aiiWMLM2OAukl2o5G9Mq3M05wABCfQ/yldlZQl7B u44MB0+OJ0jKzx92urCNCBXnMUL9unb1jbMJMtGBUjyGK4M0UqttjLtAop+V+2IY1uNT ZZ58U1MmGkyediBr+tA+9fZZvGYhQCP5K9cIpuBG/Q7F7C0JM0Wfjux2gUu8koK9rgu7 0e3w== X-Gm-Message-State: AOAM530UbuZhtFWwgOH88nYsMfbJx9gPuawvSpRQDAXWcTai2B8GxT8K LfsP8bmJrIMRH0O4dlDs1wgIPZZTKzg= X-Google-Smtp-Source: ABdhPJxyZWwzXYhgQ63fc8CJ27BKhJUUHH1eg0eA6Izp2Wo5BbxqYO1iypfFs2Q7bplUDGvYjsb5PQ== X-Received: by 2002:a5d:6cd4:: with SMTP id c20mr3073563wrc.57.1610441268537; Tue, 12 Jan 2021 00:47:48 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id b13sm3552852wrt.31.2021.01.12.00.47.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 00:47:48 -0800 (PST) Message-Id: <8f2c08474a75793c24af7d4ae44d73d2b23920bc.1610441263.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 12 Jan 2021 08:47:35 +0000 Subject: [PATCH 04/11] sha1dc: mark forgotten message for translation Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41j?= Duy , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= , SZEDER =?utf-8?b?R8OhYm9y?= , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin Signed-off-by: Johannes Schindelin --- sha1dc_git.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sha1dc_git.c b/sha1dc_git.c index 5c300e812e0..fecf5da1483 100644 --- a/sha1dc_git.c +++ b/sha1dc_git.c @@ -18,7 +18,7 @@ void git_SHA1DCFinal(unsigned char hash[20], SHA1_CTX *ctx) { if (!SHA1DCFinal(hash, ctx)) return; - die("SHA-1 appears to be part of a collision attack: %s", + die(_("SHA-1 appears to be part of a collision attack: %s"), hash_to_hex_algop(hash, &hash_algos[GIT_HASH_SHA1])); } From patchwork Tue Jan 12 08:47:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12012783 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE073C433E9 for ; Tue, 12 Jan 2021 08:49:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9B0A622D58 for ; Tue, 12 Jan 2021 08:49:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405686AbhALItI (ORCPT ); Tue, 12 Jan 2021 03:49:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405681AbhALItH (ORCPT ); Tue, 12 Jan 2021 03:49:07 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAC27C0617A2 for ; Tue, 12 Jan 2021 00:47:50 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id t30so1592004wrb.0 for ; Tue, 12 Jan 2021 00:47:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=akonExXIDLh4wqzHHffyLGc/w8EnHnTJkjh04ukIngI=; b=n7oi7objkdD/o5WCitX42wAT6NhAsmsTsahJ+SAJKiGxUc1sUrsKQ4kVihb58DuNUl y+PtmwzaV9we74EwoWhsnXsl+1ZWVdavuG13Bk5/dLfNY+BWRgELmCmp9wps0i9gzNDi ldQtAkI7J882q6b3LfT/W11P3EKB8g+WyjRB3a7TIYQ8APyWnsMYXthTABISOylrrcaC WTXPy0bp4ASEBoIJaLRqAuh4KOTRHPPWCg0wzy1CN0J7hT9wGl9zHcxlOugka1bjES2W IOIEcio6nWqTmu34XNMg+9w+2Mt6Jcvk5Sx+V3l/eJAkJEHwv+nqniMZCDmR3Qjnlm4n BsZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=akonExXIDLh4wqzHHffyLGc/w8EnHnTJkjh04ukIngI=; b=D9urqDA7s1qgdSZC7QpJz/5i8mUEEhgvQ/VAbl5KquovM6Ww1GoV4qpd40l9VznDaV w/HtKtSwOtpE+p1exVGCf5MOUYN4muLq8vTERARfpHSdEhAcru/9nCNAJpIUwNyUKKid mMWf12uB6+cUzIdHejtEkJOq+YOrDqVzIz6hkRn9xoVkk0+AiVCpAfjukyB7lIoCkoDd kdHOE5/oS9W+IxWfvonQ2hnD0QDXWMnEWzWdYbj3xqwzYPTsEqkzXek2OXBe7wPr+q2i IUpWfyHJKELi+x8mjR6Z1pPf8OvbwqHb6Sx1OFUHyWMorshTMbAek+y/T7OlKsPZw2mt SI5A== X-Gm-Message-State: AOAM531amoh3t/zdH4Pj8wwasUZ6jeYET9l0oCWurwZZRHMDmOagiVCs sGrXDsO65ZAp0aJNvjJeZc3LB/mc4to= X-Google-Smtp-Source: ABdhPJztCD4ZXV/BIAFKhtupT9RGgTDmja/Ebmu2aq+hsACJmBQursGTVoOXO9yBydGL3b6AVOFdFQ== X-Received: by 2002:a5d:62c8:: with SMTP id o8mr3141337wrv.51.1610441269299; Tue, 12 Jan 2021 00:47:49 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id l1sm3471394wrq.64.2021.01.12.00.47.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 00:47:48 -0800 (PST) Message-Id: In-Reply-To: References: Date: Tue, 12 Jan 2021 08:47:36 +0000 Subject: [PATCH 05/11] t0006: use `test_i18ncmp` only for C locales Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41j?= Duy , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= , SZEDER =?utf-8?b?R8OhYm9y?= , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin We cannot really test anything else, as we do not control the output of `strftime()`. Signed-off-by: Johannes Schindelin --- t/t0006-date.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t0006-date.sh b/t/t0006-date.sh index 75ee9a96b80..9f27e202d36 100755 --- a/t/t0006-date.sh +++ b/t/t0006-date.sh @@ -9,7 +9,7 @@ GIT_TEST_DATE_NOW=1251660000; export GIT_TEST_DATE_NOW check_relative() { t=$(($GIT_TEST_DATE_NOW - $1)) echo "$t -> $2" >expect - test_expect_${3:-success} "relative date ($2)" " + test_expect_${3:-success} C_LOCALE_OUTPUT "relative date ($2)" " test-tool date relative $t >actual && test_i18ncmp expect actual " @@ -137,7 +137,7 @@ check_approxidate '2009-12-01' '2009-12-01 19:20:00' check_date_format_human() { t=$(($GIT_TEST_DATE_NOW - $1)) echo "$t -> $2" >expect - test_expect_success "human date $t" ' + test_expect_success C_LOCALE_OUTPUT "human date $t" ' test-tool date human $t >actual && test_i18ncmp expect actual ' From patchwork Tue Jan 12 08:47:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12012781 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D04DC433E6 for ; Tue, 12 Jan 2021 08:49:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4E07922E00 for ; Tue, 12 Jan 2021 08:49:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405691AbhALItI (ORCPT ); Tue, 12 Jan 2021 03:49:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405682AbhALItH (ORCPT ); Tue, 12 Jan 2021 03:49:07 -0500 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 830F6C0617A3 for ; Tue, 12 Jan 2021 00:47:51 -0800 (PST) Received: by mail-wr1-x42a.google.com with SMTP id r3so1581780wrt.2 for ; Tue, 12 Jan 2021 00:47:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=f8AOVoxbj+7nrUbSLitO3SHHi4LdQLQQHdmEiqObpu4=; b=GCcIVeQfVnP8/WF+bF3M1SCcQDrUW5Tv7Z/vujq8ebQLxUrgpXNL8AS2I53KCvxazX bpJd7LGXEmXjSGKdGjLztQdZG58Y/NQMpCLX/V8dtUmqsmpRD4n9KqATIuBf3aubt+IK pW587dR7BEglr4vNE2B39RD4Wa2DI9unwGOdWFha72r9BbTIsO+2KXoXBJd2+SExetk1 TAtk2tXEyedWvHb80tY3Jx3mwq286BcpQu1aoJS7hsXWJgwynZHuUVNIBKrLpf7mquW2 X1xddIsJFN7FrL9kz3JLv0QB/3cQ2057NakhdRZCBhHzkNs8flhthCCpemdzU2MZdevi rYyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=f8AOVoxbj+7nrUbSLitO3SHHi4LdQLQQHdmEiqObpu4=; b=tevjNwwF5AzRqIiAlHWlniNFIS4PvkORfcXlJu0jFT1X0XEC0OqZt/hCEcQQ5ouu61 JfFRxj8oifjkap7yR8zYfKrWqtgt52yaatXmw9fg8jDTjyavlvEgynISP79RO/OYiKGZ AJCsG+WXb7oQa6DsriSB4yBnf1tjkuNLFtYWzADi375O8lEgP9fBjAWd9owMLGnhak0u aTwPQFOgHNKioCVrnZC8Yi+2HrrqaVF82r48pJGsorYB+s+Nk8L1SNS8tT2usJ/DLrFE zVq9vgYITrnscCZ9F4FDWbnHDhKUb/TvQ9c13fX5p2d71+stAxC54hzh7RFS7EPFqEo3 Ty2g== X-Gm-Message-State: AOAM533xkAVS7Mv89oTQqwxrfLP+FXMxemQ3+dYvtF77UvuosDqoKkEe GSz/Gb5iOZbBibyRvG3vGiMCQ9NiUBQ= X-Google-Smtp-Source: ABdhPJxZNYp0wJPpnvxWt9gpUegIAy96rG1qWbK37ePsAdgg6YQoHAEGxr7SLtMAuhF+rgGmlt7k7g== X-Received: by 2002:a5d:6909:: with SMTP id t9mr2967648wru.327.1610441270132; Tue, 12 Jan 2021 00:47:50 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id g5sm3975831wro.60.2021.01.12.00.47.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 00:47:49 -0800 (PST) Message-Id: In-Reply-To: References: Date: Tue, 12 Jan 2021 08:47:37 +0000 Subject: [PATCH 06/11] t0041: stop using `test_i18ngrep` on untranslated output Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41j?= Duy , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= , SZEDER =?utf-8?b?R8OhYm9y?= , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin Signed-off-by: Johannes Schindelin --- t/t0041-usage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t0041-usage.sh b/t/t0041-usage.sh index 5b927b76fe5..27309b1a8f8 100755 --- a/t/t0041-usage.sh +++ b/t/t0041-usage.sh @@ -42,7 +42,7 @@ test_expect_success 'tag usage error' ' test_expect_success 'branch --contains ' ' git branch --contains "master" >actual 2>actual.err && - test_i18ngrep "master" actual && + grep "master" actual && test_line_count = 0 actual.err ' From patchwork Tue Jan 12 08:47:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12012785 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3D96C43381 for ; Tue, 12 Jan 2021 08:49:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C4E4D22E00 for ; Tue, 12 Jan 2021 08:49:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405697AbhALItK (ORCPT ); Tue, 12 Jan 2021 03:49:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405681AbhALItI (ORCPT ); Tue, 12 Jan 2021 03:49:08 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B086C0617A4 for ; Tue, 12 Jan 2021 00:47:52 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id y17so1534853wrr.10 for ; Tue, 12 Jan 2021 00:47:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=4DhR/G2xA842bEu7wGUO3+7cLp9usxdVGpDGIUia6kI=; b=WGvmoGyFsBvR6NpQuIYJeOvO0zCRC0LcRNKxk7/3RxBI8bqp9XtEPeKVjGdPYAVpIv lIzhHhxvoYGa7aNqaPbpDTxwc1z79UKXCIy21FWS2RyRmAx68tpLmTrh3XqNSK8Nq1YD dHFZArmXpvPuA6c5mM9OQunk6LJ+yC2QUmDcyABVzatovgO9tU+TYwtdtYIBzt1Ujr4Z 6kXgp34bwMBLAlz20x2u1Pd4O1ES/nxSkcG680NBuPvoN4kPbH7Z7UBqrNqg0zwkASmt La/KwUFW/28HpaekDWarvTm8DPrdYoe385PLoQ9KW9OxKN1qYOgHAdReY+C14k5lwFQx WsmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=4DhR/G2xA842bEu7wGUO3+7cLp9usxdVGpDGIUia6kI=; b=dlg6bcdgAo0WKQxqlNVSvJD7q+JoV6Rkx0TAO665u3PgESIvPGlBizDlLj1gyIjFJn QTVksBQ/dSFXVZLk3+6Ic1CXkArHPnqeeVOOeQPjTpDvtA0AJP20IKVW+Fl6MhPFrYJd JQjt8WLDsVaAA4QEyD9sWczQVugVYctbUkbSUOgQkjCdXIZm2VEJazGPdHco4kQXUJow wuF+0PmAmszprtsJ1sCbu07g1jNQ3JdvyUUGI//lHulRu8xRnEBQpHlnLf5cd3OptJoJ ruIemKh2rXT8tPtzjQsAg6Nq0540wIcE5BPEiiTpElYx6G5Typ2zGwYkaeAPycPQrCgR N4ew== X-Gm-Message-State: AOAM533mdU7GGyNIlcQgneVQKMX3zK5W5Jp35IGIvp928hzi28aZaj02 tnIPrkcACkeXeo+hOdEn21scWBwTCsA= X-Google-Smtp-Source: ABdhPJzFtXebooGoiIdSnwJrp2ZJ8YR7TYlWX1lqoPKDYYtL4sfWcXHqw4G+Zu8s8wYQjm170HRkrg== X-Received: by 2002:a5d:6682:: with SMTP id l2mr3041607wru.213.1610441270911; Tue, 12 Jan 2021 00:47:50 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id g5sm3975899wro.60.2021.01.12.00.47.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 00:47:50 -0800 (PST) Message-Id: <5aa21ffc7f94262a5c31fca80d998115d3a5522f.1610441263.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 12 Jan 2021 08:47:38 +0000 Subject: [PATCH 07/11] t0027: mark a function as requiring the C locale Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41j?= Duy , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= , SZEDER =?utf-8?b?R8OhYm9y?= , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin The `check_warning` function uses regular expressions matching English text, it therefore won't work reliably with anything but the C locale. In particular, we won't be able to match the needle 'in' under GETTEXT_POISON=rot13. Signed-off-by: Johannes Schindelin --- t/t0027-auto-crlf.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/t/t0027-auto-crlf.sh b/t/t0027-auto-crlf.sh index 9fcd56fab37..baa5c6f435b 100755 --- a/t/t0027-auto-crlf.sh +++ b/t/t0027-auto-crlf.sh @@ -76,6 +76,9 @@ create_NNO_MIX_files () { } check_warning () { + # The `grep` and `sed` below expect the locale to be "C" + test_have_prereq C_LOCALE_OUTPUT || return 0 + case "$1" in LF_CRLF) echo "warning: LF will be replaced by CRLF" >"$2".expect ;; CRLF_LF) echo "warning: CRLF will be replaced by LF" >"$2".expect ;; From patchwork Tue Jan 12 08:47:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12012787 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1B04C433DB for ; Tue, 12 Jan 2021 08:49:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7798E22E01 for ; Tue, 12 Jan 2021 08:49:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405694AbhALItI (ORCPT ); Tue, 12 Jan 2021 03:49:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405688AbhALItI (ORCPT ); Tue, 12 Jan 2021 03:49:08 -0500 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41C3DC0617A5 for ; Tue, 12 Jan 2021 00:47:53 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id a12so1545576wrv.8 for ; Tue, 12 Jan 2021 00:47:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=5uOXbBWanfZ4W7LK+y1W9oyHc5mduS3MgBnRr/g/w2U=; b=Yd2YTOtKeNDq+jwWqRHIYxh9VgbQt9ry2f+KbyWREJ2fZLBgga1KnCDv1nLMDtzCy2 mgXbr8VtBTDbD9x9kN+ZcK/9plhxgC7Xp8MpV3NUx1XwC6D9paEO9wqmxUiO9T0W7ngz BwCEwWDz3fxp6A/EPd6NU2Z6AlEY2cVrGdtIMBQ34JISs1z6nduYNjJTTDUUwxfDmCEr tNE5wqcOZa4BBwAC2GX3FB+tiaPxevPWEM1onJDcmDSkzt7KBL0LyKDqFQ2X6XayaVN0 7/FouCTxganVQ29WcRdgeMDfkZsxOkyjY6mNfFKjR0ECwwJGRFRtX63CDLvyn/8Kq8wc CAKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=5uOXbBWanfZ4W7LK+y1W9oyHc5mduS3MgBnRr/g/w2U=; b=huIySEgrAUeYHEbpx71jpD9gwDNCNabfbN305aHnbeMDuSLuuxPOpVddsR2v04BNNZ m25d6VQdVIWGiFf2W4LCV4y+seOdpoUn9tg5uFJAzNzl3OHORrN+b4rBFCUFkrolEk5x R8Yi8t9NZnQ0ivYSRz8DwcJcj+hzAuvLioLN4JWTpcCKoZ7GCSTpUS4KqzX6io6ZIJQ9 4Sz+Hme7JG395k1pvw97DAfle1w1FQ2048Q16+a/dRjsGJq7dIqGVUtyUQ69Llu5e1XL mOUpjkfdCHEd2IJEPxWiyixrUPP5I0RhA+NQjhSU4G9qqgFlbh/howUTbAVsZDMi76Pd lfEg== X-Gm-Message-State: AOAM530fJeNgHjM/Jq+XXcHx7GrWP4aBUDZV0+M0T1ycvY20QwpfKXlk WeLiRUmKm759Fvb1rh/gCC6ursF55gY= X-Google-Smtp-Source: ABdhPJzg2TB5+yBVhA83rWI+RENfqqBN5afHqllrrfYvHzvJ4gRKePAegmhS/jGN4fC5Nlyx3BEQpQ== X-Received: by 2002:adf:a495:: with SMTP id g21mr3230947wrb.198.1610441271752; Tue, 12 Jan 2021 00:47:51 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id q15sm3456161wrw.75.2021.01.12.00.47.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 00:47:51 -0800 (PST) Message-Id: <82e38c68f4406cb5bbaea3b4102b33097e29ea67.1610441263.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 12 Jan 2021 08:47:39 +0000 Subject: [PATCH 08/11] t6301: do not expect the output of `for-each-ref` to be translated Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41j?= Duy , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= , SZEDER =?utf-8?b?R8OhYm9y?= , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin The `test_i18ncmp` function is reserved for output that we expect to be translated. Signed-off-by: Johannes Schindelin --- t/t6301-for-each-ref-errors.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t6301-for-each-ref-errors.sh b/t/t6301-for-each-ref-errors.sh index 809854fc0ce..0cf2a41c26c 100755 --- a/t/t6301-for-each-ref-errors.sh +++ b/t/t6301-for-each-ref-errors.sh @@ -20,7 +20,7 @@ test_expect_success 'Broken refs are reported correctly' ' test_when_finished "rm -f .git/$r" && echo "warning: ignoring broken ref $r" >broken-err && git for-each-ref >out 2>err && - test_i18ncmp full-list out && + test_cmp full-list out && test_i18ncmp broken-err err ' From patchwork Tue Jan 12 08:47:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12012791 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7500AC4332D for ; Tue, 12 Jan 2021 08:49:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 28CD722E00 for ; Tue, 12 Jan 2021 08:49:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405703AbhALItP (ORCPT ); Tue, 12 Jan 2021 03:49:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405681AbhALItO (ORCPT ); Tue, 12 Jan 2021 03:49:14 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F11EBC0617A6 for ; Tue, 12 Jan 2021 00:47:53 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id 3so1262371wmg.4 for ; Tue, 12 Jan 2021 00:47:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=xz55P/En6olgyu71iHfy6aERihi8PJcXRqGmfbltiuk=; b=gTV0+Jq+R8fE56FmvQDaNU/HdMHSETNIuWLnQfR9/l4Yaf+0PDpLKcv2NnUkdlO7Ji L4a3wWq02XaH/EXvNJtSJRKCNJJE6goVPWbXTn7KZLV1yso8lsEmKkQBeW0Ts3FDd/cV yjqv9/c1oLdgOTaniqFJBEcXgtRh3vVHbbpeNkM/SKjj/2Nps9SuSftOc4Zb/oOpEk07 6sgvss6tGoxW+e6r85SZ0gs2Zxgjef6xf0CrPFJ8LQqjt7nb8h5JD2BSmsp4nYrRuX4p ROCXtrnByNcDRHrRykxauElK6Q4XQEKWKSjZDkLzOPECo6EPP0g0p4h7EjsxHaeEm0zw vuFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=xz55P/En6olgyu71iHfy6aERihi8PJcXRqGmfbltiuk=; b=NZCmpAPRnneTAU09k3BNVY2DsnFSN1LwhfrLUbqn6LBQqVR4Qppn9R+RLxhb7CkxEg WCx11QY4AfYyvEZPq5PuAUN3JJbPTVAUebUFSxGtYZv6LksQiJ5bELUtIttRR2wWxL23 9MCf/UboIJasUz0TE0P0SIzfo+P1CVtJyKMrVBkRBiJeU2LSWR463p0SVg6jX97Qn2lU TA+SrnNgC14/lqCHr0PDj+9D5H8u421YwwAC+fPtyF71ZScXiVP30lLUkZDEb1m27vP0 4x/sm82KAe4HiHdn6nCCuztB5PEuG9QCQ5D9S50MMmAlLrTMC2Swnyb14ZwyXwRSsigZ ZlsA== X-Gm-Message-State: AOAM531qaGk7VcgJmdxv4vYRCwbEppD9EhaZDEQk+uaD/90Ufcmw66dz AHEkkAG4UPB4b0mXe6qDLjcXtbsbTcw= X-Google-Smtp-Source: ABdhPJxZQWw3QlsmgQzY8LUmW9aZp30aEkLfP5zTWWY9a0xZGJKTIg00M6GHMOjZG8HiqiFANJ52Lg== X-Received: by 2002:a1c:2bc2:: with SMTP id r185mr2389321wmr.13.1610441272465; Tue, 12 Jan 2021 00:47:52 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id y63sm3033834wmd.21.2021.01.12.00.47.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 00:47:52 -0800 (PST) Message-Id: <4669ccbb1ae40f0c58a2d8e3c8b3a34d82176c7a.1610441263.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 12 Jan 2021 08:47:40 +0000 Subject: [PATCH 09/11] GETTEXT_POISON=rot13: do compare the output in `test_i18ncmp` Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41j?= Duy , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= , SZEDER =?utf-8?b?R8OhYm9y?= , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin Signed-off-by: Johannes Schindelin --- Makefile | 1 + t/helper/test-i18n.c | 89 +++++++++++++++++++++++++++++++++++++++++ t/helper/test-tool.c | 1 + t/helper/test-tool.h | 1 + t/test-lib-functions.sh | 8 +++- t/test-lib.sh | 1 + 6 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 t/helper/test-i18n.c diff --git a/Makefile b/Makefile index 7b64106930a..d49f80cb524 100644 --- a/Makefile +++ b/Makefile @@ -710,6 +710,7 @@ TEST_BUILTINS_OBJS += test-genzeros.o TEST_BUILTINS_OBJS += test-hash-speed.o TEST_BUILTINS_OBJS += test-hash.o TEST_BUILTINS_OBJS += test-hashmap.o +TEST_BUILTINS_OBJS += test-i18n.o TEST_BUILTINS_OBJS += test-index-version.o TEST_BUILTINS_OBJS += test-json-writer.o TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o diff --git a/t/helper/test-i18n.c b/t/helper/test-i18n.c new file mode 100644 index 00000000000..4b572e6efad --- /dev/null +++ b/t/helper/test-i18n.c @@ -0,0 +1,89 @@ +#include "test-tool.h" +#include "cache.h" + +static const char *usage_msg = "\n" +" test-tool i18n cmp \n"; + +static inline char do_rot13(char c) +{ + if (c >= 'a' && c <= 'm') + return c + 'n' - 'a'; + if (c >= 'n' && c <= 'z') + return c + 'a' - 'n'; + if (c >= 'A' && c <= 'M') + return c + 'N' - 'A'; + if (c >= 'N' && c <= 'Z') + return c + 'A' - 'N'; + return c; +} + +static size_t unrot13(char *buf) +{ + char *p = buf, *q = buf; + + while (*p) { + const char *begin = strstr(p, ""), *end; + + if (!begin) + break; + + while (p != begin) + *(q++) = *(p++); + + p += strlen(""); + end = strstr(p, ""); + if (!end) + BUG("could not find in\n%s", buf); + + while (p != end) + *(q++) = do_rot13(*(p++)); + p += strlen(""); + } + + while (*p) + *(q++) = *(p++); + + return q - buf; +} + +static void unrot13_strbuf(struct strbuf *buf) +{ + size_t len = unrot13(buf->buf); + + if (len == buf->len) + die("not ROT13'ed:\n%s", buf->buf); + buf->len = len; +} + +static int i18n_cmp(const char **argv) +{ + const char *path1 = *(argv++), *path2 = *(argv++); + struct strbuf a = STRBUF_INIT, b = STRBUF_INIT; + + if (!path1 || !path2 || *argv) + usage(usage_msg); + + if (strbuf_read_file(&a, path1, 0) < 0) + die_errno("could not read %s", path1); + if (strbuf_read_file(&b, path2, 0) < 0) + die_errno("could not read %s", path2); + unrot13_strbuf(&b); + + if (a.len != b.len || memcmp(a.buf, b.buf, a.len)) + return 1; + + return 0; +} + +int cmd__i18n(int argc, const char **argv) +{ + argv++; + if (!*argv) + usage(usage_msg); + if (!strcmp(*argv, "cmp")) + return i18n_cmp(argv+1); + else + usage(usage_msg); + + return 0; +} diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c index 9d6d14d9293..7e1680ac108 100644 --- a/t/helper/test-tool.c +++ b/t/helper/test-tool.c @@ -34,6 +34,7 @@ static struct test_cmd cmds[] = { { "genzeros", cmd__genzeros }, { "hashmap", cmd__hashmap }, { "hash-speed", cmd__hash_speed }, + { "i18n", cmd__i18n }, { "index-version", cmd__index_version }, { "json-writer", cmd__json_writer }, { "lazy-init-name-hash", cmd__lazy_init_name_hash }, diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h index a6470ff62c4..43282a520ea 100644 --- a/t/helper/test-tool.h +++ b/t/helper/test-tool.h @@ -24,6 +24,7 @@ int cmd__genrandom(int argc, const char **argv); int cmd__genzeros(int argc, const char **argv); int cmd__hashmap(int argc, const char **argv); int cmd__hash_speed(int argc, const char **argv); +int cmd__i18n(int argc, const char **argv); int cmd__index_version(int argc, const char **argv); int cmd__json_writer(int argc, const char **argv); int cmd__lazy_init_name_hash(int argc, const char **argv); diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index 999982fe4a9..08731bae854 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -993,7 +993,13 @@ test_cmp_bin () { # under GIT_TEST_GETTEXT_POISON this pretends that the command produced expected # results. test_i18ncmp () { - ! test_have_prereq C_LOCALE_OUTPUT || test_cmp "$@" + if test rot13 = "$GIT_TEST_GETTEXT_POISON" + then + test-tool i18n cmp "$@" + elif test_have_prereq C_LOCALE_OUTPUT + then + test_cmp "$@" + fi } # Use this instead of "grep expected-string actual" to see if the diff --git a/t/test-lib.sh b/t/test-lib.sh index 9fa7c1d0f6d..c9f9e2804fd 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -1537,6 +1537,7 @@ then fi test_lazy_prereq C_LOCALE_OUTPUT ' + test rot13 != "$GIT_TEST_GETTEXT_POISON" && ! test_bool_env GIT_TEST_GETTEXT_POISON false ' From patchwork Tue Jan 12 08:47:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12012789 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 425CEC4332B for ; Tue, 12 Jan 2021 08:49:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F193622D58 for ; Tue, 12 Jan 2021 08:49:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405706AbhALItP (ORCPT ); Tue, 12 Jan 2021 03:49:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405698AbhALItO (ORCPT ); Tue, 12 Jan 2021 03:49:14 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4391C0617A7 for ; Tue, 12 Jan 2021 00:47:54 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id r7so1558408wrc.5 for ; Tue, 12 Jan 2021 00:47:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=NU5cRWKPa7y72/DAFZ0IkJ1rHgTHjR0ZzUrJGlMlpPc=; b=DWH3Gu2SOuLILdNezAXyAY7a5Zd2qzdtTHTJA3fqRbCgpc46/pR/sUk+nQW7yV7WRI 5RBRFDWEGUw5/WTMXDMdW5DHwzAiNda/0Z9t3mr/bitvw7VmPyPSbSnXFLV9d37kLk8s u5d3H+OqdeD+Vyo2VukMdbccR6ai17LCz1JvFrDRF2+pdkgCYblI9IsYXDtTCFWkWN0C /hr468GchNorpLMWENlYXNdY/jdBNRfV37bcejhcKbPtNAuj8GACZlC55DUm4hJnTBN+ /SH+1XbtsJL/u+9tCifllupnJf1U9R89Wh3ZD8WKLFasC7x9m1Wt3hlSp/SXYSJkOHup uTZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=NU5cRWKPa7y72/DAFZ0IkJ1rHgTHjR0ZzUrJGlMlpPc=; b=Uiadoxwoopb6kxSOMU4XEMVXvtb0cCHix/yXZLJi0nk13/DaoN5+nGZcwd6TfnBs2C F0JDhtuBjZB1j0O9uRQnFLvXzXqYrUqTLzZ/owB7rNeESbr7a2ujcPIDzyYamJFHt3to PeI3jGO4vuNs6voajfvvkb6JdNbGItjRS05GqpQITj4uGFzPL55QAzUwSaiFIJMrpoHY Z2skj5JrbCJ/lIKDcaSfqO8wHCPA1uqIxbJWcdJFlO54pL/IcFVjYYHTdXZcbSdtq2P8 Uln57BwG7n1aplx8hPjvaMDltqvzk3yzYe4/9mFfvo9TPhqJNICjXy5V0uPyI65eStz6 KuPA== X-Gm-Message-State: AOAM533o5A2AkVHj4t+81eYQmbNn8SMy78tu3y8VdDq3gyFcKgYR0wyc 3/QAxAGJ0Jx2ytKIHkzX9aiZUL+kkK4= X-Google-Smtp-Source: ABdhPJzERHDziXVDH+KssatenSJ0bxX4yCDvwe9ycpFeNu/xEbx1JKkB6cjbqz60VhYpK73fjXPUng== X-Received: by 2002:adf:9d48:: with SMTP id o8mr3117936wre.408.1610441273385; Tue, 12 Jan 2021 00:47:53 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id j7sm2867346wmb.40.2021.01.12.00.47.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 00:47:52 -0800 (PST) Message-Id: <0a56ebfcad79a03a6a8701db367cabb7953a5fa4.1610441263.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 12 Jan 2021 08:47:41 +0000 Subject: [PATCH 10/11] GETTEXT_POISON=rot13: perform actual checks in `test_i18ngrep` Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41j?= Duy , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= , SZEDER =?utf-8?b?R8OhYm9y?= , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin Signed-off-by: Johannes Schindelin --- t/helper/test-i18n.c | 42 ++++++++++++++++++++++++++++++++++++++++- t/test-lib-functions.sh | 6 ++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/t/helper/test-i18n.c b/t/helper/test-i18n.c index 4b572e6efad..8a16df6b40f 100644 --- a/t/helper/test-i18n.c +++ b/t/helper/test-i18n.c @@ -1,8 +1,10 @@ #include "test-tool.h" #include "cache.h" +#include "grep.h" static const char *usage_msg = "\n" -" test-tool i18n cmp \n"; +" test-tool i18n cmp \n" +" test-tool i18n grep \n"; static inline char do_rot13(char c) { @@ -75,6 +77,42 @@ static int i18n_cmp(const char **argv) return 0; } +static int i18n_grep(const char **argv) +{ + int dont_match = 0; + const char *pattern, *path; + + struct grep_opt opt; + struct grep_source source; + struct strbuf buf = STRBUF_INIT; + int hit; + + if (*argv && !strcmp("!", *argv)) { + dont_match = 1; + argv++; + } + + pattern = *(argv++); + path = *(argv++); + + if (!pattern || !path || *argv) + usage(usage_msg); + + grep_init(&opt, the_repository, NULL); + append_grep_pattern(&opt, pattern, "command line", 0, GREP_PATTERN); + compile_grep_patterns(&opt); + + if (strbuf_read_file(&buf, path, 0) < 0) + die_errno("could not read %s", path); + unrot13_strbuf(&buf); + grep_source_init(&source, GREP_SOURCE_BUF, path, path, path); + source.buf = buf.buf; + source.size = buf.len; + hit = grep_source(&opt, &source); + strbuf_release(&buf); + return dont_match ^ !hit; +} + int cmd__i18n(int argc, const char **argv) { argv++; @@ -82,6 +120,8 @@ int cmd__i18n(int argc, const char **argv) usage(usage_msg); if (!strcmp(*argv, "cmp")) return i18n_cmp(argv+1); + else if (!strcmp(*argv, "grep")) + return i18n_grep(argv+1); else usage(usage_msg); diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index 08731bae854..394fd2ef5be 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -1021,6 +1021,12 @@ test_i18ngrep () { if test_have_prereq !C_LOCALE_OUTPUT then + if test rot13 = "$GIT_TEST_GETTEXT_POISON" + then + test-tool i18n grep "$@" + return $? + fi + # pretend success return 0 fi From patchwork Tue Jan 12 08:47:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12012793 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 816FBC43331 for ; Tue, 12 Jan 2021 08:49:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5339922D58 for ; Tue, 12 Jan 2021 08:49:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405709AbhALItQ (ORCPT ); Tue, 12 Jan 2021 03:49:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405699AbhALItO (ORCPT ); Tue, 12 Jan 2021 03:49:14 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87F7FC0617A9 for ; Tue, 12 Jan 2021 00:47:55 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id g25so1314932wmh.1 for ; Tue, 12 Jan 2021 00:47:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=icji/igcsvhiwJIIPQNHaIgzkWyPjYmr92cDv4xCqO8=; b=pzCa3rzzXtdJz2wILAag/IfspOdnYdzSaXLZKsHLNcTlGYjomrFzuU7Ca//PiuNiLC Zppmy9vHuRXRDr3xW0Oghr7w7/YFIQin2MLHf1BTGKRPlQxa2VDTgGVrBnNAwd9TTclZ MgKkdZCccpuMe0czZ+vpezBTfKaDLR1lJ6XTD/MeWV52JtU0u5cKdF7SK3Hr3EMnZIJ0 Z1iIP/Q55gg9EVQteTidIYc96g8M+ToihbJQzJamhylUCQQ3/Kvb5k2rG9Gv6bC+LUG2 BdTjAHPvz5p5vAm6JPMIspqkRLbDNLfZliaACkDaKFl9yh5CmU0Tu/KmNFuXZ3RfLKA4 pCkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=icji/igcsvhiwJIIPQNHaIgzkWyPjYmr92cDv4xCqO8=; b=pJpudSHw2+BPJyMKwUYQ5y6SWAeHmTz5WUM6hb7FWx3gftTYskLKAcIaZ+PboXWnCq ec9D7eFTntkcTNixhQhGtR8dXl7jm/glTmdcyOXlJuuBAmfaFbi5Ru4k9ruWk2mAin/c TOuFVNgla6ST5DF4kLQidc4xp6cytsb8qnv5YVqnu9XkCcCVZE9jkPcYldX8ovIXshMB G0e91mB3lBgWyXvIt5SUCT3lZMds3SmWqT9HlxOHMiCLiJJ/Vu5yP11z7YydwGpLamAa Zk3dgODC8I3LS3MLRFYwUCmxuQUKwhUtrWGBt7WGDQX5W+Vfhthp1my9nQNiJpl7EWnL spEQ== X-Gm-Message-State: AOAM533zUFtrHipBF5iHKsS7Gpn6WY6MCVQrfI6181oI4g0kmJN+h1ZJ ZWvd0wPpg1qhP86KZiezYjiG/YpcXLE= X-Google-Smtp-Source: ABdhPJwDoE/CCDuf5D40+4NjR2apoi9XQCXq3ks3cictXPjes/sRiP90/TazxjXoxNp9tWe6xxY6Eg== X-Received: by 2002:a1c:4c14:: with SMTP id z20mr2476012wmf.149.1610441274134; Tue, 12 Jan 2021 00:47:54 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id j2sm3817332wrh.78.2021.01.12.00.47.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 00:47:53 -0800 (PST) Message-Id: In-Reply-To: References: Date: Tue, 12 Jan 2021 08:47:42 +0000 Subject: [PATCH 11/11] test-tool i18n: do not complain about empty messages Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41j?= Duy , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= , SZEDER =?utf-8?b?R8OhYm9y?= , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin They might, or might not be 'translated'. Let's not assume that they aren't marked with `_()` for translation. Signed-off-by: Johannes Schindelin --- t/helper/test-i18n.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/helper/test-i18n.c b/t/helper/test-i18n.c index 8a16df6b40f..82efc66f1f5 100644 --- a/t/helper/test-i18n.c +++ b/t/helper/test-i18n.c @@ -52,7 +52,7 @@ static void unrot13_strbuf(struct strbuf *buf) { size_t len = unrot13(buf->buf); - if (len == buf->len) + if (len && len == buf->len) die("not ROT13'ed:\n%s", buf->buf); buf->len = len; }