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>
72 lines
3.1 KiB
C
72 lines
3.1 KiB
C
#ifndef TEST_TOOL_H
|
|
#define TEST_TOOL_H
|
|
|
|
#define USE_THE_INDEX_COMPATIBILITY_MACROS
|
|
#include "git-compat-util.h"
|
|
|
|
int cmd__advise_if_enabled(int argc, const char **argv);
|
|
int cmd__bloom(int argc, const char **argv);
|
|
int cmd__chmtime(int argc, const char **argv);
|
|
int cmd__config(int argc, const char **argv);
|
|
int cmd__crontab(int argc, const char **argv);
|
|
int cmd__ctype(int argc, const char **argv);
|
|
int cmd__date(int argc, const char **argv);
|
|
int cmd__delta(int argc, const char **argv);
|
|
int cmd__dir_iterator(int argc, const char **argv);
|
|
int cmd__drop_caches(int argc, const char **argv);
|
|
int cmd__dump_cache_tree(int argc, const char **argv);
|
|
int cmd__dump_fsmonitor(int argc, const char **argv);
|
|
int cmd__dump_split_index(int argc, const char **argv);
|
|
int cmd__dump_untracked_cache(int argc, const char **argv);
|
|
int cmd__example_decorate(int argc, const char **argv);
|
|
int cmd__genrandom(int argc, const char **argv);
|
|
int cmd__genzeros(int argc, const char **argv);
|
|
int cmd__hashmap(int argc, const char **argv);
|
|
int cmd__hash_speed(int argc, const char **argv);
|
|
int cmd__index_version(int argc, const char **argv);
|
|
int cmd__json_writer(int argc, const char **argv);
|
|
int cmd__lazy_init_name_hash(int argc, const char **argv);
|
|
int cmd__match_trees(int argc, const char **argv);
|
|
int cmd__mergesort(int argc, const char **argv);
|
|
int cmd__mktemp(int argc, const char **argv);
|
|
int cmd__oidmap(int argc, const char **argv);
|
|
int cmd__online_cpus(int argc, const char **argv);
|
|
int cmd__parse_options(int argc, const char **argv);
|
|
int cmd__parse_pathspec_file(int argc, const char** argv);
|
|
int cmd__path_utils(int argc, const char **argv);
|
|
int cmd__pkt_line(int argc, const char **argv);
|
|
int cmd__prio_queue(int argc, const char **argv);
|
|
int cmd__progress(int argc, const char **argv);
|
|
int cmd__reach(int argc, const char **argv);
|
|
int cmd__read_cache(int argc, const char **argv);
|
|
int cmd__read_graph(int argc, const char **argv);
|
|
int cmd__read_midx(int argc, const char **argv);
|
|
int cmd__ref_store(int argc, const char **argv);
|
|
int cmd__regex(int argc, const char **argv);
|
|
int cmd__repository(int argc, const char **argv);
|
|
int cmd__revision_walking(int argc, const char **argv);
|
|
int cmd__run_command(int argc, const char **argv);
|
|
int cmd__scrap_cache_tree(int argc, const char **argv);
|
|
int cmd__serve_v2(int argc, const char **argv);
|
|
int cmd__sha1(int argc, const char **argv);
|
|
int cmd__oid_array(int argc, const char **argv);
|
|
int cmd__sha256(int argc, const char **argv);
|
|
int cmd__sigchain(int argc, const char **argv);
|
|
int cmd__strcmp_offset(int argc, const char **argv);
|
|
int cmd__string_list(int argc, const char **argv);
|
|
int cmd__submodule_config(int argc, const char **argv);
|
|
int cmd__submodule_nested_repo_config(int argc, const char **argv);
|
|
int cmd__subprocess(int argc, const char **argv);
|
|
int cmd__trace2(int argc, const char **argv);
|
|
int cmd__urlmatch_normalization(int argc, const char **argv);
|
|
int cmd__xml_encode(int argc, const char **argv);
|
|
int cmd__wildmatch(int argc, const char **argv);
|
|
#ifdef GIT_WINDOWS_NATIVE
|
|
int cmd__windows_named_pipe(int argc, const char **argv);
|
|
#endif
|
|
int cmd__write_cache(int argc, const char **argv);
|
|
|
|
int cmd_hash_impl(int ac, const char **av, int algo);
|
|
|
|
#endif
|