From: Glen Choo <chooglen@google.com>
To: git@vger.kernel.org
Cc: "Eric Sunshine" <sunshine@sunshineco.com>,
"Taylor Blau" <me@ttaylorr.com>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
"Junio C Hamano" <gitster@pobox.com>,
"Glen Choo" <chooglen@google.com>
Subject: [PATCH v4 3/3] gc: perform incremental repack when implictly enabled
Date: Tue, 12 Oct 2021 10:42:08 -0700 [thread overview]
Message-ID: <20211012174208.95161-4-chooglen@google.com> (raw)
In-Reply-To: <20211012174208.95161-1-chooglen@google.com>
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 <chooglen@google.com>
---
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 <run-2g.txt
'
-test_expect_success 'maintenance.incremental-repack.auto' '
+run_incremental_repack_and_verify () {
+ test_commit A &&
git repack -adk &&
- git config core.multiPackIndex true &&
git multi-pack-index write &&
GIT_TRACE2_EVENT="$(pwd)/midx-init.txt" git \
-c maintenance.incremental-repack.auto=1 \
maintenance run --auto --task=incremental-repack 2>/dev/null &&
test_subcommand ! git multi-pack-index write --no-progress <midx-init.txt &&
- test_commit A &&
+ test_commit B &&
git pack-objects --revs .git/objects/pack/pack <<-\EOF &&
HEAD
^HEAD~1
@@ -353,7 +353,7 @@ test_expect_success 'maintenance.incremental-repack.auto' '
-c maintenance.incremental-repack.auto=2 \
maintenance run --auto --task=incremental-repack 2>/dev/null &&
test_subcommand ! git multi-pack-index write --no-progress <trace-A &&
- test_commit B &&
+ test_commit C &&
git pack-objects --revs .git/objects/pack/pack <<-\EOF &&
HEAD
^HEAD~1
@@ -362,6 +362,26 @@ test_expect_success 'maintenance.incremental-repack.auto' '
-c maintenance.incremental-repack.auto=2 \
maintenance run --auto --task=incremental-repack 2>/dev/null &&
test_subcommand git multi-pack-index write --no-progress <trace-B
+}
+
+test_expect_success 'maintenance.incremental-repack.auto' '
+ rm -rf incremental-repack-true &&
+ git init incremental-repack-true &&
+ (
+ cd incremental-repack-true &&
+ git config core.multiPackIndex true &&
+ run_incremental_repack_and_verify
+ )
+'
+
+test_expect_success 'maintenance.incremental-repack.auto (when config is unset)' '
+ rm -rf incremental-repack-unset &&
+ git init incremental-repack-unset &&
+ (
+ cd incremental-repack-unset &&
+ test_unconfig core.multiPackIndex &&
+ run_incremental_repack_and_verify
+ )
'
test_expect_success 'pack-refs task' '
--
2.33.0.882.g93a45727a2-goog
next prev parent reply other threads:[~2021-10-12 17:42 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-13 18:12 [PATCH 0/3] Use default values from settings instead of config Glen Choo
2021-09-13 18:12 ` [PATCH 1/3] fsck: verify commit graph when implicitly enabled Glen Choo
2021-09-13 19:29 ` Taylor Blau
2021-09-13 19:33 ` Eric Sunshine
2021-09-13 19:36 ` Taylor Blau
2021-09-13 23:15 ` Glen Choo
2021-09-13 23:32 ` Eric Sunshine
2021-09-14 1:09 ` Taylor Blau
2021-09-14 2:05 ` Eric Sunshine
2021-09-14 1:07 ` Taylor Blau
2021-09-13 18:12 ` [PATCH 2/3] fsck: verify multi-pack-index when implictly enabled Glen Choo
2021-09-13 19:35 ` Taylor Blau
2021-09-13 18:12 ` [PATCH 3/3] gc: perform incremental repack " Glen Choo
2021-09-13 19:37 ` Taylor Blau
2021-09-14 17:41 ` Glen Choo
2021-09-14 4:00 ` Bagas Sanjaya
2021-09-16 17:15 ` Glen Choo
2021-09-13 19:19 ` [PATCH 0/3] Use default values from settings instead of config Taylor Blau
2021-09-17 22:54 ` [PATCH v2 " Glen Choo
2021-09-17 22:54 ` [PATCH v2 1/3] fsck: verify commit graph when implicitly enabled Glen Choo
2021-09-29 6:09 ` Eric Sunshine
2021-09-30 18:00 ` Glen Choo
2021-09-30 18:35 ` Glen Choo
2021-09-30 18:39 ` Eric Sunshine
2021-10-01 17:28 ` Glen Choo
2021-09-17 22:54 ` [PATCH v2 2/3] fsck: verify multi-pack-index when implictly enabled Glen Choo
2021-09-29 6:20 ` Eric Sunshine
2021-09-29 22:56 ` Glen Choo
2021-09-17 22:54 ` [PATCH v2 3/3] gc: perform incremental repack " Glen Choo
2021-09-29 6:39 ` Eric Sunshine
2021-09-27 17:59 ` [PATCH v2 0/3] Use default values from settings instead of config Glen Choo
2021-09-29 6:43 ` Eric Sunshine
2021-09-29 22:53 ` Glen Choo
2021-10-05 0:19 ` [PATCH v3 " Glen Choo
2021-10-05 0:19 ` [PATCH v3 1/3] fsck: verify commit graph when implicitly enabled Glen Choo
2021-10-05 0:19 ` [PATCH v3 2/3] fsck: verify multi-pack-index when implictly enabled Glen Choo
2021-10-05 0:19 ` [PATCH v3 3/3] gc: perform incremental repack " Glen Choo
2021-10-05 11:57 ` [PATCH v3 0/3] Use default values from settings instead of config Ævar Arnfjörð Bjarmason
2021-10-05 17:43 ` Derrick Stolee
2021-10-05 19:10 ` Ævar Arnfjörð Bjarmason
2021-10-05 22:25 ` Glen Choo
2021-10-09 7:24 ` Junio C Hamano
2021-10-11 19:58 ` Glen Choo
2021-10-11 20:08 ` Junio C Hamano
2021-10-11 20:48 ` Glen Choo
2021-10-12 17:42 ` [PATCH v4 " Glen Choo
2021-10-12 17:42 ` [PATCH v4 1/3] fsck: verify commit graph when implicitly enabled Glen Choo
2021-10-12 17:42 ` [PATCH v4 2/3] fsck: verify multi-pack-index when implictly enabled Glen Choo
2021-10-12 17:42 ` Glen Choo [this message]
2021-10-12 20:23 ` [PATCH v4 0/3] Use default values from settings instead of config Junio C Hamano
2021-10-12 20:34 ` Ævar Arnfjörð Bjarmason
2021-10-12 22:29 ` Glen Choo
2021-10-14 15:53 ` Ævar Arnfjörð Bjarmason
2021-10-13 13:12 ` Derrick Stolee
2021-10-13 15:57 ` Ævar Arnfjörð Bjarmason
2021-10-14 16:53 ` Derrick Stolee
2021-10-14 22:21 ` Glen Choo
2021-10-14 23:38 ` Ævar Arnfjörð Bjarmason
2021-10-14 22:25 ` Junio C Hamano
2021-10-15 15:57 ` Junio C Hamano
2021-10-15 20:16 ` [PATCH v5 " Glen Choo
2021-10-15 20:16 ` [PATCH v5 1/3] fsck: verify commit graph when implicitly enabled Glen Choo
2021-10-15 20:16 ` [PATCH v5 2/3] fsck: verify multi-pack-index when implictly enabled Glen Choo
2021-10-15 20:16 ` [PATCH v5 3/3] gc: perform incremental repack " Glen Choo
2021-10-15 21:31 ` [PATCH v5 0/3] Use default values from settings instead of config Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211012174208.95161-4-chooglen@google.com \
--to=chooglen@google.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=me@ttaylorr.com \
--cc=sunshine@sunshineco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).