From patchwork Wed Dec 9 20:01:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 11962431 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=-15.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,USER_AGENT_GIT 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 311CAC19425 for ; Wed, 9 Dec 2020 20:02:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F1E6323C43 for ; Wed, 9 Dec 2020 20:02:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387952AbgLIUCm (ORCPT ); Wed, 9 Dec 2020 15:02:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388060AbgLIUCj (ORCPT ); Wed, 9 Dec 2020 15:02:39 -0500 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C25DFC061793 for ; Wed, 9 Dec 2020 12:01:58 -0800 (PST) Received: by mail-wr1-x441.google.com with SMTP id r7so3087279wrc.5 for ; Wed, 09 Dec 2020 12:01:58 -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=TE/H6ocKosx2Jp2qItIeJhggW3gbgKvO2QtcAZMksw0=; b=fs968EATjmnF0Df/PjinjtHqCpZMuS2AuihA8sex99G4UOt/8JmXX4WBBE4vkMcAEU 7/rfcrg2jCOXDVoU195qKCbAr4AHER9CNsq9BMSpKV3d4f+L8aRN5IZn9L7KinCFB5CJ h2U0ntr9gSeACVSj/pIsZWfmRl81HVC6584lrUMCp/dx7EtcTkb1krq6PcnB/Wsx0PAe aEppmZ6sPQIa84IWYiH5Diy9ZVdqFff/I5aKq2IpLYPOwJv68iEKwcg19NIPiT8OXK8q dz9hfs2/ZN+3tJvCSG/ifu7OsgOmF0zi9Mam5fZ5iRPirzkkU0foyfEwIGBtwclhb9iK /ECQ== 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=TE/H6ocKosx2Jp2qItIeJhggW3gbgKvO2QtcAZMksw0=; b=L18Xw98jf0b+4ywY8cgvsytyxjsfTqbp5BfjQghwj4S/N2Sw7+yS0A9Ga9ETrCJdqw SvIPWXCzg98dFQsL5FNwnrxmG0LAXGhI37Lvzjkly0j0l/E6m51l1235nVqtulSL4dZd NQ/GRIS5ImLgQ0zdkcd3i4Tiy1wM0YBvWWajnLzfNHNMXe5AOC29JfAdE0WZGqRx3s+Y 9DvoFZTmeiIeqXsfuEimpXnJ51ytc4IgxU00c3g8BQhi1afv1FbztddP38Tvj018on6r O9cE91f9gGgtP5RQY33PLj2OXE7QHhp5gF4LI/fLEsIB9x0oUh4YpejMtVmuyaEDCVyk Nc9A== X-Gm-Message-State: AOAM531t9wyCYq1iPvHsE9DVYjpKI/GvWydIoB/ysrajxnSw0kDuE2Ak L9rMuYVoUd7kuUyw81bJbwl0exUtzPeXgQ== X-Google-Smtp-Source: ABdhPJz1gQ5LJBO9h74uweUbszBaOWGBXW8oX/6qWEpD68TI8FJPm0k1kx/ZkGCm+EbhHWmWziYAxA== X-Received: by 2002:adf:c40e:: with SMTP id v14mr4469948wrf.163.1607544117568; Wed, 09 Dec 2020 12:01:57 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id 34sm5762128wrh.78.2020.12.09.12.01.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Dec 2020 12:01:56 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , "brian m . carlson" , Eric Sunshine , Johannes Schindelin , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v3 01/10] mktag doc: say not Date: Wed, 9 Dec 2020 21:01:31 +0100 Message-Id: <20201209200140.29425-2-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20201126222257.5629-1-avarab@gmail.com> References: <20201126222257.5629-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change the "mktag" documentation to refer to the input hash as just "hash", not "sha1". This command has supported SHA-256 for a while now. Signed-off-by: Ævar Arnfjörð Bjarmason --- Documentation/git-mktag.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/git-mktag.txt b/Documentation/git-mktag.txt index fa6a7561236..a158428eb9f 100644 --- a/Documentation/git-mktag.txt +++ b/Documentation/git-mktag.txt @@ -23,7 +23,7 @@ Tag Format A tag signature file, to be fed to this command's standard input, has a very simple fixed format: four lines of - object + object type tag tagger From patchwork Wed Dec 9 20:01:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 11962429 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=-15.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,USER_AGENT_GIT 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 16614C4167B for ; Wed, 9 Dec 2020 20:02:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D10B523C19 for ; Wed, 9 Dec 2020 20:02:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388065AbgLIUCm (ORCPT ); Wed, 9 Dec 2020 15:02:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388061AbgLIUCl (ORCPT ); Wed, 9 Dec 2020 15:02:41 -0500 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CF58C061794 for ; Wed, 9 Dec 2020 12:02:01 -0800 (PST) Received: by mail-wr1-x444.google.com with SMTP id y17so3075958wrr.10 for ; Wed, 09 Dec 2020 12:02:00 -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=lCKf2NBbDpDsTMTjqpZ3kMR5PrX6KPli2kTefNDk+II=; b=Fi1VXLQ1wdWKYlLJl7Yiu7se3NVvAIxGK0ZQMbrhb99bfd0haWT9WY6O671aHwAbLC fGajGM6W1X+2pohUQEdgl6OT3pF7oKebrCC7VwMJK1mL1mXYt0nCMxUqooQWHqTEzKAn SlWQ9WMug6kjWGDTO8ARiPW5ezpLblWj294gXyr34pAdaVZKklMD70oevb4YoPO5lFmv KEVddcss1/0IToWNo3CKWYd37RW1ND2SkMQGXDrfxy86H+szZKtAoerSCEGBojPpki1i T8v45EcJrDzGiqo1GBEfryJkN9vP/zTed6rqKJH7aXNUAIcQCIGyt0gYMNIpTQmdCedT 6O7Q== 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=lCKf2NBbDpDsTMTjqpZ3kMR5PrX6KPli2kTefNDk+II=; b=ns43m2lqMy/f8brpVtasExvm8dvObV8dTlmZsPzjiZddgeFbU7JrxUnK8TTV+Vt/58 eA2W/vj65E5lIaCcgics1mfakvvf1akJXdCPfnPOZ/5H9BiMv18qFqLYXZAVv2PUNhe4 X3Nch7lg3QKmE/vOKqvGyiDTwC2KO2MCijkBqiSNZKSxWw/pR0SFq2te/NjHAMsz6ZAV HvijEEpx7s/sTsj6BbwtX3IHSt3XssxOQMKB2cIJT3zd68K8nGqSpPbaDuqd7J7sAmic odXW2OpuC9wgAOOundDdmJXXNnkA+0wGrqhNaAQcYowkIF2pDpoA3wSyGw73sflakIO2 uRiQ== X-Gm-Message-State: AOAM532zbjbGk64r8BO3xg+FOYQwm2vIqtK6sqP5dH1MZtEl3tlh3t2i FN/eWCG40k8Br//5NrJXRIAGDGO1O/cx1w== X-Google-Smtp-Source: ABdhPJxrXRVLt3d5JbIn6dxym5q8U+mH6MhEB7tTmfs5pidD6FWmjHXOVTaXg86AOk6Vl1167JYaKw== X-Received: by 2002:adf:e481:: with SMTP id i1mr4398254wrm.282.1607544119791; Wed, 09 Dec 2020 12:01:59 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id 34sm5762128wrh.78.2020.12.09.12.01.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Dec 2020 12:01:58 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , "brian m . carlson" , Eric Sunshine , Johannes Schindelin , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v3 02/10] mktag: use default strbuf_read() hint Date: Wed, 9 Dec 2020 21:01:32 +0100 Message-Id: <20201209200140.29425-3-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20201126222257.5629-1-avarab@gmail.com> References: <20201126222257.5629-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change the hardcoded hint of 2^12 to 0. The default strbuf hint is perfectly fine here, and the only reason we were hardcoding it is because it survived migration from a pre-strbuf fixed-sized buffer. See fd17f5b5f77 (Replace all read_fd use with strbuf_read, and get rid of it., 2007-09-10) for that migration. Signed-off-by: Ævar Arnfjörð Bjarmason --- builtin/mktag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/mktag.c b/builtin/mktag.c index 4982d3a93ef..ff7ac8e0e5d 100644 --- a/builtin/mktag.c +++ b/builtin/mktag.c @@ -161,7 +161,7 @@ int cmd_mktag(int argc, const char **argv, const char *prefix) if (argc != 1) usage("git mktag"); - if (strbuf_read(&buf, 0, 4096) < 0) { + if (strbuf_read(&buf, 0, 0) < 0) { die_errno("could not read from stdin"); } From patchwork Wed Dec 9 20:01:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 11962433 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=-15.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,USER_AGENT_GIT 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 2754CC4361B for ; Wed, 9 Dec 2020 20:03:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EFC7F23BEF for ; Wed, 9 Dec 2020 20:03:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387595AbgLIUC7 (ORCPT ); Wed, 9 Dec 2020 15:02:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387945AbgLIUCm (ORCPT ); Wed, 9 Dec 2020 15:02:42 -0500 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4971AC06179C for ; Wed, 9 Dec 2020 12:02:02 -0800 (PST) Received: by mail-wm1-x341.google.com with SMTP id g185so2992700wmf.3 for ; Wed, 09 Dec 2020 12:02: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=g0UJ+359V/LQdHfLW7yM0GtnBSIOEuMSuU1g6/NH5NI=; b=AS/mL7wxqGCIiUC6zsnTQS0oL8mUMtj+52OT9D1rtEQuRBcF8aCLGoUWduhblre4ED hllxFUJiYGrjF4z644ppChC5tNefDFo7J9Eggig0DEGOhq+2DY0+/BJIY+OOBWt1foNE FPXV9qtc74ZPJa3Da5DazHaGhg0nbOXMGjjW2KCSm+VuAASAgp321zOxHsTDdTXbxj1G Ov/yiFL3CWGobQCmlKcP8CSgZVbKa+WhwvhzWuq0rYYYXpgmwPwyIRAU9iil/aNOdPYp BETOb47Hmq84oq9ykG6p+AVrfEsAsDnpAuhq/S9t86kggqDYZrb5MM0qMtwCeVzXyge3 eOWQ== 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=g0UJ+359V/LQdHfLW7yM0GtnBSIOEuMSuU1g6/NH5NI=; b=CYfustSUdFqhf2FGgnAdRT/LMSusx5V5aTOeMLXUNFxw/DBK3HTMnXxo+SwShTwE6x zqeyQUIC8wlcXD4QYCPxAwfs76WNm5tUgj+z0axDuwQk7wIkyPGlLTshZ5gkIZSuN/LY rklSNehbpwIAY0OKdXbm3gM2MuT8zw5i/L40p4qJLYqQz9Qua0Ey2mpouwTtn7WpgtZF OCwkJC0VvVXhkNNUu9dz3lNCifUHD9m+JpX+Jo7CFdtkLXXfiOvyF7fMFpVENj0MMzeC gAYganWGSU14zvRiXcS+BMVWzoEQGJg6AkF0cnAyRIEz1wnqegpuGgdYk4/pc4w2loYS mKWg== X-Gm-Message-State: AOAM533Tb9H8nCzN/YWiHYHY11ivxGVBS4p1Gr6QCRk1OMl4WsfYt85r TngivxPgVH5wCq3KJ/NKLWzG2jlubId+iw== X-Google-Smtp-Source: ABdhPJyMEj4EjXigS3U7/6aQNSsb+AK5IDtPx4b2qMbYrVQ8QuHrq6hXaLs2oj/BxniazJytZhONWA== X-Received: by 2002:a7b:c385:: with SMTP id s5mr4461908wmj.170.1607544121075; Wed, 09 Dec 2020 12:02:01 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id 34sm5762128wrh.78.2020.12.09.12.01.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Dec 2020 12:02:00 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , "brian m . carlson" , Eric Sunshine , Johannes Schindelin , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v3 03/10] mktag: remove redundant braces in one-line body "if" Date: Wed, 9 Dec 2020 21:01:33 +0100 Message-Id: <20201209200140.29425-4-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20201126222257.5629-1-avarab@gmail.com> References: <20201126222257.5629-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org This minor stylistic churn is usually something we'd avoid, but if we don't do this then the file after changes in subsequent commits will only have this minor style inconsistency, so let's change this while we're at it. Signed-off-by: Ævar Arnfjörð Bjarmason --- builtin/mktag.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/builtin/mktag.c b/builtin/mktag.c index ff7ac8e0e5d..97ca5f28b1b 100644 --- a/builtin/mktag.c +++ b/builtin/mktag.c @@ -161,9 +161,8 @@ int cmd_mktag(int argc, const char **argv, const char *prefix) if (argc != 1) usage("git mktag"); - if (strbuf_read(&buf, 0, 0) < 0) { + if (strbuf_read(&buf, 0, 0) < 0) die_errno("could not read from stdin"); - } /* Verify it for some basic sanity: it needs to start with "object \ntype\ntagger " */ From patchwork Wed Dec 9 20:01:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 11962447 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=-15.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,USER_AGENT_GIT 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 72559C47434 for ; Wed, 9 Dec 2020 20:04:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 43F7523A02 for ; Wed, 9 Dec 2020 20:04:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387962AbgLIUEK (ORCPT ); Wed, 9 Dec 2020 15:04:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729464AbgLIUC7 (ORCPT ); Wed, 9 Dec 2020 15:02:59 -0500 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DAF4C0617A6 for ; Wed, 9 Dec 2020 12:02:03 -0800 (PST) Received: by mail-wm1-x344.google.com with SMTP id k10so2622558wmi.3 for ; Wed, 09 Dec 2020 12:02:03 -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=LMaLfHsrFtR5TbYrAS2TUcw4yJ/c8dS9VHRIf5BDh/o=; b=KLCIWSD6wLRG0Ovkh1mYXihBOp+G4e2QQ8IurwXeh4DkQJf6GZtUtvCxydKz4NSpWf OaziyLWBgAwFBObYl66HsV67tVqGgI2Udpfl4bFs5tFRTZErPD4E/DBnIpzFs5/Tdvxp 3HyO6Rfdv9zxp/NJXNQAL1gZLVxyZKt6piBlN4oS2o0uKjTy+iV+iIDUxXv2IWuXKd8z JB9GpWYTUJrcBwi47l7/oMHU49eXaWEf0xUk4/B7dw7l0U6xAFH/EiIODDeN8MwFXrqO uzyDO9YySz6W026JF+ZKwpTatrEwe7VIKKBQoCtlTmnWxV85365IYKKxLkSuJ0BNjctu TKPQ== 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=LMaLfHsrFtR5TbYrAS2TUcw4yJ/c8dS9VHRIf5BDh/o=; b=Fbu/cQUoQv265JJM3V/x9S9OpkhQoGOFGqkmwacqVLr0mRVcdxBssNSqRiBUUuKqe9 VBF15qa/WjWP/3Y1eO6sQJfzsEOmZJ1IcsTj+OZ5qprR73j6J0u8exrejkYH1+sEt2xA q2KJ3vt2atecEAbgeMT/YGahKTacgeoovXnazQamzX9wKhqtcWqcDIILmF9trjLZ+L7m ZvWevHkVX/nFCq4K8k/Ow3hHmLTwjaX8TkXqd6m8+zMW9MFOao6buJiRRAqJGI6yqa9M 7h/5uCfQoacACYAL70d/nPzcHMIwmejJPDxd1vT7m3zgx416Ztw7du8GJfC5n74WgVCO 2/nA== X-Gm-Message-State: AOAM531HLzvuUqQ9f7/Aue49MhWbHm3ZUuIKvtsAGvbut9pqWhh8PvYk l5V5Q1GfyvFxWdiu4GUndwv7bGvSrfvF9Q== X-Google-Smtp-Source: ABdhPJzL21CPMnY53+/7hxf7rJBo0iy2n56rOEQvZkGWST6duk7niqgdrp8SeGWJ558cRczwq+Dbww== X-Received: by 2002:a1c:750f:: with SMTP id o15mr4494276wmc.144.1607544122229; Wed, 09 Dec 2020 12:02:02 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id 34sm5762128wrh.78.2020.12.09.12.02.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Dec 2020 12:02:01 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , "brian m . carlson" , Eric Sunshine , Johannes Schindelin , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v3 04/10] mktag tests: don't needlessly use a subshell Date: Wed, 9 Dec 2020 21:01:34 +0100 Message-Id: <20201209200140.29425-5-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20201126222257.5629-1-avarab@gmail.com> References: <20201126222257.5629-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The use of a subshell dates back to e9b20943b77 (t/t3800: do not use a temporary file to hold expected result., 2008-01-04). It's not needed anymore, if it ever was. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t3800-mktag.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t3800-mktag.sh b/t/t3800-mktag.sh index d696aa4e52e..0e411e3c45f 100755 --- a/t/t3800-mktag.sh +++ b/t/t3800-mktag.sh @@ -14,7 +14,7 @@ test_description='git mktag: tag object verify test' check_verify_failure () { expect="$2" test_expect_success "$1" ' - ( test_must_fail git mktag message ) && + test_must_fail git mktag message && grep "$expect" message ' } From patchwork Wed Dec 9 20:01:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 11962449 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=-15.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,USER_AGENT_GIT 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 56F4AC1B0D8 for ; Wed, 9 Dec 2020 20:04:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 23666239D1 for ; Wed, 9 Dec 2020 20:04:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387758AbgLIUDE (ORCPT ); Wed, 9 Dec 2020 15:03:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731863AbgLIUC7 (ORCPT ); Wed, 9 Dec 2020 15:02:59 -0500 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D716C0617A7 for ; Wed, 9 Dec 2020 12:02:04 -0800 (PST) Received: by mail-wm1-x343.google.com with SMTP id 3so2996029wmg.4 for ; Wed, 09 Dec 2020 12:02: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=r9hhnz5zwCEr+dhTPxdsHBLDZeJeUTfZCwkPbrwyGl8=; b=YhpxRvaUhJ+cBD/CID9tyr1oeV2Q0LmqaX2AJXUPrxXdrEax6soEOG0V9PESHKazDi 3Phd0u1dpGSyl+eQW5wUv6FjHaLTUMcxJgsmMwR08T2MyL4hImizwQjpRKvA64Tuz790 KH4hUfu/KDDE/gx56wRhR2Zp+QTrfwDL0l7PbC2PQFzxi2+AzZH9U2ydBttSlhnYwUni eQ0D+d1usMHcsBI9Db+ilXDM1spkPz+S6G9MQoiTre3Nu6ECt4jsEvr6CbbVC5zWUgLl lxfCU7O8n02W10xPXn7diuolFWzTjC5j3TP8Sr0PozwoyMVWqYeW+qQdNJdViYY9kKdh Bq2Q== 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=r9hhnz5zwCEr+dhTPxdsHBLDZeJeUTfZCwkPbrwyGl8=; b=ffjJGzQcd59/1GMMEp1EvbrluZAtE2c9XoK2Ih3VKQa8zKEKWBMZM6f2Yt1OCJ9be5 mu0lfzUZd34TeG+yIEhSJsk13R4PlsQ9/IPI6b4EiiHqi4oH5Kg3jB51PmsarT0C8YAm +dfIQQLQEMqhprEcw2T2tLbbpExfChsx6R5AtWSArOJTnGaR4RreB+zMENUUxq3uvtnm 3Ha1rKjsjKvkrTR5TOR7kLZs7GLqCAFP/ZpDsiVuUCdmUU8KkoJ701zWpO7GfrqZck4i qevcg6B5l2NrL5SoOY4GyAWh5JV2H6C7B96LL/3py5mnE5hgjwmCC24THnbC5uH6ZmKq +zlA== X-Gm-Message-State: AOAM5321B+b0uzruGcP243EOB+IuQEHTsmn00hxPvsXl/c24c/ULehQp +1PvZrn+c8bbQlo7CTnpgl4POU+mB1rcsQ== X-Google-Smtp-Source: ABdhPJxwAM1u8oMpfJuqu8/wQlBxENDTZS0jmnBf232e4tXc+ZOxX5Oq2vF7Q54gek63FpVGmwQ/jg== X-Received: by 2002:a05:600c:274d:: with SMTP id 13mr4488454wmw.77.1607544123310; Wed, 09 Dec 2020 12:02:03 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id 34sm5762128wrh.78.2020.12.09.12.02.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Dec 2020 12:02:02 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , "brian m . carlson" , Eric Sunshine , Johannes Schindelin , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v3 05/10] mktag tests: remove needless SHA-1 hardcoding Date: Wed, 9 Dec 2020 21:01:35 +0100 Message-Id: <20201209200140.29425-6-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20201126222257.5629-1-avarab@gmail.com> References: <20201126222257.5629-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change the tests amended in acb49d1cc8b (t3800: make hash-size independent, 2019-08-18) even more to make them independent of either SHA-1 or SHA-256. Some of these tests were failing for the wrong reasons. The first one being modified here would fail because the line starts with "xxxxxx" instead of "object", the rest of the line doesn't matter. Let's just put a valid hash on the rest of the line anyway to narrow the test down for just the s/object/xxxxxx/ case. The second one being modified here would fail under GIT_TEST_DEFAULT_HASH=sha256 because is an invalid SHA-256, but we should really be testing when under SHA-256. This doesn't really matter since we should be able to trust other parts of the code to validate things in the 0-9a-f range, but let's keep it for good measure. There's a later test which tests an invalid SHA which looks like a valid one, to stress the "We refuse to tag something we can't verify[...]" logic in mktag.c. But here we're testing for a SHA-length string which contains characters outside of the /[0-9a-f]/i set. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t3800-mktag.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/t/t3800-mktag.sh b/t/t3800-mktag.sh index 0e411e3c45f..a22a0954d5e 100755 --- a/t/t3800-mktag.sh +++ b/t/t3800-mktag.sh @@ -43,7 +43,7 @@ check_verify_failure 'Tag object length check' \ # 2. object line label check cat >tag.sig < 0 +0000 @@ -53,10 +53,10 @@ EOF check_verify_failure '"object" line label check' '^error: char0: .*"object "$' ############################################################ -# 3. object line SHA1 check +# 3. object line hash check cat >tag.sig < 0 +0000 From patchwork Wed Dec 9 20:01:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 11962435 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=-15.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,USER_AGENT_GIT 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 1ED0CC433FE for ; Wed, 9 Dec 2020 20:03:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DB3CB239D1 for ; Wed, 9 Dec 2020 20:03:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388038AbgLIUDZ (ORCPT ); Wed, 9 Dec 2020 15:03:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387598AbgLIUDU (ORCPT ); Wed, 9 Dec 2020 15:03:20 -0500 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEE7EC0617B0 for ; Wed, 9 Dec 2020 12:02:05 -0800 (PST) Received: by mail-wm1-x343.google.com with SMTP id v14so2625221wml.1 for ; Wed, 09 Dec 2020 12:02:05 -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=5HYyPIGs75GnN7uh4in8ZLCoKOZWam6NCCaOgCf/FWM=; b=QZxunmj/UvM/wk6vZQACT8Vrxq6dZvW9HZUPHNEQWI5x9h4QyJFrCZTTEMV2HY0FAl gki4VhjRW9MxiaCix86tPVZYNUQwqxqgL0t8VRLImvJ+ke9V2VDbG/9j8abppRo3citp j9MIwyVx2aijeiZY2NZH2QSed0emqEvERRdTjPoedwRewgILgMdmmmbuk3siZYUeJhyE o8aPtaDZVv+admNkmAZLENTGXtQN8E0hz6s7vc3H1JAtJ/RdIR4aNZ5QyQG9MRpZTUgT ss3/C2zEisw8lIRReosBKOm6C4I0yF55EWi2fiQVUFS43yt9K/0O7sB1aStd6RoKuovn +PGw== 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=5HYyPIGs75GnN7uh4in8ZLCoKOZWam6NCCaOgCf/FWM=; b=ZPuwXKYQ1qB+vsiG/kcnwEZwFixPXzORfMmOuby9oVo69LAyYAtlC9+YkT6VwzOXh/ I54rNOzAEPkmDUby5EjPl87UQfawJl4YkBBEz1hTtlPyOiO2II11bvf0T+NOqKIhWKIx RdGLlnII5KEuMp/4eWifALTRtQPHQyUP0VRjkZgM6TSgUxpg+C74a76+1KQGyCJAB6HG NS3oCjzs0xwXM+OtD892+asUL3dhb5dwbzTVRJt0OPC9p8e9ex5WB1+s14lssCoe6+Uc hHZAq/cjTwvo/baRYm2uPwiFdZ6aIjC3J/pkfJwC4MpH1JmDaIkx1xYm0tFkDUdUmt1S 3N2w== X-Gm-Message-State: AOAM5309Oi3Wlz2mKOCia3RqCudowKoaKQf3QGbWoFPjfN4wMOXp1l+W N2/ttjQnIyRC283wtCXw69dNt88k2B4D+w== X-Google-Smtp-Source: ABdhPJwdJmGa3+vQn6yew0SRJ4s47utRA1sF1OarhHRo9SnoFrs8LiKLZJhNUBPqpPK0v2q5CWfQ5Q== X-Received: by 2002:a1c:491:: with SMTP id 139mr4436399wme.81.1607544124520; Wed, 09 Dec 2020 12:02:04 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id 34sm5762128wrh.78.2020.12.09.12.02.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Dec 2020 12:02:03 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , "brian m . carlson" , Eric Sunshine , Johannes Schindelin , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v3 06/10] mktag tests: improve verify_object() test coverage Date: Wed, 9 Dec 2020 21:01:36 +0100 Message-Id: <20201209200140.29425-7-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20201126222257.5629-1-avarab@gmail.com> References: <20201126222257.5629-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The verify_object() function in "mktag.c" is tasked with ensuring that our tag refers to a valid object. The existing test for this might fail because it was also testing that "type taggg" didn't refer to a valid object type (it should be "type tag"), or because we referred to a valid object but got the type wrong. Let's split these tests up, so we're testing all combinations of a non-existing object and in invalid/wrong "type" lines. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t3800-mktag.sh | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/t/t3800-mktag.sh b/t/t3800-mktag.sh index a22a0954d5e..9ae1b0bb0af 100755 --- a/t/t3800-mktag.sh +++ b/t/t3800-mktag.sh @@ -125,19 +125,52 @@ check_verify_failure '"type" line type-name length check' \ '^error: char.*: type too long$' ############################################################ -# 9. verify object (SHA1/type) check +# 9. verify object (hash/type) check cat >tag.sig < 0 +0000 + +EOF + +check_verify_failure 'verify object (hash/type) check -- correct type, nonexisting object' \ + '^error: char7: could not verify object.*$' + +cat >tag.sig < 0 +0000 EOF -check_verify_failure 'verify object (SHA1/type) check' \ +check_verify_failure 'verify object (hash/type) check -- made-up type, nonexisting object' \ + '^fatal: invalid object type' + +cat >tag.sig < 0 +0000 + +EOF + +check_verify_failure 'verify object (hash/type) check -- incorrect type, valid object' \ '^error: char7: could not verify object.*$' +cat >tag.sig < 0 +0000 + +EOF + +check_verify_failure 'verify object (hash/type) check -- incorrect type, valid object' \ + '^error: char7: could not verify object' + ############################################################ # 10. verify tag-name check From patchwork Wed Dec 9 20:01:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 11962443 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=-15.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,USER_AGENT_GIT 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 56C5BC19425 for ; Wed, 9 Dec 2020 20:03:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2774E239D1 for ; Wed, 9 Dec 2020 20:03:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388067AbgLIUDd (ORCPT ); Wed, 9 Dec 2020 15:03:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387406AbgLIUDU (ORCPT ); Wed, 9 Dec 2020 15:03:20 -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 42D3FC06138C for ; Wed, 9 Dec 2020 12:02:07 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id k14so3109362wrn.1 for ; Wed, 09 Dec 2020 12:02: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=F8trs+i3LITL6QTYZiB7Ov55h/jbHy13S+L5/HMPSAo=; b=DZL+4O5z8wDpCgeb/lJX42trclBwha0kn9h4sJMKnFXOupfI99Z2clNctn7wegmstz FCcQgF3dgXrLfNk267ROK4IfU1pN1AX57OPCzX0dAXkLYiFruUahZZ1bYjkVUdqZlM8A nqr4Ob1tT14bsKZp8qOzGpdhPDQDu3nuAJk4MA0DXIru6gXQI9e2eM7+9/cnlcc55R3t ON2XgqkodwhEbfT9ILswRLSit1cQ9MV1tSR5EUhOjQ3mHw96PPS85o8+5tqo/E4/V+Tk NgRA/1SJv5mAG/J59BSXfadM8JJj1FRf/eKg3k+lgttNfCB8yTTACZLVLCzC1yotefs4 5jpA== 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=F8trs+i3LITL6QTYZiB7Ov55h/jbHy13S+L5/HMPSAo=; b=QKsij4knRTtAm0b7VxFUsX6fw+rL7+ov+WV70Ouo0QbukXI2YjP8psnX5zdS691T6H 3ZR+WdvGNwO7a/Z4BwsnREBF88v5ERJ0+aWoL/nYql21y3Xyq0ka1+gBokpLUS9rJ3i6 ymQ5PR9vqIUMSIyA7o/GbS5L0jZbyUSF18kWTD9vXNYAzyudjYKiw+k9xnCYvqcZFOtd XIjHUA5Kwt+8r6kUt2RYqCiGoO1rChVZuBK+Q+np9RIuHg9Kw8hGiruAiZ210U/Pk/Gl f02f5Y/+10nxJ3SJdb9gvACtfRNgQo/h2FJc5hlVcYKLbAhfb1Z6sQnRNh/crMYL/+m7 GMwg== X-Gm-Message-State: AOAM530e9tuIC3Jf2qSuQz74SpN2gxDyZRO/vXJ1LMIzvBqCYV/pgChp xi/UP33o2Y/+Ul+4WiWiN1Ms5dHZcK36vA== X-Google-Smtp-Source: ABdhPJzvjz6ZZg2QwA2/3xiD27TDsnsz8sQEIR151hpWj6yOB88L41oAnkoyJTd6pEeqaI8P6SkENQ== X-Received: by 2002:adf:dc84:: with SMTP id r4mr4356831wrj.232.1607544125819; Wed, 09 Dec 2020 12:02:05 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id 34sm5762128wrh.78.2020.12.09.12.02.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Dec 2020 12:02:04 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , "brian m . carlson" , Eric Sunshine , Johannes Schindelin , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v3 07/10] mktag: use fsck instead of custom verify_tag() Date: Wed, 9 Dec 2020 21:01:37 +0100 Message-Id: <20201209200140.29425-8-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20201126222257.5629-1-avarab@gmail.com> References: <20201126222257.5629-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change the validation logic in "mktag" to use fsck's fsck_tag() instead of its own custom parser. Curiously the logic for both dates back to the same commit[1]. Let's unify them so we're not maintaining two sets functions to verify that a tag is OK. The behavior of fsck_tag() and the old "mktag" code being removed here is different in few aspects. I think it makes sense to remove some of those checks, namely: A. fsck only cares that the timezone matches [-+][0-9]{4}. The mktag code disallowed values larger than 1400. Yes there's currently no timezone with a greater offset[2], but since we allow any number of non-offical timezones (e.g. +1234) passing this through seems fine. Git also won't break in the future if e.g. French Polynesia decides it needs to outdo the Line Islands when it comes to timezone extravagance. B. fsck allows missing author names such as "tagger ", mktag wouldn't, but would allow e.g. "tagger [2 spaces] " (but not "tagger [1 space] "). Now we allow all of these. C. Like B, but "mktag" disallowed spaces in the part, fsck allows it. In some ways fsck_tag() is stricter than "mktag" was, namely: D. fsck disallows zero-padded dates, but mktag didn't care. So e.g. the timestamp "0000000000 +0000" produces an error now. A test in "t1006-cat-file.sh" relied on this, it's been changed to use "hash-object" (without fsck) instead. There was one check I deemed worth keeping by porting it over to fsck_tag(): E. "mktag" did not allow any custom headers, and by extension (as an empty commit is allowed) also forbade an extra stray trailing newline after the headers it knew about. Add a new check in the "ignore" category to fsck and use it. This somewhat abuses the facility added in efaba7cc77f (fsck: optionally ignore specific fsck issues completely, 2015-06-22). This is somewhat of hack, but probably the least invasive change we can make here. The fsck command will shuffle these categories around, e.g. under --strict the "info" becomes a "warn" and "warn" becomes "error". Existing users of fsck's (and others, e.g. index-pack) --strict option rely on this. So we need to put something into a category that'll be ignored by all existing users of the API. Pretending that fsck.extraHeaderEntry=error ("ignore" by default) was set serves to do this for us. 1. ec4465adb38 (Add "tag" objects that can be used to sign other objects., 2005-04-25) 2. https://en.wikipedia.org/wiki/List_of_UTC_time_offsets Signed-off-by: Ævar Arnfjörð Bjarmason --- builtin/mktag.c | 196 +++++++++++--------------------------------- fsck.c | 32 +++++++- fsck.h | 9 ++ t/t1006-cat-file.sh | 2 +- t/t3800-mktag.sh | 79 +++++++++++------- 5 files changed, 137 insertions(+), 181 deletions(-) diff --git a/builtin/mktag.c b/builtin/mktag.c index 97ca5f28b1b..5765cde0032 100644 --- a/builtin/mktag.c +++ b/builtin/mktag.c @@ -2,160 +2,60 @@ #include "tag.h" #include "replace-object.h" #include "object-store.h" +#include "fsck.h" -/* - * A signature file has a very simple fixed format: four lines - * of "object " + "type " + "tag " + - * "tagger ", followed by a blank line, a free-form tag - * message and a signature block that git itself doesn't care about, - * but that can be verified with gpg or similar. - * - * The first four lines are guaranteed to be at least 83 bytes: - * "object \n" is 48 bytes, "type tag\n" at 9 bytes is the - * shortest possible type-line, "tag .\n" at 6 bytes is the shortest - * single-character-tag line, and "tagger . <> 0 +0000\n" at 20 bytes is - * the shortest possible tagger-line. - */ - -/* - * We refuse to tag something we can't verify. Just because. - */ -static int verify_object(const struct object_id *oid, const char *expected_type) +static int mktag_fsck_error_func(struct fsck_options *o, + const struct object_id *oid, + enum object_type object_type, + int msg_type, const char *message) { - int ret = -1; - enum object_type type; - unsigned long size; - void *buffer = read_object_file(oid, &type, &size); - const struct object_id *repl = lookup_replace_object(the_repository, oid); - - if (buffer) { - if (type == type_from_string(expected_type)) { - ret = check_object_signature(the_repository, repl, - buffer, size, - expected_type); - } - free(buffer); + switch (msg_type) { + case FSCK_WARN: + case FSCK_ERROR: + /* + * We treat both warnings and errors as errors, things + * like missing "tagger" lines are "only" warnings + * under fsck, we've always considered them an error. + */ + fprintf_ln(stderr, "error: tag input does not pass fsck: %s", message); + return 1; + default: + BUG("%d (FSCK_IGNORE?) should never trigger this callback", + msg_type); } - return ret; } -static int verify_tag(char *buffer, unsigned long size) +static int verify_object_in_tag(struct object_id *tagged_oid, int *tagged_type) { - int typelen; - char type[20]; - struct object_id oid; - const char *object, *type_line, *tag_line, *tagger_line, *lb, *rb, *p; - size_t len; - - if (size < 84) - return error("wanna fool me ? you obviously got the size wrong !"); - - buffer[size] = 0; - - /* Verify object line */ - object = buffer; - if (memcmp(object, "object ", 7)) - return error("char%d: does not start with \"object \"", 0); - - if (parse_oid_hex(object + 7, &oid, &p)) - return error("char%d: could not get SHA1 hash", 7); - - /* Verify type line */ - type_line = p + 1; - if (memcmp(type_line - 1, "\ntype ", 6)) - return error("char%d: could not find \"\\ntype \"", 47); - - /* Verify tag-line */ - tag_line = strchr(type_line, '\n'); - if (!tag_line) - return error("char%"PRIuMAX": could not find next \"\\n\"", - (uintmax_t) (type_line - buffer)); - tag_line++; - if (memcmp(tag_line, "tag ", 4) || tag_line[4] == '\n') - return error("char%"PRIuMAX": no \"tag \" found", - (uintmax_t) (tag_line - buffer)); - - /* Get the actual type */ - typelen = tag_line - type_line - strlen("type \n"); - if (typelen >= sizeof(type)) - return error("char%"PRIuMAX": type too long", - (uintmax_t) (type_line+5 - buffer)); - - memcpy(type, type_line+5, typelen); - type[typelen] = 0; - - /* Verify that the object matches */ - if (verify_object(&oid, type)) - return error("char%d: could not verify object %s", 7, oid_to_hex(&oid)); - - /* Verify the tag-name: we don't allow control characters or spaces in it */ - tag_line += 4; - for (;;) { - unsigned char c = *tag_line++; - if (c == '\n') - break; - if (c > ' ') - continue; - return error("char%"PRIuMAX": could not verify tag name", - (uintmax_t) (tag_line - buffer)); - } - - /* Verify the tagger line */ - tagger_line = tag_line; - - if (memcmp(tagger_line, "tagger ", 7)) - return error("char%"PRIuMAX": could not find \"tagger \"", - (uintmax_t) (tagger_line - buffer)); - - /* - * Check for correct form for name and email - * i.e. " <" followed by "> " on _this_ line - * No angle brackets within the name or email address fields. - * No spaces within the email address field. - */ - tagger_line += 7; - if (!(lb = strstr(tagger_line, " <")) || !(rb = strstr(lb+2, "> ")) || - strpbrk(tagger_line, "<>\n") != lb+1 || - strpbrk(lb+2, "><\n ") != rb) - return error("char%"PRIuMAX": malformed tagger field", - (uintmax_t) (tagger_line - buffer)); - - /* Check for author name, at least one character, space is acceptable */ - if (lb == tagger_line) - return error("char%"PRIuMAX": missing tagger name", - (uintmax_t) (tagger_line - buffer)); - - /* timestamp, 1 or more digits followed by space */ - tagger_line = rb + 2; - if (!(len = strspn(tagger_line, "0123456789"))) - return error("char%"PRIuMAX": missing tag timestamp", - (uintmax_t) (tagger_line - buffer)); - tagger_line += len; - if (*tagger_line != ' ') - return error("char%"PRIuMAX": malformed tag timestamp", - (uintmax_t) (tagger_line - buffer)); - tagger_line++; - - /* timezone, 5 digits [+-]hhmm, max. 1400 */ - if (!((tagger_line[0] == '+' || tagger_line[0] == '-') && - strspn(tagger_line+1, "0123456789") == 4 && - tagger_line[5] == '\n' && atoi(tagger_line+1) <= 1400)) - return error("char%"PRIuMAX": malformed tag timezone", - (uintmax_t) (tagger_line - buffer)); - tagger_line += 6; - - /* Verify the blank line separating the header from the body */ - if (*tagger_line != '\n') - return error("char%"PRIuMAX": trailing garbage in tag header", - (uintmax_t) (tagger_line - buffer)); + int ret; + enum object_type type; + unsigned long size; + void *buffer; + const struct object_id *repl; + + buffer = read_object_file(tagged_oid, &type, &size); + if (!buffer) + die("could not read tagged object '%s'\n", + oid_to_hex(tagged_oid)); + if (type != *tagged_type) + die("object '%s' tagged as '%s', but is a '%s' type\n", + oid_to_hex(tagged_oid), + type_name(*tagged_type), type_name(type)); + + repl = lookup_replace_object(the_repository, tagged_oid); + ret = check_object_signature(the_repository, repl, + buffer, size, type_name(*tagged_type)); + free(buffer); - /* The actual stuff afterwards we don't care about.. */ - return 0; + return ret; } int cmd_mktag(int argc, const char **argv, const char *prefix) { struct strbuf buf = STRBUF_INIT; + struct fsck_options fsck_options = FSCK_OPTIONS_STRICT; + struct object_id tagged_oid; + int tagged_type; struct object_id result; if (argc != 1) @@ -164,10 +64,14 @@ int cmd_mktag(int argc, const char **argv, const char *prefix) if (strbuf_read(&buf, 0, 0) < 0) die_errno("could not read from stdin"); - /* Verify it for some basic sanity: it needs to start with - "object \ntype\ntagger " */ - if (verify_tag(buf.buf, buf.len) < 0) - die("invalid tag signature file"); + fsck_options.error_func = mktag_fsck_error_func; + fsck_set_msg_type(&fsck_options, "extraheaderentry", "warn"); + if (fsck_tag_standalone(NULL, buf.buf, buf.len, &fsck_options, + &tagged_oid, &tagged_type)) + die("tag on stdin did not pass our strict fsck check"); + + if (verify_object_in_tag(&tagged_oid, &tagged_type)) + die("tag on stdin did not refer to a valid object"); if (write_object_file(buf.buf, buf.len, tag_type, &result) < 0) die("unable to write tag file"); diff --git a/fsck.c b/fsck.c index f82e2fe9e30..bed5e20e03b 100644 --- a/fsck.c +++ b/fsck.c @@ -80,7 +80,9 @@ static struct oidset gitmodules_done = OIDSET_INIT; /* infos (reported as warnings, but ignored by default) */ \ FUNC(GITMODULES_PARSE, INFO) \ FUNC(BAD_TAG_NAME, INFO) \ - FUNC(MISSING_TAGGER_ENTRY, INFO) + FUNC(MISSING_TAGGER_ENTRY, INFO) \ + /* ignored (elevated when requested) */ \ + FUNC(EXTRA_HEADER_ENTRY, IGNORE) #define MSG_ID(id, msg_type) FSCK_MSG_##id, enum fsck_msg_id { @@ -911,6 +913,16 @@ static int fsck_tag(const struct object_id *oid, const char *buffer, unsigned long size, struct fsck_options *options) { struct object_id tagged_oid; + int tagged_type; + return fsck_tag_standalone(oid, buffer, size, options, &tagged_oid, + &tagged_type); +} + +int fsck_tag_standalone(const struct object_id *oid, const char *buffer, + unsigned long size, struct fsck_options *options, + struct object_id *tagged_oid, + int *tagged_type) +{ int ret = 0; char *eol; struct strbuf sb = STRBUF_INIT; @@ -924,7 +936,7 @@ static int fsck_tag(const struct object_id *oid, const char *buffer, ret = report(options, oid, OBJ_TAG, FSCK_MSG_MISSING_OBJECT, "invalid format - expected 'object' line"); goto done; } - if (parse_oid_hex(buffer, &tagged_oid, &p) || *p != '\n') { + if (parse_oid_hex(buffer, tagged_oid, &p) || *p != '\n') { ret = report(options, oid, OBJ_TAG, FSCK_MSG_BAD_OBJECT_SHA1, "invalid 'object' line format - bad sha1"); if (ret) goto done; @@ -940,7 +952,8 @@ static int fsck_tag(const struct object_id *oid, const char *buffer, ret = report(options, oid, OBJ_TAG, FSCK_MSG_MISSING_TYPE, "invalid format - unexpected end after 'type' line"); goto done; } - if (type_from_string_gently(buffer, eol - buffer, 1) < 0) + *tagged_type = type_from_string_gently(buffer, eol - buffer, 1); + if (*tagged_type < 0) ret = report(options, oid, OBJ_TAG, FSCK_MSG_BAD_TYPE, "invalid 'type' value"); if (ret) goto done; @@ -975,6 +988,19 @@ static int fsck_tag(const struct object_id *oid, const char *buffer, else ret = fsck_ident(&buffer, oid, OBJ_TAG, options); + if (!starts_with(buffer, "\n")) { + /* + * The verify_headers() check will allow + * e.g. "[...]tagger \nsome + * garbage\n\nmessage" to pass, thinking "some + * garbage" could be a custom header. E.g. "mktag" + * doesn't want any unknown headers. + */ + ret = report(options, oid, OBJ_TAG, FSCK_MSG_EXTRA_HEADER_ENTRY, "invalid format - extra header(s) after 'tagger'"); + if (ret) + goto done; + } + done: strbuf_release(&sb); return ret; diff --git a/fsck.h b/fsck.h index 69cf715e798..29ee4c45e87 100644 --- a/fsck.h +++ b/fsck.h @@ -62,6 +62,15 @@ int fsck_walk(struct object *obj, void *data, struct fsck_options *options); int fsck_object(struct object *obj, void *data, unsigned long size, struct fsck_options *options); +/* + * fsck a tag, and pass info about it back to the caller. This is + * exposed fsck_object() internals for git-mktag(1). + */ +int fsck_tag_standalone(const struct object_id *oid, const char *buffer, + unsigned long size, struct fsck_options *options, + struct object_id *tagged_oid, + int *tag_type); + /* * Some fsck checks are context-dependent, and may end up queued; run this * after completing all fsck_object() calls in order to resolve any remaining diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh index 2f501d2dc94..5d2dc99b74a 100755 --- a/t/t1006-cat-file.sh +++ b/t/t1006-cat-file.sh @@ -166,7 +166,7 @@ tag_content="$tag_header_without_timestamp 0000000000 +0000 $tag_description" -tag_sha1=$(echo_without_newline "$tag_content" | git mktag) +tag_sha1=$(echo_without_newline "$tag_content" | git hash-object -t tag --stdin -w) tag_size=$(strlen "$tag_content") run_tests 'tag' $tag_sha1 $tag_size "$tag_content" "$tag_content" 1 diff --git a/t/t3800-mktag.sh b/t/t3800-mktag.sh index 9ae1b0bb0af..19b3c1bca9c 100755 --- a/t/t3800-mktag.sh +++ b/t/t3800-mktag.sh @@ -37,7 +37,7 @@ too short for a tag EOF check_verify_failure 'Tag object length check' \ - '^error: .*size wrong.*$' + '^error:.* missingObject:' ############################################################ # 2. object line label check @@ -50,7 +50,7 @@ tagger . <> 0 +0000 EOF -check_verify_failure '"object" line label check' '^error: char0: .*"object "$' +check_verify_failure '"object" line label check' '^error:.* missingObject:' ############################################################ # 3. object line hash check @@ -63,7 +63,7 @@ tagger . <> 0 +0000 EOF -check_verify_failure '"object" line SHA1 check' '^error: char7: .*SHA1 hash$' +check_verify_failure '"object" line check' '^error:.* badObjectSha1:' ############################################################ # 4. type line label check @@ -76,7 +76,7 @@ tagger . <> 0 +0000 EOF -check_verify_failure '"type" line label check' '^error: char.*: .*"\\ntype "$' +check_verify_failure '"type" line label check' '^error:.* missingTypeEntry:' ############################################################ # 5. type line eol check @@ -84,7 +84,7 @@ check_verify_failure '"type" line label check' '^error: char.*: .*"\\ntype "$' echo "object $head" >tag.sig printf "type tagsssssssssssssssssssssssssssssss" >>tag.sig -check_verify_failure '"type" line eol check' '^error: char.*: .*"\\n"$' +check_verify_failure '"type" line eol check' '^error:.* unterminatedHeader:' ############################################################ # 6. tag line label check #1 @@ -98,7 +98,7 @@ tagger . <> 0 +0000 EOF check_verify_failure '"tag" line label check #1' \ - '^error: char.*: no "tag " found$' + '^error:.* missingTagEntry:' ############################################################ # 7. tag line label check #2 @@ -110,7 +110,7 @@ tag EOF check_verify_failure '"tag" line label check #2' \ - '^error: char.*: no "tag " found$' + '^error:.* badType:' ############################################################ # 8. type line type-name length check @@ -122,7 +122,7 @@ tag mytag EOF check_verify_failure '"type" line type-name length check' \ - '^error: char.*: type too long$' + '^error:.* badType:' ############################################################ # 9. verify object (hash/type) check @@ -136,7 +136,7 @@ tagger . <> 0 +0000 EOF check_verify_failure 'verify object (hash/type) check -- correct type, nonexisting object' \ - '^error: char7: could not verify object.*$' + '^fatal: could not read tagged object' cat >tag.sig < 0 +0000 EOF check_verify_failure 'verify object (hash/type) check -- made-up type, nonexisting object' \ - '^fatal: invalid object type' + '^error:.* badType:' cat >tag.sig < 0 +0000 EOF check_verify_failure 'verify object (hash/type) check -- incorrect type, valid object' \ - '^error: char7: could not verify object.*$' + '^error:.* badType:' cat >tag.sig < 0 +0000 EOF check_verify_failure 'verify object (hash/type) check -- incorrect type, valid object' \ - '^error: char7: could not verify object' + '^fatal: object.*tagged as.*tree.*but is.*commit' ############################################################ # 10. verify tag-name check @@ -183,7 +183,7 @@ tagger . <> 0 +0000 EOF check_verify_failure 'verify tag-name check' \ - '^error: char.*: could not verify tag name$' + '^error:.* badTagName:' ############################################################ # 11. tagger line label check #1 @@ -197,7 +197,7 @@ This is filler EOF check_verify_failure '"tagger" line label check #1' \ - '^error: char.*: could not find "tagger "$' + '^error:.* missingTaggerEntry:' ############################################################ # 12. tagger line label check #2 @@ -212,10 +212,10 @@ This is filler EOF check_verify_failure '"tagger" line label check #2' \ - '^error: char.*: could not find "tagger "$' + '^error:.* missingTaggerEntry:' ############################################################ -# 13. disallow missing tag author name +# 13. allow missing tag author name like fsck cat >tag.sig < 0 +0000 This is filler EOF -check_verify_failure 'disallow missing tag author name' \ - '^error: char.*: missing tagger name$' +test_expect_success 'allow missing tag author name' ' + git mktag .git/refs/tags/mytag 2>message' ############################################################ -# 16. disallow spaces in tag email +# 16. allow spaces in tag email like fsck cat >tag.sig < 0 +0000 EOF -check_verify_failure 'disallow spaces in tag email' \ - '^error: char.*: malformed tagger field$' +test_expect_success 'allow spaces in tag email like fsck' ' + git mktag __ EOF check_verify_failure 'disallow missing tag timestamp' \ - '^error: char.*: missing tag timestamp$' + '^error:.* badDate:' ############################################################ # 18. detect invalid tag timestamp1 @@ -299,7 +301,7 @@ tagger T A Gger Tue Mar 25 15:47:44 2008 EOF check_verify_failure 'detect invalid tag timestamp1' \ - '^error: char.*: missing tag timestamp$' + '^error:.* badDate:' ############################################################ # 19. detect invalid tag timestamp2 @@ -313,7 +315,7 @@ tagger T A Gger 2008-03-31T12:20:15-0500 EOF check_verify_failure 'detect invalid tag timestamp2' \ - '^error: char.*: malformed tag timestamp$' + '^error:.* badDate:' ############################################################ # 20. detect invalid tag timezone1 @@ -327,7 +329,7 @@ tagger T A Gger 1206478233 GMT EOF check_verify_failure 'detect invalid tag timezone1' \ - '^error: char.*: malformed tag timezone$' + '^error:.* badTimezone:' ############################################################ # 21. detect invalid tag timezone2 @@ -341,10 +343,10 @@ tagger T A Gger 1206478233 + 30 EOF check_verify_failure 'detect invalid tag timezone2' \ - '^error: char.*: malformed tag timezone$' + '^error:.* badTimezone:' ############################################################ -# 22. detect invalid tag timezone3 +# 22. allow invalid tag timezone3 (the maximum is -1200/+1400) cat >tag.sig < 1206478233 -1430 EOF -check_verify_failure 'detect invalid tag timezone3' \ - '^error: char.*: malformed tag timezone$' +test_expect_success 'allow invalid tag timezone' ' + git mktag tag.sig < 1206478233 -0500 + + +this line comes after an extra newline +EOF + +test_expect_success \ + 'allow extra newlines at start of body' \ + 'git mktag .git/refs/tags/mytag 2>message' ############################################################ # 24. create valid tag From patchwork Wed Dec 9 20:01:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 11962439 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=-15.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,USER_AGENT_GIT 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 636C4C1B0D8 for ; Wed, 9 Dec 2020 20:03:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 437AB23A02 for ; Wed, 9 Dec 2020 20:03:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388014AbgLIUDZ (ORCPT ); Wed, 9 Dec 2020 15:03:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387713AbgLIUDU (ORCPT ); Wed, 9 Dec 2020 15:03:20 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBED8C061282 for ; Wed, 9 Dec 2020 12:02:08 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id m5so3085339wrx.9 for ; Wed, 09 Dec 2020 12:02:08 -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=IVk5sEKV5o4yCpPZ9+sZdlq59QLbdXgEld6bx+c/E7Q=; b=m26ZApixRGBhsoS1dQM1YPHc37EujofFsKF4YWEBwdm4aG3wZfJnWxX6W8GxeUBEG5 T86/YaOkRnSbgXGtSqqE6EL7KqyUAcCOkl8aJ0iZu0IftixBxwPCOj5IQPRUIYyg7fHw Ww8nr4VZVpL8iR/TM9qCqp6kmDDtwTcLZxWQUq4xj2QS/NAtscVIFYYzX951zWPKcova 4bBEOgCs0MN4h//MV1qYCL+qjIlcbvbZ/S5AGYrwSTsNPTRnNbkorOOD/Csaz5YdRgwJ aZFCotQGM/cqCPKUg3rTBNoz3H6riQW/rt9eyBuxhQPEXk2PA2I4ibggbGiP41vlDFt9 3L4w== 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=IVk5sEKV5o4yCpPZ9+sZdlq59QLbdXgEld6bx+c/E7Q=; b=kOaCYM7QXPrS7x0lDYsGFEqbStF3+Y50Y9E6T7IyrHT3ivZiC0C9Wh2gbf053ohzm/ 6niR25Co+UH1+8/fKR497HuH3ICCQ4Q9fvrUhTJo/g7kfALn9gKOtQWWikZc8tDhbs6T re5ljDXAnnQh/tXt6k5aOBXiIJC/kJr9hVrs3jLO/0Hpf2uy5wduIw+RzKW2mcBAzkEo T1VA5g/IxQHRpPXgRoWVr03c/oD9h8kTT6MJ+zaBs4zFJ5Q+m00MXrXG3SVbJIiBJXch T8MNY49R/UaiERVtannzrlwFIYoZFZTEmCONA3XfYM/8U6P+eBj6iGz0gFFqEv6enAeT UizA== X-Gm-Message-State: AOAM531hLFEkR7fuUxf3qEce2tZhkrvABANYZOBAEHGStetVMEoZImKM a/CrlcWzMKlUbzEGI2C1hfVWfr3O7l2bTg== X-Google-Smtp-Source: ABdhPJxxYH0M7AtrgmEPsGZdemELetErEMVfXNU/wQyC2SykTfRzqr9PeoAuXhp9hxPJCNeR55s5OQ== X-Received: by 2002:adf:f6c7:: with SMTP id y7mr4419671wrp.147.1607544127475; Wed, 09 Dec 2020 12:02:07 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id 34sm5762128wrh.78.2020.12.09.12.02.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Dec 2020 12:02:06 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , "brian m . carlson" , Eric Sunshine , Johannes Schindelin , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v3 08/10] mktag doc: update to explain why to use this Date: Wed, 9 Dec 2020 21:01:38 +0100 Message-Id: <20201209200140.29425-9-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20201126222257.5629-1-avarab@gmail.com> References: <20201126222257.5629-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change the mktag documentation to compare itself to the similar "hash-object -t tag" command. Before this someone reading the documentation wouldn't have much of an idea what the difference was. Let's make it clear that it's to do with slightly different fsck validation logic, and cross-link the "mktag" and "hash-object" documentation to aid discover-ability. Signed-off-by: Ævar Arnfjörð Bjarmason --- Documentation/git-hash-object.txt | 4 ++++ Documentation/git-mktag.txt | 27 +++++++++++++++++++++++---- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/Documentation/git-hash-object.txt b/Documentation/git-hash-object.txt index df9e2c58bdb..c535661ced8 100644 --- a/Documentation/git-hash-object.txt +++ b/Documentation/git-hash-object.txt @@ -58,6 +58,10 @@ OPTIONS stress-testing Git itself or reproducing characteristics of corrupt or bogus objects encountered in the wild. +SEE ALSO +-------- +linkgit:git-mktag[1] + GIT --- Part of the linkgit:git[1] suite diff --git a/Documentation/git-mktag.txt b/Documentation/git-mktag.txt index a158428eb9f..b164ab563bd 100644 --- a/Documentation/git-mktag.txt +++ b/Documentation/git-mktag.txt @@ -3,7 +3,7 @@ git-mktag(1) NAME ---- -git-mktag - Creates a tag object +git-mktag - Creates a tag object with extra validation SYNOPSIS @@ -13,10 +13,25 @@ SYNOPSIS DESCRIPTION ----------- -Reads a tag contents on standard input and creates a tag object -that can also be used to sign other objects. -The output is the new tag's identifier. +Reads a tag contents on standard input and creates a tag object. The +output is the new tag's identifier. + +This command is mostly equivalent to linkgit:git-hash-object[1] +invoked with `-t tag -w --stdin`. I.e. both of these will create and +write a tag found in `my-tag`: + + git mktag ` +messages are promoted from warnings to errors (so e.g. a missing +"tagger" line is an error). Extra headers in the object are also an +error under mktag, but ignored by linkgit:git-fsck[1]. Tag Format ---------- @@ -34,6 +49,10 @@ exists, is separated by a blank line from the header. The message part may contain a signature that Git itself doesn't care about, but that can be verified with gpg. +SEE ALSO +-------- +linkgit:git-hash-object[1], + GIT --- Part of the linkgit:git[1] suite From patchwork Wed Dec 9 20:01:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 11962441 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=-15.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,USER_AGENT_GIT 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 382C2C4167B for ; Wed, 9 Dec 2020 20:03:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 127A623BEF for ; Wed, 9 Dec 2020 20:03:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388044AbgLIUD0 (ORCPT ); Wed, 9 Dec 2020 15:03:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387827AbgLIUDU (ORCPT ); Wed, 9 Dec 2020 15:03:20 -0500 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEA2AC061285 for ; Wed, 9 Dec 2020 12:02:09 -0800 (PST) Received: by mail-wm1-x344.google.com with SMTP id d3so2620332wmb.4 for ; Wed, 09 Dec 2020 12:02: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=kb74uT4iBhesBQhjLaQ7t4/yZcNCQYxHO6w0RWtzxOA=; b=ZpIdwQwGvOLSBox7UpLQqFAQUCXNvrLFe8u9FLVJdN7vcn/Bf+QJ2pa+xDOPS1IJv9 na5MOhjiPUNhSoQCh50qEhEdNwE3YbT78fSgvu2pgzXUfy+8bPk7+sNcHHR1k6W0+csw +KYE5PVLSGGewdTdf5lwqKYARj0DHDzxJaVoUpRJc4PEO3YEdWZ5mCWm7tiupMrZYS1+ qCHGsRDTs8X9SjnztpEv+k6fgFzER5sMnrHNDPYqzx3d3aVrV0WywwMkFKFhMWUlSmzN kp7Hs5UzW/9oULts7yMHDmDIF8MXDQec8SfQC64+Fs/XTbxVkd30sIvmPRSRIeA9eppy fTdg== 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=kb74uT4iBhesBQhjLaQ7t4/yZcNCQYxHO6w0RWtzxOA=; b=t8Ol+UjAAF9ossLmZsILa13XniKaqmthABHmN3nPaVrj8l7B5JGZNBcWQzUolpzrX/ XqLlkEnvAdUk+2t8dsghYCRV4/1NmWCRMMnzHipRu95noUcUmKoAWxhZpjanVftJX6SK dx9C14C9lrSLUitTbPtnz9aN+ePjopmkrcjYCQJg6MEYPqROzDv7vWtg8xNT3bP7e4ys UT/r0v9JMWtKoZyd6yKFxziZNJ6oco3d64WurCNcgnVqmxo8BDNxXZ2WpE8jo167aDwR TqitJ8kbpFwk/SQSA9nKDB/P+FQpt5LWEAxgLm3NTbtH//qqwscGV8RVpXR7Xb2PeRff Yg/A== X-Gm-Message-State: AOAM532RDhdm9aaNlUKnlc1NOR/rbZkCRzSm+b93mK+GB014T28uv4h1 Rt0uUxETA/YMT/cJqe0QGvkBFPyDEx4BZA== X-Google-Smtp-Source: ABdhPJwrfY+Q3HUoYgsqtlTzkhaXHRebIAYjj/yr/qLKAzk3htS+znGTkoGSaMHqUyATL9trSKXJxw== X-Received: by 2002:a7b:c841:: with SMTP id c1mr4635371wml.31.1607544128648; Wed, 09 Dec 2020 12:02:08 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id 34sm5762128wrh.78.2020.12.09.12.02.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Dec 2020 12:02:07 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , "brian m . carlson" , Eric Sunshine , Johannes Schindelin , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v3 09/10] fsck: make fsck_config() re-usable Date: Wed, 9 Dec 2020 21:01:39 +0100 Message-Id: <20201209200140.29425-10-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20201126222257.5629-1-avarab@gmail.com> References: <20201126222257.5629-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Move the fsck_config() function from builtin/fsck.c to fsck.[ch]. This allows for re-using it in other tools that expose fsck logic and want to support its configuration variables. A logical continuation of this change would be to use a common function for all of {fetch,receive}.fsck.* and fsck.*. See 5d477a334a6 (fsck (receive-pack): allow demoting errors to warnings, 2015-06-22) and my own 1362df0d413 (fetch: implement fetch.fsck.*, 2018-07-27) for the relevant code. However, those routines want to not parse the fsck.skipList into OIDs, but rather pass them along with the --strict option to another process. It would be possible to refactor that whole thing so we support e.g. a "fetch." prefix, then just keep track of the skiplist as a filename instead of parsing it, and learn to spew that all out from our internal structures into something we can append to the --strict option. But instead I'm planning to re-use this in "mktag", which'll just re-use these "fsck.*" variables as-is. Signed-off-by: Ævar Arnfjörð Bjarmason --- builtin/fsck.c | 20 +------------------- fsck.c | 25 +++++++++++++++++++++++++ fsck.h | 7 +++++++ 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/builtin/fsck.c b/builtin/fsck.c index fbf26cafcfd..821e7798c70 100644 --- a/builtin/fsck.c +++ b/builtin/fsck.c @@ -73,25 +73,7 @@ static const char *printable_type(const struct object_id *oid, static int fsck_config(const char *var, const char *value, void *cb) { - if (strcmp(var, "fsck.skiplist") == 0) { - const char *path; - struct strbuf sb = STRBUF_INIT; - - if (git_config_pathname(&path, var, value)) - return 1; - strbuf_addf(&sb, "skiplist=%s", path); - free((char *)path); - fsck_set_msg_types(&fsck_obj_options, sb.buf); - strbuf_release(&sb); - return 0; - } - - if (skip_prefix(var, "fsck.", &var)) { - fsck_set_msg_type(&fsck_obj_options, var, value); - return 0; - } - - return git_default_config(var, value, cb); + return fsck_config_internal(var, value, cb, &fsck_obj_options); } static int objerror(struct object *obj, const char *err) diff --git a/fsck.c b/fsck.c index bed5e20e03b..9067a290a2e 100644 --- a/fsck.c +++ b/fsck.c @@ -1310,3 +1310,28 @@ int fsck_finish(struct fsck_options *options) oidset_clear(&gitmodules_done); return ret; } + +int fsck_config_internal(const char *var, const char *value, void *cb, + struct fsck_options *options) +{ + if (strcmp(var, "fsck.skiplist") == 0) { + const char *path; + struct strbuf sb = STRBUF_INIT; + + if (git_config_pathname(&path, var, value)) + return 1; + strbuf_addf(&sb, "skiplist=%s", path); + free((char *)path); + fsck_set_msg_types(options, sb.buf); + strbuf_release(&sb); + return 0; + } + + if (skip_prefix(var, "fsck.", &var)) { + fsck_set_msg_type(options, var, value); + return 0; + } + + return git_default_config(var, value, cb); +} + diff --git a/fsck.h b/fsck.h index 29ee4c45e87..423c467feb7 100644 --- a/fsck.h +++ b/fsck.h @@ -103,4 +103,11 @@ void fsck_put_object_name(struct fsck_options *options, const char *fsck_describe_object(struct fsck_options *options, const struct object_id *oid); +/* + * git_config() callback for use by fsck-y tools that want to support + * fsck. fsck.skipList etc. + */ +int fsck_config_internal(const char *var, const char *value, void *cb, + struct fsck_options *options); + #endif From patchwork Wed Dec 9 20:01:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 11962437 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=-15.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,USER_AGENT_GIT 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 22918C4361B for ; Wed, 9 Dec 2020 20:03:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F057E23A02 for ; Wed, 9 Dec 2020 20:03:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388040AbgLIUDZ (ORCPT ); Wed, 9 Dec 2020 15:03:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387945AbgLIUDV (ORCPT ); Wed, 9 Dec 2020 15:03:21 -0500 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E453C061257 for ; Wed, 9 Dec 2020 12:02:11 -0800 (PST) Received: by mail-wm1-x341.google.com with SMTP id y23so3005367wmi.1 for ; Wed, 09 Dec 2020 12:02:11 -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=6H387cs7FalftOl7XqMA6J0IueyK82JpCf0QGoCsyNQ=; b=lP40sb6xMb4nsIptcI0l5KivO/05bxCqX0pWOhOidFVDOK/FRspHtg4u4eDET3uq/0 Gj5SwfT1T9p1mrxPzQOb7b8G1L9GsXHB7MGMRTvZ71HyNJy3pyCedHm/bNZLcVmv7Ifp TCNwAE7huW/EyoY9ZLZ673JdEMQg3lcc9BvFvS5aWbpTgaeRcSh7soFEvZWAlMPYZ1gE voUO6rE8v5D+/bolp6uPdC2rl+oSupNRMCNEIunczHdEpGBbfqNKC01VVTXINwvJw6E5 ++rc15S6WJrEpHAPhiT66NaTMVa24AMJ4i01jS1V58vQKmYL2qZRnQmN9b26F3iH+gG7 S6Hg== 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=6H387cs7FalftOl7XqMA6J0IueyK82JpCf0QGoCsyNQ=; b=Y9GouqMDXF95xPk8FzymWiIubxSpApp9I4hLkqMb3y7sYkcPtEy/Bf025YgiguOW2E hdwAOq1wB+Twn5gOqzu/2mgZ7Xca4qrDovLUBJQagI/5iNjzaWZUqsb1XhV6B+nVN7kZ O4rYoRUZIWYrYEC8M8UpDZjvQemW8/oaZX9MkoxhUuc+jaI+6B/Mb//Bb3ELmPkXs3hb Z5/ULSKf223Yiu4uysaQQvEwhwvL2nUsl902YDq/P4sv1+vlVhm4HOtD9ygkELJSbLPT wzt8mMgvPF/qoP24QR87MNKsimq6Ce0u6k2cmIeGPU6ZZoHjo4XoFfH1XzozAjegKukg bTLg== X-Gm-Message-State: AOAM533L45O7nOnWoeFRxqNrNr3+4TMtFmleqqlh5P7y5v6Y5IEHkhzL CwUNvTaDRJMmPUuTUcHuMyrOA4CpX7c13Q== X-Google-Smtp-Source: ABdhPJxnOatq6r0EqE7GmvI0yT/cITwrBI1XkcqNRNpHrtzG38L3JXYNTU5JlDSaGW9BnSdn5pRjUQ== X-Received: by 2002:a7b:cf08:: with SMTP id l8mr4584800wmg.189.1607544129811; Wed, 09 Dec 2020 12:02:09 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id 34sm5762128wrh.78.2020.12.09.12.02.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Dec 2020 12:02:08 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , "brian m . carlson" , Eric Sunshine , Johannes Schindelin , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v3 10/10] mktag: allow turning off fsck.extraHeaderEntry Date: Wed, 9 Dec 2020 21:01:40 +0100 Message-Id: <20201209200140.29425-11-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20201126222257.5629-1-avarab@gmail.com> References: <20201126222257.5629-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In earlier commits mktag learned to use the fsck machinery, at which point we needed to add fsck.extraHeaderEntry so it could be as strict about extra headers as it's been ever since it was implemented. But it's not nice to need to switch away from "mktag" to "hash-object" + manual "fsck" just because you'd like to have an extra header. So let's support turning it off by getting "fsck.*" variables from the config. Pedantically speaking it's still not possible to make "mktag" behave just like "hash-object -t tag" does, since we're unconditionally going to check the referenced object in verify_object_in_tag(), which is our own check, and not one that exists in fsck.c. But the spirit of "this works like fsck" is preserved, in that if you created such a tag with "hash-object" and did a full "fsck" on the repository it would also error out about that invalid object, it just wouldn't emit the same message as fsck does. Signed-off-by: Ævar Arnfjörð Bjarmason --- Documentation/git-mktag.txt | 9 +++++++-- builtin/mktag.c | 11 ++++++++++- t/t3800-mktag.sh | 14 ++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/Documentation/git-mktag.txt b/Documentation/git-mktag.txt index b164ab563bd..e1506dde561 100644 --- a/Documentation/git-mktag.txt +++ b/Documentation/git-mktag.txt @@ -30,8 +30,13 @@ tag doesn't pass a linkgit:git-fsck[1] check. The "fsck" check done mktag is is stricter than what linkgit:git-fsck[1] would run by default in that all `fsck.` messages are promoted from warnings to errors (so e.g. a missing -"tagger" line is an error). Extra headers in the object are also an -error under mktag, but ignored by linkgit:git-fsck[1]. +"tagger" line is an error). + +Extra headers in the object are also an error under mktag, but ignored +by linkgit:git-fsck[1]. This extra check can be turned off by setting +the appropriate `fsck.` varible: + + git -c fsck.extraHeaderEntry=ignore mktag err && + grep "warning .*extraHeaderEntry:" err && + test_must_fail env GIT_TEST_GETTEXT_POISON=false \ + git -c fsck.extraHeaderEntry=error 2>err fsck && + grep "error .* extraHeaderEntry:" err +' + cat >tag.sig <