From patchwork Fri Oct 15 20:16:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Glen Choo X-Patchwork-Id: 12562757 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1DBCC433EF for ; Fri, 15 Oct 2021 20:16:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8497D61181 for ; Fri, 15 Oct 2021 20:16:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242964AbhJOUSr (ORCPT ); Fri, 15 Oct 2021 16:18:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232084AbhJOUSp (ORCPT ); Fri, 15 Oct 2021 16:18:45 -0400 Received: from mail-pg1-x54a.google.com (mail-pg1-x54a.google.com [IPv6:2607:f8b0:4864:20::54a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81AD8C061570 for ; Fri, 15 Oct 2021 13:16:38 -0700 (PDT) Received: by mail-pg1-x54a.google.com with SMTP id e6-20020a637446000000b002993ba24bbaso5572877pgn.12 for ; Fri, 15 Oct 2021 13:16:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc:content-transfer-encoding; bh=cv3x/QXRYjD/0tk/79Nk+zelrBdXTVLZVBfgQcyJsn4=; b=QuJpn/KBI3vXXSmdvGsUtkbDoxM5PrSV+aMmTvFWWTah3HYa/UjE0LePFN9gTdQLzP 9FdFNngd/Egf8v/e/8efdz3eY0Wg7xCE0OREVMF7qP/9jBy2FI57wnM7yQdBMaH19+Yq LqTMvUJcOjnHQuCaODmnV/dvBW5wDqKA9ySsZtE1MzBrubPSacZ/JYPUYmKAKnbi7D0K RtjCGwnXfBiXdEBODqsyqeZ28kF7tlx5g+8y0iIRg1DVZLyq1djpjqYJTSuU/dFL5LOT XpeoWk2B3Xk2SilDBTJvMw9ks9yjqr4fcChXD3E7I3GRlbAa4L4BgPEl0nmvI27vEFjh B70A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc:content-transfer-encoding; bh=cv3x/QXRYjD/0tk/79Nk+zelrBdXTVLZVBfgQcyJsn4=; b=WhvONL6MnJUAMvfGwk1dhcJ7Jde5hwFFCo4Xhvv4x7GGZDjpMyZnI2ZUAbpJzectbo lISBQe7L4sVuFhiSEkFciG6nWWhNG74BCX6HKTJMo6in9Ru90/Y6VPutz1sJT9TC5/tu CZ4A+iWrxZN3oj/R3Dha3OnUPSt+U2y95u3cg6//clJG2gQPj6sRLOZRqf/MLl99V1NI 8tAyi8vMZQL7x9rO35us0T2nEDPSWK5bQUwmgbdbGF3sqBCLwdLI+s+jNkfdHswqJ6Za qrgmlsXm5xBpFPmJe7J/KjSLPp0KHY5uk0OnyHqvLbVWbTCHRKZakU1FF8m9DvQDZlbV 4nAw== X-Gm-Message-State: AOAM532LbXOsPIZnWdTOOoP91NLFw9cR9KyCdBYLb5zDGM4S4SC7Z3SP zzEhDSqgBkGtOsRxK/SACWzSf1f0XIlavs+mxosflZS3Vxhf7GfZYjvm2nCqMrXvm9LPspCpQEl STvAj7HC89OOx3ka6KBbJBrX1fDHW3TU7JHX8B/BgE/otIH3JVdolqqJI6ap2VBI= X-Google-Smtp-Source: ABdhPJzEAitzAn73H6Sd0kii6U2vd32L0Xd0btqbSzmMMhd2JjKULZiCzw43Y/Hvpaolljd3lN/TBe0bkoD6TA== X-Received: from chooglen.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:26d9]) (user=chooglen job=sendgmr) by 2002:aa7:8042:0:b0:44c:78ec:c9a9 with SMTP id y2-20020aa78042000000b0044c78ecc9a9mr13602270pfm.45.1634328997882; Fri, 15 Oct 2021 13:16:37 -0700 (PDT) Date: Fri, 15 Oct 2021 13:16:29 -0700 In-Reply-To: <20211015201631.91524-1-chooglen@google.com> Message-Id: <20211015201631.91524-2-chooglen@google.com> Mime-Version: 1.0 References: <20211012174208.95161-1-chooglen@google.com> <20211015201631.91524-1-chooglen@google.com> X-Mailer: git-send-email 2.33.0.1079.g6e70778dc9-goog Subject: [PATCH v5 1/3] fsck: verify commit graph when implicitly enabled From: Glen Choo To: git@vger.kernel.org Cc: Eric Sunshine , Taylor Blau , Junio C Hamano , Derrick Stolee , " =?utf-8?b?w4Z2YXIgQXJuZmrDtnI=?= =?utf-8?b?w7AgQmphcm1hc29u?= " , Glen Choo Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change fsck to check the "core_commit_graph" variable set in "repo-settings.c" instead of reading the "core.commitGraph" variable. This fixes a bug where we wouldn't verify the commit-graph if the config key was missing. This bug was introduced in 31b1de6a09 (commit-graph: turn on commit-graph by default, 2019-08-13), where core.commitGraph was turned on by default. Add tests to "t5318-commit-graph.sh" to verify that fsck checks the commit-graph as expected for the 3 values of core.commitGraph. Also, disable GIT_TEST_COMMIT_GRAPH in t/t0410-partial-clone.sh because some test cases use fsck in ways that assume that commit-graph checking is disabled. Helped-by: Ævar Arnfjörð Bjarmason Signed-off-by: Glen Choo --- builtin/fsck.c | 3 ++- t/t0410-partial-clone.sh | 6 +++++- t/t5318-commit-graph.sh | 23 ++++++++++++++++++++++- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/builtin/fsck.c b/builtin/fsck.c index b42b6fe21f..1c4e485b66 100644 --- a/builtin/fsck.c +++ b/builtin/fsck.c @@ -803,6 +803,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix) fsck_enable_object_names(&fsck_walk_options); git_config(git_fsck_config, &fsck_obj_options); + prepare_repo_settings(the_repository); if (connectivity_only) { for_each_loose_object(mark_loose_for_connectivity, NULL, 0); @@ -908,7 +909,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix) check_connectivity(); - if (!git_config_get_bool("core.commitgraph", &i) && i) { + if (the_repository->settings.core_commit_graph) { struct child_process commit_graph_verify = CHILD_PROCESS_INIT; const char *verify_argv[] = { "commit-graph", "verify", NULL, NULL, NULL }; diff --git a/t/t0410-partial-clone.sh b/t/t0410-partial-clone.sh index bba679685f..c76485b1b6 100755 --- a/t/t0410-partial-clone.sh +++ b/t/t0410-partial-clone.sh @@ -6,6 +6,10 @@ test_description='partial clone' # missing promisor objects cause repacks which write bitmaps to fail GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP=0 +# When enabled, some commands will write commit-graphs. This causes fsck +# to fail when delete_object() is called because fsck will attempt to +# verify the out-of-sync commit graph. +GIT_TEST_COMMIT_GRAPH=0 delete_object () { rm $1/.git/objects/$(echo $2 | sed -e 's|^..|&/|') @@ -322,7 +326,7 @@ test_expect_success 'rev-list stops traversal at missing and promised commit' ' git -C repo config core.repositoryformatversion 1 && git -C repo config extensions.partialclone "arbitrary string" && - GIT_TEST_COMMIT_GRAPH=0 git -C repo -c core.commitGraph=false rev-list --exclude-promisor-objects --objects bar >out && + git -C repo rev-list --exclude-promisor-objects --objects bar >out && grep $(git -C repo rev-parse bar) out && ! grep $FOO out ' diff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh index 84d122a7ae..f516fda7cc 100755 --- a/t/t5318-commit-graph.sh +++ b/t/t5318-commit-graph.sh @@ -694,12 +694,33 @@ test_expect_success 'detect incorrect chunk count' ' $GRAPH_CHUNK_LOOKUP_OFFSET ' -test_expect_success 'git fsck (checks commit-graph)' ' +test_expect_success 'git fsck (checks commit-graph when config set to true)' ' cd "$TRASH_DIRECTORY/full" && git fsck && corrupt_graph_and_verify $GRAPH_BYTE_FOOTER "\00" \ "incorrect checksum" && cp commit-graph-pre-write-test $objdir/info/commit-graph && + test_must_fail git -c core.commitGraph=true fsck +' + +test_expect_success 'git fsck (ignores commit-graph when config set to false)' ' + cd "$TRASH_DIRECTORY/full" && + git fsck && + corrupt_graph_and_verify $GRAPH_BYTE_FOOTER "\00" \ + "incorrect checksum" && + cp commit-graph-pre-write-test $objdir/info/commit-graph && + git -c core.commitGraph=false fsck +' + +test_expect_success 'git fsck (checks commit-graph when config unset)' ' + cd "$TRASH_DIRECTORY/full" && + test_when_finished "git config core.commitGraph true" && + + git fsck && + corrupt_graph_and_verify $GRAPH_BYTE_FOOTER "\00" \ + "incorrect checksum" && + test_unconfig core.commitGraph && + cp commit-graph-pre-write-test $objdir/info/commit-graph && test_must_fail git fsck ' From patchwork Fri Oct 15 20:16:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Glen Choo X-Patchwork-Id: 12562759 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF5EDC433EF for ; Fri, 15 Oct 2021 20:16:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C765460F48 for ; Fri, 15 Oct 2021 20:16:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242974AbhJOUSs (ORCPT ); Fri, 15 Oct 2021 16:18:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242941AbhJOUSr (ORCPT ); Fri, 15 Oct 2021 16:18:47 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8CAEC061570 for ; Fri, 15 Oct 2021 13:16:40 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id z130-20020a256588000000b005b6b4594129so12537911ybb.15 for ; Fri, 15 Oct 2021 13:16:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc:content-transfer-encoding; bh=Us6PMDr8Uo9PiCAV9syzwBOKsy0US747gptRPRZAsT8=; b=kDMNEYKEEGBqL0QlEECFUAkozfEup2gL5ZDC29MaSZ8HZgnDFZZPZVAO3YgzsRADwc p/XGC3YkiztJIyBllACWMRDAiNR8bqxNs93rLVtR1woge8wNHzCeMmGcCZZp91RuNmjY TTgsXHMprvd/JrlMill43xKS5anlZxYUvPuqx6nV3GosA2QF0v7emKW75UoTyCiznPuD km46/s+blpeGthhVIza3ATD2kfZdIWMLIIezmEOmBQKMOSf8u/NrH4wdO9Ae4tSjWTz8 kze/QRDLgrBM72PE+fGJhlBe7jTaaxlPfTPeWDIR8qP+eKo3A6Zgm6fCvqgIqzg4Z33W os4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc:content-transfer-encoding; bh=Us6PMDr8Uo9PiCAV9syzwBOKsy0US747gptRPRZAsT8=; b=g9FLAlKUHBNlUESGzWA8XlnePlgDuf+NH8KOI4SyPVTNo+9yhdnAB3cWK820KB52Fu Gzf5me70HShXsQ1Eb5UPoBK8UdRIAySwTwmyMj6Lv5anWqX7ooGJsdVX83d0S4Qg0Rl6 ATXDmRZnabbb3bkjKNXqChyIRrW6U0vOZLQcJuVrgT+row55nm3q53tfx3v6rAuTQXRW 5FIooDQhc9i1QEjUF16ncFOhP1+dcJ4gIf5f6A18N6bQL8mU5cWLWmGCFPSL5U0Vvf4l dvbpMQMZFTm34WvtHZJI9fvmSXW5ruiJ21h+G3uOLChR2tyhuXi24JNxX74MqSsiQRvQ 1+4g== X-Gm-Message-State: AOAM533ag4Rqvl0gjmZs77wQ73IvNIs+MAwoFaI29SXlPbv1oGQtMPbp xIeJM6x0+XRyp42KxEd1KA43otQxD29HlwFGLWfeP9u+sGA6HPykqaemnMcJBvw0y9wODCUD3mi FgGpHUvK4+dAcTmZ6Q3tNLPN98XvLz5mog7OhDRA8hoZUm3bx3Rya5Jbo0MAATyU= X-Google-Smtp-Source: ABdhPJyMLmtZ63FZ7PIRJuP5bkn3Ak83/EcTPE+qUkOIY9HuZ8UkSYir0PodKHZHZmt88oQEFRuSGwhlN8RX3g== X-Received: from chooglen.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:26d9]) (user=chooglen job=sendgmr) by 2002:a25:ccd1:: with SMTP id l200mr15528238ybf.140.1634328999847; Fri, 15 Oct 2021 13:16:39 -0700 (PDT) Date: Fri, 15 Oct 2021 13:16:30 -0700 In-Reply-To: <20211015201631.91524-1-chooglen@google.com> Message-Id: <20211015201631.91524-3-chooglen@google.com> Mime-Version: 1.0 References: <20211012174208.95161-1-chooglen@google.com> <20211015201631.91524-1-chooglen@google.com> X-Mailer: git-send-email 2.33.0.1079.g6e70778dc9-goog Subject: [PATCH v5 2/3] fsck: verify multi-pack-index when implictly enabled From: Glen Choo To: git@vger.kernel.org Cc: Eric Sunshine , Taylor Blau , Junio C Hamano , Derrick Stolee , " =?utf-8?b?w4Z2YXIgQXJuZmrDtnI=?= =?utf-8?b?w7AgQmphcm1hc29u?= " , Glen Choo Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Like the previous commit, change fsck to check the "core_multi_pack_index" variable set in "repo-settings.c" instead of reading the "core.multiPackIndex" config variable. This fixes a bug where we wouldn't verify midx if the config key was missing. This bug was introduced in 18e449f86b (midx: enable core.multiPackIndex by default, 2020-09-25) where core.multiPackIndex was turned on by default. Helped-by: Ævar Arnfjörð Bjarmason Signed-off-by: Glen Choo --- builtin/fsck.c | 2 +- t/t5319-multi-pack-index.sh | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/builtin/fsck.c b/builtin/fsck.c index 1c4e485b66..5bbe8068ec 100644 --- a/builtin/fsck.c +++ b/builtin/fsck.c @@ -925,7 +925,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix) } } - if (!git_config_get_bool("core.multipackindex", &i) && i) { + if (the_repository->settings.core_multi_pack_index) { struct child_process midx_verify = CHILD_PROCESS_INIT; const char *midx_argv[] = { "multi-pack-index", "verify", NULL, NULL, NULL }; diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh index bd17f308b3..38999f115f 100755 --- a/t/t5319-multi-pack-index.sh +++ b/t/t5319-multi-pack-index.sh @@ -452,7 +452,10 @@ test_expect_success 'verify incorrect offset' ' test_expect_success 'git-fsck incorrect offset' ' corrupt_midx_and_verify $MIDX_BYTE_OFFSET "\377" $objdir \ "incorrect object offset" \ - "git -c core.multipackindex=true fsck" + "git -c core.multiPackIndex=true fsck" && + test_unconfig core.multiPackIndex && + test_must_fail git fsck && + git -c core.multiPackIndex=false fsck ' test_expect_success 'corrupt MIDX is not reused' ' From patchwork Fri Oct 15 20:16:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Glen Choo X-Patchwork-Id: 12562761 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9801C433EF for ; Fri, 15 Oct 2021 20:16:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9D8A860EE2 for ; Fri, 15 Oct 2021 20:16:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242971AbhJOUSx (ORCPT ); Fri, 15 Oct 2021 16:18:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242941AbhJOUSt (ORCPT ); Fri, 15 Oct 2021 16:18:49 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98165C061570 for ; Fri, 15 Oct 2021 13:16:42 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id y18-20020a25a092000000b005bddb39f160so10962935ybh.10 for ; Fri, 15 Oct 2021 13:16:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=AWuPO+FVFJmGP5qoN/nPTJvrJHzGFTibBhJ7m0xywW4=; b=B8e0uts0NPPNufJRRCBptgWSjJnQaVw080edJTnQRC0FdbxX5C1YxSCu9UtdjLHYsj RCNqwRswiRiCQo87C4ZEAN0/odq+cYf5GfS6bj6KFyA7wCmFdJlt9YzmaCvNIZTqcwu+ RJNUOV9cWzxLo+dASh8D7LT+eJAiLlH/ZXwc3i/qJxTAEQ55agw8x20iztNZngAwOtLZ tGntTwQGZNsxG9iKrCxfQ2LMaMT5KLmKz0W3+uZUXAst4m7E2GDXgZTadIu4fAmU53kY yGwq45pNRjtE2+HZaMXxzk/MJ0nhTC8PydfAhz1Lmb+7J7M7yU+RJw0OJ+dScAtV6iR4 ke4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=AWuPO+FVFJmGP5qoN/nPTJvrJHzGFTibBhJ7m0xywW4=; b=e32BTjdhY9eSLuPU10nIgFzBdk2MVy4usWcNnRyrlnvU/qNVmvKTyAWUoQN4Bs1D+A G1i3YIonwPN4NNqLrGhZCi7z31O7FG7l3dbTWaIpHgOV4iOhkPQ7plEJD1nre9CFXV1E hXJxQOcIo0rTS/vlobNdxPYbZWFf61LTcV0aIFgH7hEyUkp52UK01893EiYKAQIcMnA/ 1o74LlrpRW1zylHK9HJcXcC7meXVOuscY07InlXkGECVyYOAxRKxdcjPuZhldqLoK/k8 8u9SkZLvCjIsKOtUcL2PdkzBo2EIjpw8yJCXsrOsggraGfuokDLPzg4YPL6dg9QR9hgC CR7Q== X-Gm-Message-State: AOAM533V2wnJUGRWqxqRJtzUMDtBrNnlhQ46AJ2CUgHPlTYbXqYDzKWP ML5xYkCrHaQ3N0Qzava/vaak+Mm+xaITeGvBwB+ol3L8RPkZ9Qc03LyzVks8vbeMnS1JK3sL/FU SQZloVBzsVCgK9dxQ+aM2aZd5vBhj6MSFsE8A4zBwKwUibsvADWSSJ3TeyzZAvm8= X-Google-Smtp-Source: ABdhPJzGIJsfKk0H2f12/xnzkBeqULc5izIiyJaKkHFBBwcxvyuGQJqL9SmyMqJU7WwqBfY4pdFXgCnFDKRmig== X-Received: from chooglen.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:26d9]) (user=chooglen job=sendgmr) by 2002:a25:dac5:: with SMTP id n188mr15253066ybf.85.1634329001786; Fri, 15 Oct 2021 13:16:41 -0700 (PDT) Date: Fri, 15 Oct 2021 13:16:31 -0700 In-Reply-To: <20211015201631.91524-1-chooglen@google.com> Message-Id: <20211015201631.91524-4-chooglen@google.com> Mime-Version: 1.0 References: <20211012174208.95161-1-chooglen@google.com> <20211015201631.91524-1-chooglen@google.com> X-Mailer: git-send-email 2.33.0.1079.g6e70778dc9-goog Subject: [PATCH v5 3/3] gc: perform incremental repack when implictly enabled From: Glen Choo To: git@vger.kernel.org Cc: Eric Sunshine , Taylor Blau , Junio C Hamano , Derrick Stolee , " =?utf-8?b?w4Z2YXIgQXJuZmrDtnI=?= =?utf-8?b?w7AgQmphcm1hc29u?= " , Glen Choo Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org builtin/gc.c has two ways of checking if multi-pack-index is enabled: - git_config_get_bool() in incremental_repack_auto_condition() - the_repository->settings.core_multi_pack_index in maintenance_task_incremental_repack() The two implementations have existed since the incremental-repack task was introduced in e841a79a13 (maintenance: add incremental-repack auto condition, 2020-09-25). These two values can diverge because prepare_repo_settings() enables the feature in the_repository->settings by default. In the case where core.multiPackIndex is not set in the config, the auto condition would fail, causing the incremental-repack task to not be run. Because we always want to consider the default values, we should always use the_repository->settings. Standardize on using the_repository->settings.core_multi_pack_index to check if multi-pack-index is enabled. Signed-off-by: Glen Choo --- builtin/gc.c | 5 ++--- t/t7900-maintenance.sh | 28 ++++++++++++++++++++++++---- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/builtin/gc.c b/builtin/gc.c index 6b3de3dd51..2670931160 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -1049,12 +1049,11 @@ static int maintenance_task_loose_objects(struct maintenance_run_opts *opts) static int incremental_repack_auto_condition(void) { struct packed_git *p; - int enabled; int incremental_repack_auto_limit = 10; int count = 0; - if (git_config_get_bool("core.multiPackIndex", &enabled) || - !enabled) + prepare_repo_settings(the_repository); + if (!the_repository->settings.core_multi_pack_index) return 0; git_config_get_int("maintenance.incremental-repack.auto", diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh index 9b9f11a8e7..74aa638475 100755 --- a/t/t7900-maintenance.sh +++ b/t/t7900-maintenance.sh @@ -336,15 +336,15 @@ test_expect_success EXPENSIVE 'incremental-repack 2g limit' ' --no-progress --batch-size=2147483647 /dev/null && test_subcommand ! git multi-pack-index write --no-progress /dev/null && test_subcommand ! git multi-pack-index write --no-progress /dev/null && test_subcommand git multi-pack-index write --no-progress