Skip to content

Commit 1e8962e

Browse files
committed
Merge branch 'ps/maintenance-detach-fix'
Maintenance tasks other than "gc" now properly go background when "git maintenance" runs them. * ps/maintenance-detach-fix: run-command: fix detaching when running auto maintenance builtin/maintenance: add a `--detach` flag builtin/gc: add a `--detach` flag builtin/gc: stop processing log file on signal builtin/gc: fix leaking config values builtin/gc: refactor to read config into structure config: fix constness of out parameter for `git_config_get_expiry()`
2 parents 6a09c36 + 98077d0 commit 1e8962e

12 files changed

+397
-171
lines changed

Documentation/config/gc.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ use, it'll affect how the auto pack limit works.
4040

4141
gc.autoDetach::
4242
Make `git gc --auto` return immediately and run in the background
43-
if the system supports it. Default is true.
43+
if the system supports it. Default is true. This config variable acts
44+
as a fallback in case `maintenance.autoDetach` is not set.
4445

4546
gc.bigPackThreshold::
4647
If non-zero, all non-cruft packs larger than this limit are kept

Documentation/config/maintenance.txt

+11
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@ maintenance.auto::
33
`git maintenance run --auto` after doing their normal work. Defaults
44
to true.
55

6+
maintenance.autoDetach::
7+
Many Git commands trigger automatic maintenance after they have
8+
written data into the repository. This boolean config option
9+
controls whether this automatic maintenance shall happen in the
10+
foreground or whether the maintenance process shall detach and
11+
continue to run in the background.
12+
+
13+
If unset, the value of `gc.autoDetach` is used as a fallback. Defaults
14+
to true if both are unset, meaning that the maintenance process will
15+
detach.
16+
617
maintenance.strategy::
718
This string config option provides a way to specify one of a few
819
recommended schedules for background maintenance. This only affects

Documentation/git-gc.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ git-gc - Cleanup unnecessary files and optimize the local repository
99
SYNOPSIS
1010
--------
1111
[verse]
12-
'git gc' [--aggressive] [--auto] [--quiet] [--prune=<date> | --no-prune] [--force] [--keep-largest-pack]
12+
'git gc' [--aggressive] [--auto] [--[no-]detach] [--quiet] [--prune=<date> | --no-prune] [--force] [--keep-largest-pack]
1313

1414
DESCRIPTION
1515
-----------
@@ -53,6 +53,9 @@ configuration options such as `gc.auto` and `gc.autoPackLimit`, all
5353
other housekeeping tasks (e.g. rerere, working trees, reflog...) will
5454
be performed as well.
5555

56+
--[no-]detach::
57+
Run in the background if the system supports it. This option overrides
58+
the `gc.autoDetach` config.
5659

5760
--[no-]cruft::
5861
When expiring unreachable objects, pack them separately into a

0 commit comments

Comments
 (0)