зеркало из https://github.com/microsoft/git.git
2fec604f8d
Add new subcommands to 'git maintenance' that start or stop background maintenance using 'cron', when available. This integration is as simple as I could make it, barring some implementation complications. The schedule is laid out as follows: 0 1-23 * * * $cmd maintenance run --schedule=hourly 0 0 * * 1-6 $cmd maintenance run --schedule=daily 0 0 * * 0 $cmd maintenance run --schedule=weekly where $cmd is a properly-qualified 'git for-each-repo' execution: $cmd=$path/git --exec-path=$path for-each-repo --config=maintenance.repo where $path points to the location of the Git executable running 'git maintenance start'. This is critical for systems with multiple versions of Git. Specifically, macOS has a system version at '/usr/bin/git' while the version that users can install resides at '/usr/local/bin/git' (symlinked to '/usr/local/libexec/git-core/git'). This will also use your locally-built version if you build and run this in your development environment without installing first. This conditional schedule avoids having cron launch multiple 'git for-each-repo' commands in parallel. Such parallel commands would likely lead to the 'hourly' and 'daily' tasks competing over the object database lock. This could lead to to some tasks never being run! Since the --schedule=<frequency> argument will run all tasks with _at least_ the given frequency, the daily runs will also run the hourly tasks. Similarly, the weekly runs will also run the daily and hourly tasks. The GIT_TEST_CRONTAB environment variable is not intended for users to edit, but instead as a way to mock the 'crontab [-l]' command. This variable is set in test-lib.sh to avoid a future test from accidentally running anything with the cron integration from modifying the user's schedule. We use GIT_TEST_CRONTAB='test-tool crontab <file>' in our tests to check how the schedule is modified in 'git maintenance (start|stop)' commands. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> |
||
---|---|---|
.. | ||
.gitignore | ||
test-advise.c | ||
test-bloom.c | ||
test-chmtime.c | ||
test-config.c | ||
test-crontab.c | ||
test-ctype.c | ||
test-date.c | ||
test-delta.c | ||
test-dir-iterator.c | ||
test-drop-caches.c | ||
test-dump-cache-tree.c | ||
test-dump-fsmonitor.c | ||
test-dump-split-index.c | ||
test-dump-untracked-cache.c | ||
test-example-decorate.c | ||
test-fake-ssh.c | ||
test-genrandom.c | ||
test-genzeros.c | ||
test-hash-speed.c | ||
test-hash.c | ||
test-hashmap.c | ||
test-index-version.c | ||
test-json-writer.c | ||
test-lazy-init-name-hash.c | ||
test-line-buffer.c | ||
test-match-trees.c | ||
test-mergesort.c | ||
test-mktemp.c | ||
test-oid-array.c | ||
test-oidmap.c | ||
test-online-cpus.c | ||
test-parse-options.c | ||
test-parse-pathspec-file.c | ||
test-path-utils.c | ||
test-pkt-line.c | ||
test-prio-queue.c | ||
test-progress.c | ||
test-reach.c | ||
test-read-cache.c | ||
test-read-graph.c | ||
test-read-midx.c | ||
test-ref-store.c | ||
test-regex.c | ||
test-repository.c | ||
test-revision-walking.c | ||
test-run-command.c | ||
test-scrap-cache-tree.c | ||
test-serve-v2.c | ||
test-sha1.c | ||
test-sha1.sh | ||
test-sha256.c | ||
test-sigchain.c | ||
test-strcmp-offset.c | ||
test-string-list.c | ||
test-submodule-config.c | ||
test-submodule-nested-repo-config.c | ||
test-subprocess.c | ||
test-svn-fe.c | ||
test-tool.c | ||
test-tool.h | ||
test-trace2.c | ||
test-urlmatch-normalization.c | ||
test-wildmatch.c | ||
test-windows-named-pipe.c | ||
test-write-cache.c | ||
test-xml-encode.c |