New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maintenance builtin, allowing 'gc --auto' customization #671
Changes from all commits
62986fd
51b78c7
621471d
1dbbfd2
ea80307
271bc35
9cc6fc8
d571b1a
cb26dfa
00697e7
da495f6
fc68305
8e4513f
9186e89
54cd6e0
7568fcc
ba4c627
eecdf99
bce1308
a78dbc7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,6 +90,7 @@ | |
/git-ls-tree | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Đoàn Trần Công Danh wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Jonathan Nieder wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Jonathan Nieder wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Jonathan Nieder wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Jonathan Nieder wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Jonathan Nieder wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
|
||
/git-mailinfo | ||
/git-mailsplit | ||
/git-maintenance | ||
/git-merge | ||
/git-merge-base | ||
/git-merge-index | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
maintenance.<task>.enabled:: | ||
This boolean config option controls whether the maintenance task | ||
with name `<task>` is run when no `--task` option is specified. | ||
By default, only `maintenance.gc.enabled` is true. | ||
|
||
maintenance.commit-graph.auto:: | ||
This integer config option controls how often the `commit-graph` task | ||
should be run as part of `git maintenance run --auto`. If zero, then | ||
the `commit-graph` task will not run with the `--auto` option. A | ||
negative value will force the task to run every time. Otherwise, a | ||
positive value implies the command should run when the number of | ||
reachable commits that are not in the commit-graph file is at least | ||
the value of `maintenance.commit-graph.auto`. The default value is | ||
100. | ||
|
||
maintenance.loose-objects.auto:: | ||
This integer config option controls how often the `loose-objects` task | ||
should be run as part of `git maintenance run --auto`. If zero, then | ||
the `loose-objects` task will not run with the `--auto` option. A | ||
negative value will force the task to run every time. Otherwise, a | ||
positive value implies the command should run when the number of | ||
loose objects is at least the value of `maintenance.loose-objects.auto`. | ||
The default value is 100. | ||
|
||
maintenance.incremental-repack.auto:: | ||
This integer config option controls how often the `incremental-repack` | ||
task should be run as part of `git maintenance run --auto`. If zero, | ||
then the `incremental-repack` task will not run with the `--auto` | ||
option. A negative value will force the task to run every time. | ||
Otherwise, a positive value implies the command should run when the | ||
number of pack-files not in the multi-pack-index is at least the value | ||
of `maintenance.incremental-repack.auto`. The default value is 10. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,16 @@ documented in linkgit:git-config[1]. | |
--dry-run:: | ||
Show what would be done, without making any changes. | ||
|
||
ifndef::git-pull[] | ||
--[no-]write-fetch-head:: | ||
Write the list of remote refs fetched in the `FETCH_HEAD` | ||
file directly under `$GIT_DIR`. This is the default unless | ||
the configuration variable `fetch.writeFetchHEAD` is set to | ||
false. Passing `--no-write-fetch-head` from the command | ||
line tells Git not to write the file. Under `--dry-run` | ||
option, the file is never written. | ||
endif::git-pull[] | ||
|
||
-f:: | ||
--force:: | ||
When 'git fetch' is used with `<src>:<dst>` refspec it may | ||
|
@@ -86,9 +96,11 @@ ifndef::git-pull[] | |
Allow several <repository> and <group> arguments to be | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Taylor Blau wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Eric Sunshine wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
|
||
specified. No <refspec>s may be specified. | ||
|
||
--[no-]auto-maintenance:: | ||
--[no-]auto-gc:: | ||
Run `git gc --auto` at the end to perform garbage collection | ||
if needed. This is enabled by default. | ||
Run `git maintenance run --auto` at the end to perform automatic | ||
repository maintenance if needed. (`--[no-]auto-gc` is a synonym.) | ||
This is enabled by default. | ||
|
||
--[no-]write-commit-graph:: | ||
Write a commit-graph after fetching. This overrides the config | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
git-maintenance(1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Jonathan Tan wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Jeff King wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Jonathan Tan wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Taylor Blau wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Đoàn Trần Công Danh wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Phillip Wood wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Phillip Wood wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Jeff King wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Emily Shaffer wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Emily Shaffer wrote (reply to this):
|
||
================== | ||
|
||
NAME | ||
---- | ||
git-maintenance - Run tasks to optimize Git repository data | ||
|
||
|
||
SYNOPSIS | ||
-------- | ||
[verse] | ||
'git maintenance' run [<options>] | ||
|
||
|
||
DESCRIPTION | ||
----------- | ||
Run tasks to optimize Git repository data, speeding up other Git commands | ||
and reducing storage requirements for the repository. | ||
|
||
Git commands that add repository data, such as `git add` or `git fetch`, | ||
are optimized for a responsive user experience. These commands do not take | ||
time to optimize the Git data, since such optimizations scale with the full | ||
size of the repository while these user commands each perform a relatively | ||
small action. | ||
|
||
The `git maintenance` command provides flexibility for how to optimize the | ||
Git repository. | ||
|
||
SUBCOMMANDS | ||
----------- | ||
|
||
run:: | ||
Run one or more maintenance tasks. If one or more `--task` options | ||
are specified, then those tasks are run in that order. Otherwise, | ||
the tasks are determined by which `maintenance.<task>.enabled` | ||
config options are true. By default, only `maintenance.gc.enabled` | ||
is true. | ||
|
||
TASKS | ||
----- | ||
|
||
commit-graph:: | ||
The `commit-graph` job updates the `commit-graph` files incrementally, | ||
then verifies that the written data is correct. If the new layer has an | ||
issue, then the chain file is removed and the `commit-graph` is | ||
rewritten from scratch. | ||
+ | ||
The incremental write is safe to run alongside concurrent Git processes | ||
since it will not expire `.graph` files that were in the previous | ||
`commit-graph-chain` file. They will be deleted by a later run based on | ||
the expiration delay. | ||
|
||
prefetch:: | ||
The `prefetch` task updates the object directory with the latest | ||
objects from all registered remotes. For each remote, a `git fetch` | ||
command is run. The refmap is custom to avoid updating local or remote | ||
branches (those in `refs/heads` or `refs/remotes`). Instead, the | ||
remote refs are stored in `refs/prefetch/<remote>/`. Also, tags are | ||
not updated. | ||
+ | ||
This is done to avoid disrupting the remote-tracking branches. The end users | ||
expect these refs to stay unmoved unless they initiate a fetch. With prefetch | ||
task, however, the objects necessary to complete a later real fetch would | ||
already be obtained, so the real fetch would go faster. In the ideal case, | ||
it will just become an update to bunch of remote-tracking branches without | ||
any object transfer. | ||
|
||
gc:: | ||
Cleanup unnecessary files and optimize the local repository. "GC" | ||
stands for "garbage collection," but this task performs many | ||
smaller tasks. This task can be rather expensive for large | ||
repositories, as it repacks all Git objects into a single pack-file. | ||
It can also be disruptive in some situations, as it deletes stale | ||
data. | ||
|
||
loose-objects:: | ||
The `loose-objects` job cleans up loose objects and places them into | ||
pack-files. In order to prevent race conditions with concurrent Git | ||
commands, it follows a two-step process. First, it deletes any loose | ||
objects that already exist in a pack-file; concurrent Git processes | ||
will examine the pack-file for the object data instead of the loose | ||
object. Second, it creates a new pack-file (starting with "loose-") | ||
containing a batch of loose objects. The batch size is limited to 50 | ||
thousand objects to prevent the job from taking too long on a | ||
repository with many loose objects. | ||
|
||
incremental-repack:: | ||
The `incremental-repack` job repacks the object directory | ||
using the `multi-pack-index` feature. In order to prevent race | ||
conditions with concurrent Git commands, it follows a two-step | ||
process. First, it deletes any pack-files included in the | ||
`multi-pack-index` where none of the objects in the | ||
`multi-pack-index` reference those pack-files; this only happens | ||
if all objects in the pack-file are also stored in a newer | ||
pack-file. Second, it selects a group of pack-files whose "expected | ||
size" is below the batch size until the group has total expected | ||
size at least the batch size; see the `--batch-size` option for | ||
the `repack` subcommand in linkgit:git-multi-pack-index[1]. The | ||
default batch-size is zero, which is a special case that attempts | ||
to repack all pack-files into a single pack-file. | ||
|
||
OPTIONS | ||
------- | ||
--auto:: | ||
When combined with the `run` subcommand, run maintenance tasks | ||
only if certain thresholds are met. For example, the `gc` task | ||
runs when the number of loose objects exceeds the number stored | ||
in the `gc.auto` config setting, or when the number of pack-files | ||
exceeds the `gc.autoPackLimit` config setting. | ||
|
||
--quiet:: | ||
Do not report progress or other information over `stderr`. | ||
|
||
--task=<task>:: | ||
If this option is specified one or more times, then only run the | ||
specified tasks in the specified order. | ||
|
||
GIT | ||
--- | ||
Part of the linkgit:git[1] suite |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, Taylor Blau wrote (reply to this):