From patchwork Thu Nov 26 22:22:48 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: 11934845 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 69A1EC6379D for ; Thu, 26 Nov 2020 22:23:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 041552145D for ; Thu, 26 Nov 2020 22:23:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="c3K4Oo7k" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391794AbgKZWXO (ORCPT ); Thu, 26 Nov 2020 17:23:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391785AbgKZWXM (ORCPT ); Thu, 26 Nov 2020 17:23:12 -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 1E750C0617A7 for ; Thu, 26 Nov 2020 14:23:11 -0800 (PST) Received: by mail-wm1-x341.google.com with SMTP id 1so3813469wme.3 for ; Thu, 26 Nov 2020 14:23: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=bMxphDVj7IeRrDlyqqQGvFK5ry9X0MLYClQvtmWXq0o=; b=c3K4Oo7kQkJiDw5AzrgsR/FIL7umemDaQ/FAd5rS4RC51jLSOIfUNPY8sdWzlTuTzj lg7juIklwPiuPR/NP5OUTZoNZFpDXepnvgkM8w2tVgSPmEyZmx5Ybv2whiS0swDLTP3L DUL7BUkzn0gzi4A7VrnpCdRfKId7+WRHyTuzDZiZ8gvfvIvJZJvGgDgde1pqu1tBO9rq +aYhBAme+cS8cz73Rd1OPI84mrRaeE4RuHesm8S0Qw7TEeOCDcBWD60b4XAk9vtVf42j XbDMHsGPsVqbNQYADaATC79ZatvxjqSaGN2LjR3IFrsNAPUV3DNh0jYq/rPMnK13K40Y CmCw== 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=bMxphDVj7IeRrDlyqqQGvFK5ry9X0MLYClQvtmWXq0o=; b=PDuu3/3x92Dc5m9wEGXhlYnCxrLsk/LEv5XbEYeq0ATEaVIgPH8QvfY+asy4Hhs11J 9S0QCRxFv2UxvcYgSgDYL8/9mmSC5aKxKZHcR8AbAzSGP4pt+z7jYJmVauGz5alHSJtm H5WXTQvmgiL4TsST+uV4spwtzm7p9ddTTlo/v1blBNRALbmjmwfzyPqA3oGB/GmzZRw1 vj/hZxAFcz45uIFPekuU9O6puJ/kr7lzS7AaJxdD766GViBnZ0zzxqsBdYuRxenmmGjy LK7/7U7aiNscEo852LcxlTHC/3j3aOG0GuR7TemLi1r+++TjvgBj/AVwqnlYzJj674PR owGg== X-Gm-Message-State: AOAM531l6IyxX3/9/8ItYMRSfArfAwn0j3dRdSsxJ5Y9XhSMjHwcdBl9 7KS6VToZ/t61L9xwzkWb+8A0ncC66ZrpVw== X-Google-Smtp-Source: ABdhPJzl4/78PDeAIymP/nQ4srccAToWMoBQKP1RT/4zPiQBSutMSPHsp03IK3p9oQeS2Xz3C21iAA== X-Received: by 2002:a1c:a786:: with SMTP id q128mr5547302wme.115.1606429389475; Thu, 26 Nov 2020 14:23:09 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id e3sm11283237wro.90.2020.11.26.14.23.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Nov 2020 14:23: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 v2 01/10] mktag doc: say not Date: Thu, 26 Nov 2020 23:22:48 +0100 Message-Id: <20201126222257.5629-2-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20201126012854.399-1-avarab@gmail.com> References: <20201126012854.399-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 fa6a756123..a158428eb9 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 Thu Nov 26 22:22:49 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: 11934835 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 40BB8C63798 for ; Thu, 26 Nov 2020 22:23:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D3CA921527 for ; Thu, 26 Nov 2020 22:23:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bn+yyq1N" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391791AbgKZWXO (ORCPT ); Thu, 26 Nov 2020 17:23:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387685AbgKZWXM (ORCPT ); Thu, 26 Nov 2020 17:23:12 -0500 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2015FC0613D4 for ; Thu, 26 Nov 2020 14:23:12 -0800 (PST) Received: by mail-wm1-x342.google.com with SMTP id u10so652691wmm.0 for ; Thu, 26 Nov 2020 14:23:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nrf1B/mjDuKVtAiooF3Zhliy60HVigqM1yyq2cZrlwo=; b=bn+yyq1N98c8e0/mV9FEBHMpRlcHK980a8FInG3aUQSSAqapiaBdQlVsc5lbJTWNG8 CrrB3noofIU4pFhUuznvl2zPrEHPSKj/s1/uDBgQihi+eCV9m7zG9oX8gBZAGtd/qu2m 38cDjzpDeZYK79EOLfUgkkTMQfycglUS7c6YbSw7pCbjQDG0rrDEF4jzBHyat+wTSuFm nJofYZpuPPVUjBXEpgdXCaadfSuLrN34b2q0OHMwKyiTXTpVkKCf80yGyAGmVBznAKTs e7flEcH73GEXLdCujoesOQdxIbFXnqqP2jnFR2H2sZ64yEyu5G+9GA/QqF0/b/NM1yb/ ENHg== 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=nrf1B/mjDuKVtAiooF3Zhliy60HVigqM1yyq2cZrlwo=; b=Sypbx7zx7bad7b0A5Dy+jWrf18N0FrxGNXHfLbhxO/nHJyO8zWmW/abTDRRm9jd+e/ jRDKR6Gy0VK8yc8Q129oJBivUBUdw9TZ058NGIcswBahywzb87M5Hk5b476BDh1i5Zxm FH8cdYXuv9AGi+ekcMmr7wsXBORhtnjtml3x+aQVsMrWmtM4ZWJrFN7vta1vNazJu0il B1GByHCAdgApCiQf/9F+oHSkJQiRKtudNgV66u6ZUnnwgPJB5pzE1pFpwUInpjHwMQAl m/ORbbtGaxrA19j4SrwUUl40m4RER715yx1xCNl66zfcYlJWSMnl7sFp5CPzEX6XeAtW AieQ== X-Gm-Message-State: AOAM531iecjgVDJfzUxZeOhQ/Oz3EGGqHUaGz3g6UlycsyspSHIVvVhL /AgLuOfi/vi0I+1MxbvTkXc+jhWSVdXzdQ== X-Google-Smtp-Source: ABdhPJzpS+nLbk+PTV1KLW3lgC7VKgKMl/2Sygkd3KLfB336LnPn7zzskhtmTPOgCAEa9USUwkHzfA== X-Received: by 2002:a05:600c:2306:: with SMTP id 6mr5559591wmo.140.1606429390493; Thu, 26 Nov 2020 14:23:10 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id e3sm11283237wro.90.2020.11.26.14.23.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Nov 2020 14:23:09 -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 v2 02/10] mktag: use default strbuf_read() hint Date: Thu, 26 Nov 2020 23:22:49 +0100 Message-Id: <20201126222257.5629-3-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20201126012854.399-1-avarab@gmail.com> References: <20201126012854.399-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 4982d3a93e..ff7ac8e0e5 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 Thu Nov 26 22:22:50 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: 11934839 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 931F6C64E75 for ; Thu, 26 Nov 2020 22:23:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 298F421527 for ; Thu, 26 Nov 2020 22:23:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DqAwQ+mA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391796AbgKZWXP (ORCPT ); Thu, 26 Nov 2020 17:23:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391790AbgKZWXN (ORCPT ); Thu, 26 Nov 2020 17:23:13 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E2FCC0617A7 for ; Thu, 26 Nov 2020 14:23:13 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id p8so3689938wrx.5 for ; Thu, 26 Nov 2020 14:23:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0+Oer4GSRchoXVNYtlL5I1oxz4Ket+on6CG5jj0l5gg=; b=DqAwQ+mAUtU4be5q5cHC/iyY/OUC8f1iJy7pp9cVS+zGKtmNgAQkf4lcvTHiZU4xAQ z8qZp5xcxVRnVNzkAq1pXVxRfzOY40TuhJub6tbRSDqS4Wi0DNomOBcXCIsBcGsGe2LL m7vFFn+7d13fMaEXBmZWAF261Qq7poxm7Wedvcfa8xMSShMmAoRTREgU4tWRW49KEs/v I+t9yXxQufNc9qcw2dKEvkGHIrWR9JtGTuS288LSlCz2ht0Oss9OQwK1dmpGLSeyv5dK IxCfowsyFvc3WBkeTD4ILdtc1C5nQOF5kwaYrLncHxkiS8qSX+TLLxESXSF3yPSo9Qew 2Ccw== 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=0+Oer4GSRchoXVNYtlL5I1oxz4Ket+on6CG5jj0l5gg=; b=XgbTb9X+iDjnU0Jv2YOaNJGDdmmg3SQEvBGIEzxqLVs8P4aYCuniyGkEAoAw3Ej+YX oijLBvHft4AjTzQYQaMBjNMO2u8mnX6Jeiz0AXr9byd2UFN2Bb2g4fktOqEEiozGimN/ BbEykTKUqf1XrIRJOGrjtsHpSQDPduqeLQ4NQ2BcVZ+BLyXpIXk4NgaqbQZxDIFOHUf9 0dU8213MQh4VTmWhaH7FMFvoLbuJ7c1t8plvfUBohQWGoPLbI26Ex/St0BWBroHql/sG b1P9lLeDQ6//2JcEH2QyBmiS3OrgrbGiKL3N4dTYlIu8ddJJ9NwAoDecVvMNuKhi1/9p NqHg== X-Gm-Message-State: AOAM530Ps67TEpJ1Xudbdo3mSCj9xhQb1dK++Bz6vl6qWutAR6gVCq4M f5wfPxV6dPFLXofwFtuG5TMCGsFgZgs1vg== X-Google-Smtp-Source: ABdhPJxRl2tY2Zopj8jH5yope6QzSnxCu43QowWkBucr8tL0GIwa8/zQG4eublciEKY5ouM2qhUp7g== X-Received: by 2002:a05:6000:45:: with SMTP id k5mr6722776wrx.108.1606429391767; Thu, 26 Nov 2020 14:23:11 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id e3sm11283237wro.90.2020.11.26.14.23.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Nov 2020 14:23:11 -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 v2 03/10] mktag: reword write_object_file() error Date: Thu, 26 Nov 2020 23:22:50 +0100 Message-Id: <20201126222257.5629-4-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20201126012854.399-1-avarab@gmail.com> References: <20201126012854.399-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change the error message emitted when write_object_file() fails to make more sense. At this point we're not writing a "tag file" (which as an aside we never do, we just write to stdout). We are writing an annotated tag object, let's say that instead. 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 ff7ac8e0e5..603b55aca0 100644 --- a/builtin/mktag.c +++ b/builtin/mktag.c @@ -171,7 +171,7 @@ int cmd_mktag(int argc, const char **argv, const char *prefix) die("invalid tag signature file"); if (write_object_file(buf.buf, buf.len, tag_type, &result) < 0) - die("unable to write tag file"); + die("unable to write annotated tag object"); strbuf_release(&buf); printf("%s\n", oid_to_hex(&result)); From patchwork Thu Nov 26 22:22:51 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: 11934837 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 B3B44C64E7A for ; Thu, 26 Nov 2020 22:23:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 519D22145D for ; Thu, 26 Nov 2020 22:23:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Mlqu8MQ8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391801AbgKZWXQ (ORCPT ); Thu, 26 Nov 2020 17:23:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387685AbgKZWXO (ORCPT ); Thu, 26 Nov 2020 17:23:14 -0500 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4180AC0613D4 for ; Thu, 26 Nov 2020 14:23:14 -0800 (PST) Received: by mail-wr1-x442.google.com with SMTP id l1so3685922wrb.9 for ; Thu, 26 Nov 2020 14:23:14 -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=e7DqChdgkDIOcmUV2R1ooVv5JMni3yZPaAeRb7uAV4k=; b=Mlqu8MQ8jk3Y24jUoGifc1/3ICWhj6XNDJZ9M/ruYbWmj7xZB9i6/qEjiqEgrSLAVF qyxI9LqGyQcHcNyMk3KYLn+dZMCVcNgPdV5qSykZ98PJ2eHXffmHYaF0mWp+QUNmZ1CQ JktbgZLFZRHwo1iDoirwOxu8WDslxtND+hR0xY3vIyfBXCIx6hCU2UASyWRfHPXEhaiz 7rCSkgnHaqRDqYL7qcu3bAcvEmJcvupy7pNs/KbY6C3fIK7zsLGTCqSpHJMUiWcl9xp3 HuMnOeF8WisFrwM2LOQ/fyh/fTtm2vKKeCksBLwdlqyg5ygmWg3llyEXPOkNOCtJwtXB s1tg== 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=e7DqChdgkDIOcmUV2R1ooVv5JMni3yZPaAeRb7uAV4k=; b=c7N9tvaDJyLeMzS9RaXJ34deNfjw1GecurrRqmBKSGJ3tqWI7+NdHiWf7edi/dZ6NU bVVIRb97MF8Y6bmEzt0zvsr2czou38gOECpHM4VgzNc3GDcdJVxYbJQGQaW6zhQvNg9U KueXW6vTSJcU3NTfeBwC9gIHkMgaAe5W513jQD4Pvei78tM7qQgebzDmzksPElcBRxzb 0l4AJaAzCSG7KY/x+VUYwuFXKmfOztNa99AuF1+LsStm/KLeZojCFYx+GvX5TSjgbnCL ZLNQIhEDbDc88HfwwS7HK1AMdocq3nNYvFbGEz0Ni55k/bYLHjg5KjIrqWgEKenUsPSc Kpxw== X-Gm-Message-State: AOAM532CGd6OQDQb9172QyBdSKiLbi22TTjuTjOSOWpIl+OcKqKqLNWK NgxDHYV1z1k/dZr0OMT26vGMdmtGBCkKFg== X-Google-Smtp-Source: ABdhPJycWsqXAFrG+7zpCU5oPaeGkpJFTOCDid9t1MSnS3dODmoV55OTuzCIqMR7Ipxtg3XtJ3YUlQ== X-Received: by 2002:a5d:688a:: with SMTP id h10mr6649408wru.68.1606429392750; Thu, 26 Nov 2020 14:23:12 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id e3sm11283237wro.90.2020.11.26.14.23.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Nov 2020 14:23:12 -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 v2 04/10] mktag: remove redundant braces in one-line body "if" Date: Thu, 26 Nov 2020 23:22:51 +0100 Message-Id: <20201126222257.5629-5-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20201126012854.399-1-avarab@gmail.com> References: <20201126012854.399-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 603b55aca0..dc354828f7 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 Thu Nov 26 22:22:52 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: 11934843 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 D7F5FC64E7B for ; Thu, 26 Nov 2020 22:23:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 787F521527 for ; Thu, 26 Nov 2020 22:23:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cfkvy5jf" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391799AbgKZWXQ (ORCPT ); Thu, 26 Nov 2020 17:23:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391790AbgKZWXP (ORCPT ); Thu, 26 Nov 2020 17:23:15 -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 5EAAAC0617A7 for ; Thu, 26 Nov 2020 14:23:15 -0800 (PST) Received: by mail-wr1-x441.google.com with SMTP id z7so3698380wrn.3 for ; Thu, 26 Nov 2020 14:23:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sgLR052BmWKstzCMaXV7x0thq6EyIOUZ/6tWgNnVfVE=; b=cfkvy5jfG95ahGFBTFxy3cw0yiEcgYUNhqCG0pd0hn0e4uvd1bA52f0EebAyeH0Ndg oRaRC8luC2BhXtxBi7Iik/IC8lE9kG4uF7vvbyuuOKSFQuIeeIvUBW69ueAl9Z5hclTY nuSImIAMEGS3ZZpuu1rIuk6G9lmb1NKoD2/yYwFPxzyfVojWx6+F9WVJKVQ/nbqmRjWf bZ2Tcjg0fqMDY63SBn8Ga3RFtFhPyKDAqzvj/cLj5IycGSmgVWNB5tjzQH61dHk/FVGE mmIRE9NyqpfMUG70nXdUFXiQTyMjHVT2msba/fyJVGavLObkK8UkbtMutNs3iP8qFTCC Bs2Q== 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=sgLR052BmWKstzCMaXV7x0thq6EyIOUZ/6tWgNnVfVE=; b=Y31dr8jBmqcofwXalUgTmCpwuJwfRNodYUQoGv9vbOHmGWsVlhwirqYSq+B/zfK4nT ElGDZkBeQ73aeKdtE1YYmy8laF5Q31DKwvDXN+GtVSiQVJtrV7MD6AWerXOBXL8J7dRK Qr25jiUx/E6Om7EFow1QMt6eV5yBuuYq6Qu5jaTf2MpLFzkNkuhxQ854Wgda1TLvpJvK eju7YMdNE90Ksqrj1PE2wFIPTaGmJx/2pykuxpyhuRuwxJM63OedhZ4mkovY8X0Yr+r1 ugMYumpxNws/MJqqwxuz1e9hLlsIWg+RApJhuEexqsJDM7BAa6pg50wWJrE3fPh9L0Vp YS5w== X-Gm-Message-State: AOAM531wZsp3UZosW+JS+TVTbfmz1SWb66Du8LKSj+z2XHX3CcfT+Nd3 Q2M6erh0YRd+fCYdCl2Ve3mDZvKnBBdNzQ== X-Google-Smtp-Source: ABdhPJxX8lVypa6Xzt8qyV5/9XHqIjen2Ver1aS3oj1ucmBIlvkjwKdB2aVb/YoWqM/wuiCJN4ryJA== X-Received: by 2002:a5d:51c1:: with SMTP id n1mr6498749wrv.395.1606429393917; Thu, 26 Nov 2020 14:23:13 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id e3sm11283237wro.90.2020.11.26.14.23.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Nov 2020 14:23:13 -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 v2 05/10] mktag tests: don't needlessly use a subshell Date: Thu, 26 Nov 2020 23:22:52 +0100 Message-Id: <20201126222257.5629-6-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20201126012854.399-1-avarab@gmail.com> References: <20201126012854.399-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 d696aa4e52..0e411e3c45 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 Thu Nov 26 22:22:53 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: 11934851 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 3B8FAC64E8A for ; Thu, 26 Nov 2020 22:23:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CDDAE21527 for ; Thu, 26 Nov 2020 22:23:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="W697CzZe" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391810AbgKZWXT (ORCPT ); Thu, 26 Nov 2020 17:23:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391803AbgKZWXS (ORCPT ); Thu, 26 Nov 2020 17:23:18 -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 67889C0613D4 for ; Thu, 26 Nov 2020 14:23:16 -0800 (PST) Received: by mail-wr1-x441.google.com with SMTP id u12so3713431wrt.0 for ; Thu, 26 Nov 2020 14:23:16 -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=WJtcxL8aARA3ie7Ihmdc3YxDALsnvjDeHb3uMrIef3Q=; b=W697CzZeKSjuzoDAxY4ff/NZRG3tSMWhUFKhKZkC7X/ThaNQsrQbNBRBngXJrORWIQ FeauxZvl2ZHyoTXtaVhnBAjZHWwMtW6ldfHuDVqRE1/oj+ptqWrAuz9uFlg2ormFlsUc EMe1GvMdIVak9x29YWtAZM8NR2OuONAvs4aFKydfbu9BFMzGBUKUhjEvdKU9I2Xiy0AX AmJjttWiIoAL9mzp5ZYOh8+MjPISSbRLPBUw/c4AdH8qUrJcNn9tAi2/SFAWP6jD5lLh dEsWr5jzgDzxls78hez2fYkJhAeObPj/S9hAM6kNgjDMmTn1BGfI4VuIKTcu8MQ/Uy7h ODUQ== 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=WJtcxL8aARA3ie7Ihmdc3YxDALsnvjDeHb3uMrIef3Q=; b=MYOxHYuIEMWaN8yhtQzscbqTynsiqUJQb18X/SJX/KlSULPOiYqEKB2xrgfDSkSN44 +NEMomUQUeCcWZUCgWcf0jR5r9tBvlNmDJW2dkg70po8J2LSM8bjn5t7rnvCmPoFCeGn +ecRrYujeSqB1go5EaxQBLLoLf0GQ781CQALY6WLGKnn8w4sD7UVQ5w92p6cC0L5/gI8 O0xfeh2zu2dvAFM3cQzcXrugYnkXHddhV8jPIVGRn2TY/fwR8qvvx9ck11mFiYFhU7hO fPzpj8whSSKW7FZKjdQiuYTHMyneLgGq8qiPi/o8AJ1XGl3twWhpG+xYH6kZDb74/f8w Unbw== X-Gm-Message-State: AOAM532aVLSSWRCzxmDjLWr5j7HJYIMGhkZ2Caz+wqoL7CXoEI0vixoL jNeXAwC2//Q15SVqz4goe1u/BgJ6xt8Wdw== X-Google-Smtp-Source: ABdhPJwf4s99FYTmSwwJSuRK37S/NZeem4aSCPj4N0G7jv3SZ4shgR7TvHY4rbq79tz98RH03Zm3Ig== X-Received: by 2002:a5d:528a:: with SMTP id c10mr4722075wrv.270.1606429394859; Thu, 26 Nov 2020 14:23:14 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id e3sm11283237wro.90.2020.11.26.14.23.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Nov 2020 14:23:14 -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 v2 06/10] mktag tests: remove needless SHA-1 hardcoding Date: Thu, 26 Nov 2020 23:22:53 +0100 Message-Id: <20201126222257.5629-7-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20201126012854.399-1-avarab@gmail.com> References: <20201126012854.399-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 0e411e3c45..e9d7799537 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 SHA check cat >tag.sig < 0 +0000 From patchwork Thu Nov 26 22:22:54 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: 11934847 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 0FB81C64E7D for ; Thu, 26 Nov 2020 22:23:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9BF512145D for ; Thu, 26 Nov 2020 22:23:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="p527zWv8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391806AbgKZWXS (ORCPT ); Thu, 26 Nov 2020 17:23:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387685AbgKZWXR (ORCPT ); Thu, 26 Nov 2020 17:23:17 -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 7ADECC0617A7 for ; Thu, 26 Nov 2020 14:23:17 -0800 (PST) Received: by mail-wr1-x441.google.com with SMTP id r3so3714659wrt.2 for ; Thu, 26 Nov 2020 14:23:17 -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=3+KJsND/oeERASCD+pfl5SbNdfZIMHRxJA7WE8qitKQ=; b=p527zWv8Vf+T2x6bMSwOLZCZC3m6v4g2ly/OYelbJFN3Z86JFGXdIB62kwoY6voRJG XkuouNE55BdUlOdST2m/Z6ltes2S8ampwtUQ/2DEwHLIwBXB8HgTB1yeL4FjXiPobCtV VdtvdaG6pLk++ti4X+wcfOYIqi6HOyNuqDfhhlpNmgjio+8vChluUccWbjGwTlWu22dj v0eQbv2HFmYwCkcjkhqo6SZr1iKPiCYq+fTtguNB1flJkguaAFQoVd1RvlRZhHATtVo7 0m3J0crn97NJKCBoNZdmlzSb085oVEeNIpcPbfbNtQuxkvGp4aIfkNfVT+/SsAub0y9y 2IhA== 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=3+KJsND/oeERASCD+pfl5SbNdfZIMHRxJA7WE8qitKQ=; b=hIrenocKBvEAXPss8AAQCybDfEVZ8z+pxiRvhfMl/eOn7pp8jKLHnDORnnO4tJIx7J FtjR3edO0TUjPay+2mQLHsFaj7GqT1bCOtJX33OexXgSJ0Psx35zrS6ZRJSGdHe4sYxg 6kEym7gKzHIaLHsdAude4BfqC/4TRI3bX3VHwUeyklwRtjJCdoq52H9JrSIn0OZsFDLw FU/v8aRH5vkfPG3NoretwdQArSOmbGcB0XoPNIfRMxe3uuIFZzo3spl6KUCIGv/HjJC/ sHlE2JMirbJTTrrIaxFhPSsLV1pnmCJg3ORk8R3EfxKVup/S8gpTG1OTV7OFwlQx1jvK WoVw== X-Gm-Message-State: AOAM533Led06+Ve38YHsJRRHu0m8KmoGhiZYX+K7I+9F9/765o3YdJZN weTim2fp0lGz/N3eZam3wpG+M7aycgkRog== X-Google-Smtp-Source: ABdhPJzbr6z5q/AJf8A5XhUdB8Ng/RKbX7MB8RFESpKFxAaOUrezVY7z+Rr1T9q/vPuGKBUeuRRxng== X-Received: by 2002:adf:fed1:: with SMTP id q17mr6537254wrs.393.1606429395996; Thu, 26 Nov 2020 14:23:15 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id e3sm11283237wro.90.2020.11.26.14.23.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Nov 2020 14:23:15 -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 v2 07/10] mktag tests: improve verify_object() test coverage Date: Thu, 26 Nov 2020 23:22:54 +0100 Message-Id: <20201126222257.5629-8-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20201126012854.399-1-avarab@gmail.com> References: <20201126012854.399-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 e9d7799537..a6a67b6f27 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 (SHA/type) check cat >tag.sig < 0 +0000 + +EOF + +check_verify_failure 'verify object (SHA/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 (SHA/type) check -- made-up type, nonexisting object' \ + '^fatal: invalid object type' + +cat >tag.sig < 0 +0000 + +EOF + +check_verify_failure 'verify object (SHA/type) check -- incorrect type, valid object' \ '^error: char7: could not verify object.*$' +cat >tag.sig < 0 +0000 + +EOF + +check_verify_failure 'verify object (SHA/type) check -- incorrect type, valid object' \ + '^error: char7: could not verify object' + ############################################################ # 10. verify tag-name check From patchwork Thu Nov 26 22:22:55 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: 11934855 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 5F3B4C71155 for ; Thu, 26 Nov 2020 22:23:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F21272145D for ; Thu, 26 Nov 2020 22:23:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qy6LTFPb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391808AbgKZWXT (ORCPT ); Thu, 26 Nov 2020 17:23:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387685AbgKZWXS (ORCPT ); Thu, 26 Nov 2020 17:23:18 -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 93F28C0613D4 for ; Thu, 26 Nov 2020 14:23:18 -0800 (PST) Received: by mail-wr1-x444.google.com with SMTP id t4so3665635wrr.12 for ; Thu, 26 Nov 2020 14:23:18 -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=2jceSisEQ0O8uzujaoHHu5uF2kPINXx1cZjvV2eLizw=; b=qy6LTFPbH0+uVVhN/vo97KCuinjnZ5H8fTNTY0ceCxvwLvidO5yqG+dpbe/d7x6apo 5sB2+4wx5AblMgkWHtbmv36PXFf8u3I4qeiZ3oCqSateQMpEydSda2FLB81/Sa8QT2HE oYG5K3pal4nPY3bOeT1Gg8GuI2jz75EsHkLzNuByrRU7dV9jEgSjhlVrUYR/Brl/1egk CjQzlBC2efu3eOmH8AvTtRWCdcsLkGV9gszlF6QDJ+86Sbiwp+qzYjEesjJ0cBtKNE8a murOe0EyhaxRFlIn2ZkaaM8gg/eM5Fh9d5xa+wKXOl0CSb0YQ46iLiE02arDHk4NM2CO 0LDQ== 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=2jceSisEQ0O8uzujaoHHu5uF2kPINXx1cZjvV2eLizw=; b=OvYBjBfkxEGWNAJERirh9X6J8K1XSNy3d27zXNoW8U0co67Llc5vMbhqrypQjEC7BU 5g+dUiuqoG34S6qw4a0KpDHlL7/IXnhAsx6KBLKESoxerKxBoviREyQm0MvTYFJs8u/K GeHg5NIP9syn3bzweWxakkmeN1JP4eSRGfvU/KghjQrHxFtR/uCycisu5qhS+GRTpXeE IoKpOyNeHCZ+aCYz1Pbe7t9kI4yEU1rALWts89rt64xfvtNmGI9grmJh0FCBoTQivqLa G3JhMQtga55Y6Zd81zqmCTSH/VzLPUvXbvwNneSB0/YTShYr6uvhuF2XzgZSlzzwzd0/ 4q+Q== X-Gm-Message-State: AOAM531/RhmYOxrt/dvxakh04WpRH6qfP8+x4ErevP8p3JLFHTL/r3tC /sGWXGGYqzdxGR7jHFaxsm0eKQ7jgFxdxw== X-Google-Smtp-Source: ABdhPJwfEN9nr/D6F9H2D1YlgrJ1lyO9iPvo9h5GOCVCRiTNrKg2vEYWX/fX2fx9bmIo4SYw4U7Erg== X-Received: by 2002:adf:fa10:: with SMTP id m16mr6447307wrr.194.1606429397077; Thu, 26 Nov 2020 14:23:17 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id e3sm11283237wro.90.2020.11.26.14.23.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Nov 2020 14:23:16 -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 v2 08/10] fsck: add new "extra" checks for "mktag" Date: Thu, 26 Nov 2020 23:22:55 +0100 Message-Id: <20201126222257.5629-9-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20201126012854.399-1-avarab@gmail.com> References: <20201126012854.399-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Add optional "extra" checks to fsck, these are needed to eventually replace the custom not-quite-fsck code in mktag.c. The mktag checks differ from fsck_tag() in several ways, one of those is that fsck doesn't know how to refuse an object with custom headers, and isn't strict about header and body newline separation. Teach it how to optionally report these. I thought the best way to do that given the current structure of the code was to add a new "extra" category in addition to error/warn/info. 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. By adding an "extra" category and only reporting it based on a flag in fsck_options callers can opt-in to these "extra" messages, which they'll then need to deal with in their own "error_func". No tests are being added for this new functionality, they're added in a subsequent commit where we teach "mktag" to use this new validation mode. I'm not changing fsck_commit() to validate commit objects like this either, we could do that, but unlike in the tag case that code wouldn't be used anywhere. If someone wants to write a "mkcommit" they which behaves like "mktag" they can borrow or refactor this logic for use in fsck_commit(). Signed-off-by: Ævar Arnfjörð Bjarmason --- fsck.c | 32 +++++++++++++++++++++++++++++++- fsck.h | 2 ++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/fsck.c b/fsck.c index f82e2fe9e3..3c25df2244 100644 --- a/fsck.c +++ b/fsck.c @@ -80,7 +80,10 @@ 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) \ + /* extra (only reported when requested) */ \ + FUNC(EXTRA_HEADER_ENTRY, EXTRA) \ + FUNC(EXTRA_HEADER_BODY_NEWLINE, EXTRA) #define MSG_ID(id, msg_type) FSCK_MSG_##id, enum fsck_msg_id { @@ -975,6 +978,33 @@ static int fsck_tag(const struct object_id *oid, const char *buffer, else ret = fsck_ident(&buffer, oid, OBJ_TAG, options); + if (options->extra && *buffer) { + 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; + } + if (starts_with(buffer, "\n\n")) { + /* + * Some callers such as "mktag" want to + * disallow "[...]tagger + * \n\n\nmessage", only allowing a + * single newline for separation. + */ + ret = report(options, oid, OBJ_TAG, FSCK_MSG_EXTRA_HEADER_BODY_NEWLINE, "invalid format - headers separated body by more than one newline"); + if (ret) + goto done; + } + } + done: strbuf_release(&sb); return ret; diff --git a/fsck.h b/fsck.h index 69cf715e79..110efc65fd 100644 --- a/fsck.h +++ b/fsck.h @@ -6,6 +6,7 @@ #define FSCK_ERROR 1 #define FSCK_WARN 2 #define FSCK_IGNORE 3 +#define FSCK_EXTRA 4 struct fsck_options; struct object; @@ -40,6 +41,7 @@ struct fsck_options { unsigned strict:1; int *msg_type; struct oidset skiplist; + unsigned extra:1; kh_oid_map_t *object_names; }; From patchwork Thu Nov 26 22:22:56 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: 11934853 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 8AE9CC64E90 for ; Thu, 26 Nov 2020 22:23:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 274C421527 for ; Thu, 26 Nov 2020 22:23:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="edeiR90M" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391816AbgKZWXW (ORCPT ); Thu, 26 Nov 2020 17:23:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391811AbgKZWXV (ORCPT ); Thu, 26 Nov 2020 17:23:21 -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 1ECE6C0613D4 for ; Thu, 26 Nov 2020 14:23:20 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id 23so3690315wrc.8 for ; Thu, 26 Nov 2020 14:23:20 -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=y8L4+LYw+RSoYjhZrlV3pn6L5V4M7oHyyBgESsEa2ek=; b=edeiR90MqTaHysrweWmE+xBeiutPvYyeoux/yKoOXHfswwD+pWhTiQLskK+WuVAsNH tc0Ta9/qIvvgrrYmMICpigMeXGPpSeUBMoGqSDsONpXyuKjD2Y64Bqza175nS3kW49Gz KOP+/Yo2qhb+RSkebMyrDM6OclCsNW3DSJl2dTxpQpCHbszYKIv0UT7HhhMnYxYdftUO eGLTL8kaFiFrNOLnQWFz44eLzTWHawrkJaibC1IO4QZ95V9OMBK+R2k9EiL0DEYn49Zy gCtmIU8lAFOHiMm88FSv9cHfQ37uOwkR6+byH8CjOvODWGW+sNQO/47x7g6J3Jyb1dKf 0xHQ== 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=y8L4+LYw+RSoYjhZrlV3pn6L5V4M7oHyyBgESsEa2ek=; b=T4e1BK6WBl1HzC6rRxpPY/ny863vdoVXUuyW5iTJSeAOF4t1r4EVfnnsSfq39vgGBz RGbpmVWxDWYpzBChklF856f+UFmIwmPzALJLs84JqschE4EhZ67uyfb6FxCiC7vJRU8Q 8il6Z7olcmhxahLN8N/9dX8pmvB89R8yAXAYx8PtdbmrHt+zFDcxcSjBCdG9xzqFwPsV 5prWdYH8CJ83Zeujt7MLn7ZtkHS63uXBiLR0CqxhvX0s9EvPxPGiqylTwxb7VhkOHQ0j hUPfIj3BE2EedVtzgZe8d0y/aWV78BblI/LY3CYDNmPSGWOuywLaxHxLyXVeyFeDf43y jKKg== X-Gm-Message-State: AOAM530ywnRbp7P3GdV8jjZ1VXKrzUxWU9Od6qXFaYHPS6+gmM/F17kN 3LuPemhUMCFPXI9AageKVo6wDXdPH2+TSw== X-Google-Smtp-Source: ABdhPJySMQ7xMhhfkGhjI62TkNA7sHUkUO7X9lbXB0oTOD8YTLKVahR5nvMmugOu0jo3XWL4enoQwA== X-Received: by 2002:adf:db8e:: with SMTP id u14mr6227436wri.233.1606429398104; Thu, 26 Nov 2020 14:23:18 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id e3sm11283237wro.90.2020.11.26.14.23.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Nov 2020 14:23:17 -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 v2 09/10] mktag: use fsck instead of custom verify_tag() Date: Thu, 26 Nov 2020 23:22:56 +0100 Message-Id: <20201126222257.5629-10-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20201126012854.399-1-avarab@gmail.com> References: <20201126012854.399-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. Moving to fsck_tag() required teaching it to optionally use some validations that only the old mktag code could perform. That was done in an earlier commit, the "extraHeaderEntry" and "extraHeaderBodyNewline" tests being added here make use of that logic. There was other "mktag" validation logic that I think makes sense to just remove. 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. We didn't only lose obscure validation logic, we also gained some: 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. 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 | 197 ++++++++++++-------------------------------- fsck.c | 15 +++- fsck.h | 9 ++ t/t1006-cat-file.sh | 2 +- t/t3800-mktag.sh | 78 +++++++++++------- 5 files changed, 121 insertions(+), 180 deletions(-) diff --git a/builtin/mktag.c b/builtin/mktag.c index dc354828f7..54b0d75ff7 100644 --- a/builtin/mktag.c +++ b/builtin/mktag.c @@ -2,160 +2,61 @@ #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: + case FSCK_EXTRA: + /* + * 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 +65,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.extra = 1; + fsck_options.error_func = mktag_fsck_error_func; + 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 annotated tag object"); diff --git a/fsck.c b/fsck.c index 3c25df2244..97da3a13c6 100644 --- a/fsck.c +++ b/fsck.c @@ -914,6 +914,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; @@ -927,7 +937,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; @@ -943,7 +953,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; diff --git a/fsck.h b/fsck.h index 110efc65fd..cf43046146 100644 --- a/fsck.h +++ b/fsck.h @@ -64,6 +64,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 2f501d2dc9..5d2dc99b74 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 a6a67b6f27..352235353f 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 SHA 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 (SHA/type) check @@ -136,7 +136,7 @@ tagger . <> 0 +0000 EOF check_verify_failure 'verify object (SHA/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 (SHA/type) check -- made-up type, nonexisting object' \ - '^fatal: invalid object type' + '^error:.* badType:' cat >tag.sig < 0 +0000 EOF check_verify_failure 'verify object (SHA/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 (SHA/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 should be one line up +EOF + +check_verify_failure 'detect invalid header entry' \ + '^error:.* extraHeaderBodyNewline:' ############################################################ # 24. create valid tag From patchwork Thu Nov 26 22:22:57 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: 11934849 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 B28EBC71156 for ; Thu, 26 Nov 2020 22:23:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4ED0E2145D for ; Thu, 26 Nov 2020 22:23:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ps57vlNv" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391814AbgKZWXW (ORCPT ); Thu, 26 Nov 2020 17:23:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391803AbgKZWXU (ORCPT ); Thu, 26 Nov 2020 17:23:20 -0500 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C7A5C0617A7 for ; Thu, 26 Nov 2020 14:23:20 -0800 (PST) Received: by mail-wr1-x443.google.com with SMTP id i2so3690979wrs.4 for ; Thu, 26 Nov 2020 14:23:20 -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=ckUBzPn/JbVodRpFcdto2RyPsNA+Bz1CsFO0XUdMCzw=; b=Ps57vlNvnKppH7Gl5ZwjytAk5ZqKTO82xXSa/6yuSSDvN7lz/HpRG80VUGmvfmCjsk 5A0sA5Fqv3Fya7G7PBP4F6E11rqp7ifY4C9cp4ZP9a2sem5pM+3Mr8PeiNnkqgsDxAwy VUeQRUADiV9GPZfr0YM1lMLo6WgT9VGvDYtPkySu8oUxmxOM/Ks8z2jOznrmHXPUMKp6 o9ta0cOfP8UgKEKCf4uPhx4ZexUS3jkrP2qC4kerKpzOIIzQSAUiOK52PqklFXGoWSiY 06xTnxtorHhwpfpSqF0Am+p2YJYMoOTeYO6LJqGciGfSvDpEzuUbWKVvsTgH6jUtMDrt yE3w== 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=ckUBzPn/JbVodRpFcdto2RyPsNA+Bz1CsFO0XUdMCzw=; b=qfps3mia8NNvVQg7Z885C7NK56IyK2x55z3eagyXAIf0VW8htd1hqPl7oNIDopARLe mfzYJtRvKck3fHwuvPAgpmY1c4+4ckcUkPhfYFqf2itHNxinZBa+aiyrdBFxnlYWalKb sWXdQ1bpVdfbYdGvhkgOr075OIz1AqmKiDjuCldR8UiXij72UG1dOS2Sbz1RS1ru1SUU tBT4a6hvyxDbea+iOcK87awdJ8K5VOP7cFGc5HNEcCEmaeHw87DNuzWXBbZAjbDiQ9C6 jrqk15APoxR4GhNfwlnIDK6NoIafvRlvlRISK0sP81AWTSIOqX+s3E3G5VQWN/XGpX9l mLVQ== X-Gm-Message-State: AOAM5309olEOW3+HDdf9wlxZSG4bRNmjAxp6QrVtOtJ+1f0FzuI+oVWc GGVmONt1ZouCc1CgOqcQR2B1+zxwXN4IkA== X-Google-Smtp-Source: ABdhPJzHs622EbmfFvL+oeHM6qoeuEAp1KWEXWt6htLWYWZPN0LCaVIUll5KOlHua+mZIVPf/Hi+bw== X-Received: by 2002:adf:eacb:: with SMTP id o11mr6452198wrn.208.1606429399067; Thu, 26 Nov 2020 14:23:19 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id e3sm11283237wro.90.2020.11.26.14.23.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Nov 2020 14:23:18 -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 v2 10/10] mktag doc: update to explain why to use this Date: Thu, 26 Nov 2020 23:22:57 +0100 Message-Id: <20201126222257.5629-11-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20201126012854.399-1-avarab@gmail.com> References: <20201126012854.399-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 | 29 +++++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/Documentation/git-hash-object.txt b/Documentation/git-hash-object.txt index df9e2c58bd..c535661ced 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 a158428eb9..3ba15072df 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,20 @@ 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 accepts a subset of what linkgit:git-hash-object[1] would +accept with `-t tag --stdin`. I.e. both of these work: + + git mktag