Skip to content

Commit 50d7425

Browse files
committed
Merge branch 'ps/maintenance-geometric-default'
"git maintenance" starts using the "geometric" strategy by default. * ps/maintenance-geometric-default: builtin/maintenance: use "geometric" strategy by default t7900: prepare for switch of the default strategy t6500: explicitly use "gc" strategy t5510: explicitly use "gc" strategy t5400: explicitly use "gc" strategy t34xx: don't expire reflogs where it matters t: disable maintenance where we verify object database structure t: fix races caused by background maintenance
2 parents 1ebfc21 + 452b12c commit 50d7425

23 files changed

Lines changed: 64 additions & 12 deletions

Documentation/config/maintenance.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ The possible strategies are:
3030
+
3131
* `none`: This strategy implies no tasks are run at all. This is the default
3232
strategy for scheduled maintenance.
33-
* `gc`: This strategy runs the `gc` task. This is the default strategy for
34-
manual maintenance.
33+
* `gc`: This strategy runs the `gc` task.
3534
* `geometric`: This strategy performs geometric repacking of packfiles and
3635
keeps auxiliary data structures up-to-date. The strategy expires data in the
3736
reflog and removes worktrees that cannot be located anymore. When the
@@ -40,7 +39,8 @@ The possible strategies are:
4039
are already part of a cruft pack will be expired.
4140
+
4241
This repacking strategy is a full replacement for the `gc` strategy and is
43-
recommended for large repositories.
42+
recommended for large repositories. This is the default strategy for manual
43+
maintenance.
4444
* `incremental`: This setting optimizes for performing small maintenance
4545
activities that do not delete any data. This does not schedule the `gc`
4646
task, but runs the `prefetch` and `commit-graph` tasks hourly, the

builtin/gc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1980,7 +1980,7 @@ static void initialize_task_config(struct maintenance_run_opts *opts,
19801980
strategy = none_strategy;
19811981
type = MAINTENANCE_TYPE_SCHEDULED;
19821982
} else {
1983-
strategy = gc_strategy;
1983+
strategy = geometric_strategy;
19841984
type = MAINTENANCE_TYPE_MANUAL;
19851985
}
19861986

run-command.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1828,7 +1828,7 @@ int prepare_auto_maintenance(int quiet, struct child_process *maint)
18281828
*/
18291829
if (repo_config_get_bool(the_repository, "maintenance.autodetach", &auto_detach) &&
18301830
repo_config_get_bool(the_repository, "gc.autodetach", &auto_detach))
1831-
auto_detach = 1;
1831+
auto_detach = git_env_bool("GIT_TEST_MAINT_AUTO_DETACH", true);
18321832

18331833
maint->git_cmd = 1;
18341834
maint->close_object_store = 1;

t/t0081-find-pack.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ test_expect_success 'add more packfiles' '
6868
'
6969

7070
test_expect_success 'add more commits (as loose objects)' '
71+
test_config maintenance.auto false &&
7172
test_commit six &&
7273
test_commit seven &&
7374

t/t3404-rebase-interactive.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ Initial setup:
3131
. "$TEST_DIRECTORY"/lib-rebase.sh
3232

3333
test_expect_success 'setup' '
34+
# Commit dates are hardcoded to 2005, and the reflog entries will have
35+
# a matching timestamp. Maintenance may thus immediately expire
36+
# reflogs if it was running.
37+
git config set gc.reflogExpire never &&
38+
git config set gc.reflogExpireUnreachable never &&
39+
3440
git switch -C primary &&
3541
test_commit A file1 &&
3642
test_commit B file1 &&

t/t3406-rebase-message.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
88
. ./test-lib.sh
99

1010
test_expect_success 'setup' '
11+
# Commit dates are hardcoded to 2005, and the reflog entries will have
12+
# a matching timestamp. Maintenance may thus immediately expire
13+
# reflogs if it was running.
14+
git config set gc.reflogExpire never &&
15+
git config set gc.reflogExpireUnreachable never &&
16+
1117
test_commit O fileO &&
1218
test_commit X fileX &&
1319
git branch fast-forward &&

t/t3431-rebase-fork-point.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
1717
# C was formerly part of main but main was rewound to remove C
1818
#
1919
test_expect_success setup '
20+
# Commit dates are hardcoded to 2005, and the reflog entries will have
21+
# a matching timestamp. Maintenance may thus immediately expire
22+
# reflogs if it was running.
23+
git config set gc.reflogExpire never &&
24+
git config set gc.reflogExpireUnreachable never &&
25+
2026
test_commit A &&
2127
test_commit B &&
2228
test_commit C &&

t/t3432-rebase-fast-forward.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
1111
. ./test-lib.sh
1212

1313
test_expect_success setup '
14+
# Commit dates are hardcoded to 2005, and the reflog entries will have
15+
# a matching timestamp. Maintenance may thus immediately expire
16+
# reflogs if it was running.
17+
git config set gc.reflogExpire never &&
18+
git config set gc.reflogExpireUnreachable never &&
19+
1420
test_commit A &&
1521
test_commit B &&
1622
test_commit C &&

t/t5316-pack-delta-depth.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ test_description='pack-objects breaks long cross-pack delta chains'
4848
# repeatedly-modified file to generate the delta chain).
4949

5050
test_expect_success 'create series of packs' '
51+
test_config maintenance.auto false &&
5152
test-tool genrandom foo 4096 >content &&
5253
prev= &&
5354
for i in $(test_seq 1 10)

t/t5319-multi-pack-index.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,6 +1315,7 @@ test_expect_success 'bitmapped packs are stored via the BTMP chunk' '
13151315
git init repo &&
13161316
(
13171317
cd repo &&
1318+
git config set maintenance.auto false &&
13181319
13191320
for i in 1 2 3 4 5
13201321
do

0 commit comments

Comments
 (0)