maintenance: add --schedule option and config

Maintenance currently triggers when certain data-size thresholds are
met, such as number of pack-files or loose objects. Users may want to
run certain maintenance tasks based on frequency instead. For example,
a user may want to perform a 'prefetch' task every hour, or 'gc' task
every day. To help these users, update the 'git maintenance run' command
to include a '--schedule=<frequency>' option. The allowed frequencies
are 'hourly', 'daily', and 'weekly'. These values are also allowed in a
new config value 'maintenance.<task>.schedule'.

The 'git maintenance run --schedule=<frequency>' checks the '*.schedule'
config value for each enabled task to see if the configured frequency is
at least as frequent as the frequency from the '--schedule' argument. We
use the following order, for full clarity:

	'hourly' > 'daily' > 'weekly'

Use new 'enum schedule_priority' to track these values numerically.

The following cron table would run the scheduled tasks with the correct
frequencies:

  0 1-23 * * *    git -C <repo> maintenance run --schedule=hourly
  0 0    * * 1-6  git -C <repo> maintenance run --schedule=daily
  0 0    * * 0    git -C <repo> maintenance run --schedule=weekly

This cron schedule will run --schedule=hourly every hour except at
midnight. This avoids a concurrent run with the --schedule=daily that
runs at midnight every day except the first day of the week. This avoids
a concurrent run with the --schedule=weekly that runs at midnight on
the first day of the week. Since --schedule=daily also runs the
'hourly' tasks and --schedule=weekly runs the 'hourly' and 'daily'
tasks, we will still see all tasks run with the proper frequencies.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 files changed
tree: 29e8e198383ab652429d07e8d724ef9915ccef0c
  1. .github/
  2. block-sha1/
  3. builtin/
  4. ci/
  5. compat/
  6. contrib/
  7. Documentation/
  8. ewah/
  9. git-gui/
  10. gitk-git/
  11. gitweb/
  12. mergetools/
  13. negotiator/
  14. perl/
  15. po/
  16. ppc/
  17. refs/
  18. sha1dc/
  19. sha256/
  20. t/
  21. templates/
  22. trace2/
  23. vcs-svn/
  24. xdiff/
  25. .cirrus.yml
  26. .clang-format
  27. .editorconfig
  28. .gitattributes
  29. .gitignore
  30. .gitmodules
  31. .mailmap
  32. .travis.yml
  33. .tsan-suppressions
  34. abspath.c
  35. aclocal.m4
  36. add-interactive.c
  37. add-interactive.h
  38. add-patch.c
  39. advice.c
  40. advice.h
  41. alias.c
  42. alias.h
  43. alloc.c
  44. alloc.h
  45. apply.c
  46. apply.h
  47. archive-tar.c
  48. archive-zip.c
  49. archive.c
  50. archive.h
  51. attr.c
  52. attr.h
  53. banned.h
  54. base85.c
  55. bisect.c
  56. bisect.h
  57. blame.c
  58. blame.h
  59. blob.c
  60. blob.h
  61. bloom.c
  62. bloom.h
  63. branch.c
  64. branch.h
  65. bugreport.c
  66. builtin.h
  67. bulk-checkin.c
  68. bulk-checkin.h
  69. bundle.c
  70. bundle.h
  71. cache-tree.c
  72. cache-tree.h
  73. cache.h
  74. chdir-notify.c
  75. chdir-notify.h
  76. check-builtins.sh
  77. check_bindir
  78. checkout.c
  79. checkout.h
  80. CODE_OF_CONDUCT.md
  81. color.c
  82. color.h
  83. column.c
  84. column.h
  85. combine-diff.c
  86. command-list.txt
  87. commit-graph.c
  88. commit-graph.h
  89. commit-reach.c
  90. commit-reach.h
  91. commit-slab-decl.h
  92. commit-slab-impl.h
  93. commit-slab.h
  94. commit.c
  95. commit.h
  96. common-main.c
  97. config.c
  98. config.h
  99. config.mak.dev
  100. config.mak.in
  101. config.mak.uname
  102. configure.ac
  103. connect.c
  104. connect.h
  105. connected.c
  106. connected.h
  107. convert.c
  108. convert.h
  109. copy.c
  110. COPYING
  111. credential-cache--daemon.c
  112. credential-cache.c
  113. credential-store.c
  114. credential.c
  115. credential.h
  116. csum-file.c
  117. csum-file.h
  118. ctype.c
  119. daemon.c
  120. date.c
  121. decorate.c
  122. decorate.h
  123. delta-islands.c
  124. delta-islands.h
  125. delta.h
  126. detect-compiler
  127. diff-delta.c
  128. diff-lib.c
  129. diff-no-index.c
  130. diff.c
  131. diff.h
  132. diffcore-break.c
  133. diffcore-delta.c
  134. diffcore-order.c
  135. diffcore-pickaxe.c
  136. diffcore-rename.c
  137. diffcore.h
  138. dir-iterator.c
  139. dir-iterator.h
  140. dir.c
  141. dir.h
  142. editor.c
  143. entry.c
  144. environment.c
  145. exec-cmd.c
  146. exec-cmd.h
  147. fast-import.c
  148. fetch-negotiator.c
  149. fetch-negotiator.h
  150. fetch-pack.c
  151. fetch-pack.h
  152. fmt-merge-msg.c
  153. fmt-merge-msg.h
  154. fsck.c
  155. fsck.h
  156. fsmonitor.c
  157. fsmonitor.h
  158. fuzz-commit-graph.c
  159. fuzz-pack-headers.c
  160. fuzz-pack-idx.c
  161. generate-cmdlist.sh
  162. generate-configlist.sh
  163. gettext.c
  164. gettext.h
  165. git-add--interactive.perl
  166. git-archimport.perl
  167. git-bisect.sh
  168. git-compat-util.h
  169. git-cvsexportcommit.perl
  170. git-cvsimport.perl
  171. git-cvsserver.perl
  172. git-difftool--helper.sh
  173. git-filter-branch.sh
  174. git-instaweb.sh
  175. git-merge-octopus.sh
  176. git-merge-one-file.sh
  177. git-merge-resolve.sh
  178. git-mergetool--lib.sh
  179. git-mergetool.sh
  180. git-p4.py
  181. git-parse-remote.sh
  182. git-quiltimport.sh
  183. git-rebase--preserve-merges.sh
  184. git-request-pull.sh
  185. git-send-email.perl
  186. git-sh-i18n.sh
  187. git-sh-setup.sh
  188. git-submodule.sh
  189. git-svn.perl
  190. GIT-VERSION-GEN
  191. git-web--browse.sh
  192. git.c
  193. git.rc
  194. gpg-interface.c
  195. gpg-interface.h
  196. graph.c
  197. graph.h
  198. grep.c
  199. grep.h
  200. hash.h
  201. hashmap.c
  202. hashmap.h
  203. help.c
  204. help.h
  205. hex.c
  206. http-backend.c
  207. http-fetch.c
  208. http-push.c
  209. http-walker.c
  210. http.c
  211. http.h
  212. ident.c
  213. imap-send.c
  214. INSTALL
  215. interdiff.c
  216. interdiff.h
  217. iterator.h
  218. json-writer.c
  219. json-writer.h
  220. khash.h
  221. kwset.c
  222. kwset.h
  223. levenshtein.c
  224. levenshtein.h
  225. LGPL-2.1
  226. line-log.c
  227. line-log.h
  228. line-range.c
  229. line-range.h
  230. linear-assignment.c
  231. linear-assignment.h
  232. list-objects-filter-options.c
  233. list-objects-filter-options.h
  234. list-objects-filter.c
  235. list-objects-filter.h
  236. list-objects.c
  237. list-objects.h
  238. list.h
  239. ll-merge.c
  240. ll-merge.h
  241. lockfile.c
  242. lockfile.h
  243. log-tree.c
  244. log-tree.h
  245. ls-refs.c
  246. ls-refs.h
  247. mailinfo.c
  248. mailinfo.h
  249. mailmap.c
  250. mailmap.h
  251. Makefile
  252. match-trees.c
  253. mem-pool.c
  254. mem-pool.h
  255. merge-blobs.c
  256. merge-blobs.h
  257. merge-recursive.c
  258. merge-recursive.h
  259. merge.c
  260. mergesort.c
  261. mergesort.h
  262. midx.c
  263. midx.h
  264. name-hash.c
  265. notes-cache.c
  266. notes-cache.h
  267. notes-merge.c
  268. notes-merge.h
  269. notes-utils.c
  270. notes-utils.h
  271. notes.c
  272. notes.h
  273. object-store.h
  274. object.c
  275. object.h
  276. oid-array.c
  277. oid-array.h
  278. oidmap.c
  279. oidmap.h
  280. oidset.c
  281. oidset.h
  282. pack-bitmap-write.c
  283. pack-bitmap.c
  284. pack-bitmap.h
  285. pack-check.c
  286. pack-objects.c
  287. pack-objects.h
  288. pack-revindex.c
  289. pack-revindex.h
  290. pack-write.c
  291. pack.h
  292. packfile.c
  293. packfile.h
  294. pager.c
  295. parse-options-cb.c
  296. parse-options.c
  297. parse-options.h
  298. patch-delta.c
  299. patch-ids.c
  300. patch-ids.h
  301. path.c
  302. path.h
  303. pathspec.c
  304. pathspec.h
  305. pkt-line.c
  306. pkt-line.h
  307. preload-index.c
  308. pretty.c
  309. pretty.h
  310. prio-queue.c
  311. prio-queue.h
  312. progress.c
  313. progress.h
  314. promisor-remote.c
  315. promisor-remote.h
  316. prompt.c
  317. prompt.h
  318. protocol.c
  319. protocol.h
  320. prune-packed.c
  321. prune-packed.h
  322. quote.c
  323. quote.h
  324. range-diff.c
  325. range-diff.h
  326. reachable.c
  327. reachable.h
  328. read-cache.c
  329. README.md
  330. rebase-interactive.c
  331. rebase-interactive.h
  332. rebase.c
  333. rebase.h
  334. ref-filter.c
  335. ref-filter.h
  336. reflog-walk.c
  337. reflog-walk.h
  338. refs.c
  339. refs.h
  340. refspec.c
  341. refspec.h
  342. remote-curl.c
  343. remote-testsvn.c
  344. remote.c
  345. remote.h
  346. replace-object.c
  347. replace-object.h
  348. repo-settings.c
  349. repository.c
  350. repository.h
  351. rerere.c
  352. rerere.h
  353. reset.c
  354. reset.h
  355. resolve-undo.c
  356. resolve-undo.h
  357. revision.c
  358. revision.h
  359. run-command.c
  360. run-command.h
  361. send-pack.c
  362. send-pack.h
  363. sequencer.c
  364. sequencer.h
  365. serve.c
  366. serve.h
  367. server-info.c
  368. setup.c
  369. sh-i18n--envsubst.c
  370. sha1-file.c
  371. sha1-lookup.c
  372. sha1-lookup.h
  373. sha1-name.c
  374. sha1dc_git.c
  375. sha1dc_git.h
  376. shallow.c
  377. shallow.h
  378. shell.c
  379. shortlog.h
  380. sideband.c
  381. sideband.h
  382. sigchain.c
  383. sigchain.h
  384. split-index.c
  385. split-index.h
  386. stable-qsort.c
  387. strbuf.c
  388. strbuf.h
  389. streaming.c
  390. streaming.h
  391. string-list.c
  392. string-list.h
  393. strvec.c
  394. strvec.h
  395. sub-process.c
  396. sub-process.h
  397. submodule-config.c
  398. submodule-config.h
  399. submodule.c
  400. submodule.h
  401. symlinks.c
  402. tag.c
  403. tag.h
  404. tar.h
  405. tempfile.c
  406. tempfile.h
  407. thread-utils.c
  408. thread-utils.h
  409. tmp-objdir.c
  410. tmp-objdir.h
  411. trace.c
  412. trace.h
  413. trace2.c
  414. trace2.h
  415. trailer.c
  416. trailer.h
  417. transport-helper.c
  418. transport-internal.h
  419. transport.c
  420. transport.h
  421. tree-diff.c
  422. tree-walk.c
  423. tree-walk.h
  424. tree.c
  425. tree.h
  426. unicode-width.h
  427. unimplemented.sh
  428. unix-socket.c
  429. unix-socket.h
  430. unpack-trees.c
  431. unpack-trees.h
  432. upload-pack.c
  433. upload-pack.h
  434. url.c
  435. url.h
  436. urlmatch.c
  437. urlmatch.h
  438. usage.c
  439. userdiff.c
  440. userdiff.h
  441. utf8.c
  442. utf8.h
  443. varint.c
  444. varint.h
  445. version.c
  446. version.h
  447. versioncmp.c
  448. walker.c
  449. walker.h
  450. wildmatch.c
  451. wildmatch.h
  452. worktree.c
  453. worktree.h
  454. wrap-for-bin.sh
  455. wrapper.c
  456. write-or-die.c
  457. ws.c
  458. wt-status.c
  459. wt-status.h
  460. xdiff-interface.c
  461. xdiff-interface.h
  462. zlib.c
README.md

Build status

Git - fast, scalable, distributed revision control system

Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals.

Git is an Open Source project covered by the GNU General Public License version 2 (some parts of it are under different licenses, compatible with the GPLv2). It was originally written by Linus Torvalds with help of a group of hackers around the net.

Please read the file INSTALL for installation instructions.

Many Git online resources are accessible from https://git-scm.com/ including full documentation and Git related tools.

See Documentation/gittutorial.txt to get started, then see Documentation/giteveryday.txt for a useful minimum set of commands, and Documentation/git-<commandname>.txt for documentation of each command. If git has been correctly installed, then the tutorial can also be read with man gittutorial or git help tutorial, and the documentation of each command with man git-<commandname> or git help <commandname>.

CVS users may also want to read Documentation/gitcvs-migration.txt (man gitcvs-migration or git help cvs-migration if git is installed).

The user discussion and development of Git take place on the Git mailing list -- everyone is welcome to post bug reports, feature requests, comments and patches to git@vger.kernel.org (read Documentation/SubmittingPatches for instructions on patch submission). To subscribe to the list, send an email with just “subscribe git” in the body to majordomo@vger.kernel.org. The mailing list archives are available at https://lore.kernel.org/git/, http://marc.info/?l=git and other archival sites.

Issues which are security relevant should be disclosed privately to the Git Security mailing list git-security@googlegroups.com.

The maintainer frequently sends the “What's cooking” reports that list the current status of various development topics to the mailing list. The discussion following them give a good reference for project status, development direction and remaining tasks.

The name “git” was given by Linus Torvalds when he wrote the very first version. He described the tool as “the stupid content tracker” and the name as (depending on your mood):

  • random three-letter combination that is pronounceable, and not actually used by any common UNIX command. The fact that it is a mispronunciation of “get” may or may not be relevant.
  • stupid. contemptible and despicable. simple. Take your pick from the dictionary of slang.
  • “global information tracker”: you're in a good mood, and it actually works for you. Angels sing, and a light suddenly fills the room.
  • “goddamn idiotic truckload of sh*t”: when it breaks