From patchwork Mon Mar 14 07:42:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 12779698 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2363C433EF for ; Mon, 14 Mar 2022 07:43:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236790AbiCNHoL (ORCPT ); Mon, 14 Mar 2022 03:44:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236795AbiCNHoE (ORCPT ); Mon, 14 Mar 2022 03:44:04 -0400 Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16ED2F12 for ; Mon, 14 Mar 2022 00:42:54 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id E11165C017C; Mon, 14 Mar 2022 03:42:53 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Mon, 14 Mar 2022 03:42:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; bh=kKRznbqlFAHQRc/CUQPCts4nlnjomHEvpDJ4NH NFOVQ=; b=eG+QyxG9lk2ZwjzoGsJ5KF24vIHsVHr/y9hKOZ1JIjCVUsZp7y8q8Q ZMoaXf64q8M6wmjC9i2ldMS7IwIOsPka39CZpvAJOMcSyxZDk0VsXy8Gg3CA9U4l pVjqBbBsVOR+FJuh7Otl9oPHNFLrd+arEFe9kXyC8RaxopdM5QM9O+Uc8s5E7sSA LSzVA2JXEIGhv1FZFLzfDpuvdhwduQEW8dXGCvnLPnMAo4QJOsiBYWK6GRD/8fj4 yAudgPsoXb2GAtZ2ddGWOqUbKImAFgtzjJVlgpxBmbeTZ7Dr1N8WLFlrbJGmgb21 640jziEtbqoMvtZqNbeNn6RFbYJ9huVQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=kKRznbqlFAHQRc/CU QPCts4nlnjomHEvpDJ4NHNFOVQ=; b=XCfaFWpE/qwF3QAmhKd19iwVM7SBKX+yN xIXwYoQbVNhP8Bmk+vzFqA1V+EJJzM87Ka9ZXhqkFAUZ/wXq8mso/6sF+vndME1s Jjen9kugZIszHFxiSk88eb+efmzRHlU/I5LdyOOxrtoxrFUCPYb4y7FjWQjn1XlJ EsPUxL//rEOw4P1B9tSL5wEVVrZ4+BpHmFfF3jyAJiO0C3xvKArGFVW+WHi8dPut d/DBr4bW7bOnNZ8HXOWc+3fB1leuL65ODYflUVY4l+0qktB1PKE98Jk3LysAW6qB ewidKviv/WGiXdD69YsOS6xjU6eG9ARlFs0McEu+tMMInZrWNgwlQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddruddvjedguddutdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffukfhfgggtuggjsehgtd erredttddvnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshes phhkshdrihhmqeenucggtffrrghtthgvrhhnpeehgefhtdefueffheekgfffudelffejtd fhvdejkedthfehvdelgfetgfdvtedthfenucevlhhushhtvghrufhiiigvpedtnecurfgr rhgrmhepmhgrihhlfhhrohhmpehpshesphhkshdrihhm X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 14 Mar 2022 03:42:53 -0400 (EDT) Received: from localhost (ncase [10.192.0.11]) by vm-mail.pks.im (OpenSMTPD) with ESMTPSA id 9d78b34c (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 14 Mar 2022 07:42:52 +0000 (UTC) Date: Mon, 14 Mar 2022 08:42:51 +0100 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Taylor Blau Subject: [PATCH v2 2/2] repack: add config to skip updating server info Message-ID: References: <659d5528df56f6b9aece6b1f3c4e2e5a4ae04e1e.1646996936.git.ps@pks.im> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org By default, git-repack(1) will update server info that is required by the dumb HTTP transport. This can be skipped by passing the `-n` flag, but what we're noticably missing is a config option to permanently disable updating this information. Add a new option "repack.updateServerInfo" which can be used to disable the logic. Most hosting providers have turned off the dumb HTTP protocol anyway, and on the client-side it woudln't typically be useful either. Giving a persistent way to disable this feature thus makes quite some sense to avoid wasting compute cycles and storage. Signed-off-by: Patrick Steinhardt --- Documentation/config/repack.txt | 5 +++++ builtin/repack.c | 6 +++++- t/t7700-repack.sh | 18 ++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Documentation/config/repack.txt b/Documentation/config/repack.txt index 9c413e177e..41ac6953c8 100644 --- a/Documentation/config/repack.txt +++ b/Documentation/config/repack.txt @@ -25,3 +25,8 @@ repack.writeBitmaps:: space and extra time spent on the initial repack. This has no effect if multiple packfiles are created. Defaults to true on bare repos, false otherwise. + +repack.updateServerInfo:: + If set to false, linkgit:git-repack[1] will not run + linkgit:git-update-server-info[1]. Defaults to true. Can be overridden + when true by the `-n` option of linkgit:git-repack[1]. diff --git a/builtin/repack.c b/builtin/repack.c index f2ac8ad14b..d1a563d5b6 100644 --- a/builtin/repack.c +++ b/builtin/repack.c @@ -22,6 +22,7 @@ static int delta_base_offset = 1; static int pack_kept_objects = -1; static int write_bitmaps = -1; static int use_delta_islands; +static int run_update_server_info = 1; static char *packdir, *packtmp_name, *packtmp; static const char *const git_repack_usage[] = { @@ -54,6 +55,10 @@ static int repack_config(const char *var, const char *value, void *cb) use_delta_islands = git_config_bool(var, value); return 0; } + if (strcmp(var, "repack.updateserverinfo") == 0) { + run_update_server_info = git_config_bool(var, value); + return 0; + } return git_default_config(var, value, cb); } @@ -620,7 +625,6 @@ int cmd_repack(int argc, const char **argv, const char *prefix) const char *unpack_unreachable = NULL; int keep_unreachable = 0; struct string_list keep_pack_list = STRING_LIST_INIT_NODUP; - int run_update_server_info = 1; struct pack_objects_args po_args = {NULL}; int geometric_factor = 0; int write_midx = 0; diff --git a/t/t7700-repack.sh b/t/t7700-repack.sh index 6b387bbdbe..770d143204 100755 --- a/t/t7700-repack.sh +++ b/t/t7700-repack.sh @@ -413,4 +413,22 @@ test_expect_success '-n skips updating server info' ' test_server_info_missing ' +test_expect_success 'repack.updateServerInfo=true updates server info' ' + test_server_info_cleanup && + git -C update-server-info -c repack.updateServerInfo=true repack && + test_server_info_present +' + +test_expect_success 'repack.updateServerInfo=false skips updating server info' ' + test_server_info_cleanup && + git -C update-server-info -c repack.updateServerInfo=false repack && + test_server_info_missing +' + +test_expect_success '-n overrides repack.updateServerInfo=true' ' + test_server_info_cleanup && + git -C update-server-info -c repack.updateServerInfo=true repack -n && + test_server_info_missing +' + test_done