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 <