connected: add "auto" connectivity check mode

The incremental connectivity check pays a per-commit cost.  For
every incoming commit it reads the new trees along the changed
paths, and the trees at the same paths in its parents to compare
against.  A parent tree is often read again even though an earlier
commit already read it: on git.git, about a third of the tree reads
for 2000 incoming commits are such re-reads.  The full check
instead pays a mostly fixed cost for walking the boundary trees,
so with many incoming commits the incremental check becomes the
slower one (see the previous commit).  Users who mostly
receive small pushes but occasionally a large one should not have
to choose between the two.

Add an "auto" value for transfer.connectivityCheck that picks the
mode based on the incoming history.  When the revision walk is
limited, which is the case whenever the receiving repository has
references, the incoming commit list is already computed by
limit_list(), so counting it is cheap.  "auto" then uses the
incremental check for up to 1000 incoming commits, and the full
check above that.

The cutoff is a fixed constant based on the p5413 fixture in the
previous commit, where breakeven is between 500 and 3000 commits.
It is conservative for repositories with large trees, where the
fixed cost of the full check is higher.  Measured on real
repositories (rev-list against a single boundary commit, mean
of at least 10 runs):

    repository   files  commits    full  incr.  full/incr
    internal A    556K     1000   1.71s  0.61s    2.8x
    internal A    556K     4000   2.78s  2.83s    1.0x
    internal B    288K     1000   1.78s  0.88s    2.0x
    linux          95K      598   0.33s  0.12s    2.7x
    linux          95K     1728   0.56s  0.35s    1.6x
    git           4.9K      984   0.22s  0.27s    0.8x

With small trees incremental can be slower within the cutoff,
but both modes are fast enough there (0.22s vs 0.27s for git
above) that the difference does not matter in practice.

No single cutoff is optimal for every repository, so it can be set
with "auto=<cutoff>"; plain "auto" uses 1000.  A malformed cutoff
is treated like any other unknown value: it falls back to "full"
with a warning.

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

GitHub build status GitLab 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.adoc to get started, then see Documentation/giteveryday.adoc for a useful minimum set of commands, and Documentation/git-<commandname>.adoc 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.adoc (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 and Documentation/CodingGuidelines).

Those wishing to help with error message, usage and informational message string translations (localization l10) should see po/README.md (a po file is a Portable Object file that holds the translations).

To subscribe to the list, send an email to git+subscribe@vger.kernel.org (see https://subspace.kernel.org/subscribing.html for details). The mailing list archives are available at https://lore.kernel.org/git/, https://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