rev-list: ignore replacements in the connectivity check

The connectivity check follows replace refs, but other operations
that depend on the repository being complete, such as fsck, prune,
pack-objects and upload-pack, do not. They were taught to ignore
replacements in dae556bdb1 (environment: add global variable to
disable replacement, 2009-01-23), as they must work with the
original objects, and check_connected() came later without doing
the same.

Teach the connectivity check to ignore replacements as well, so
that it verifies the same objects that the commands relying on its
result will read. This is not a problem seen in practice, but the
two can disagree. If a replace ref names an object that is not yet
present locally, the check follows the replacement instead of that
object when it arrives, and accepts an incoming pack that lacks
objects below it. fsck and repack then fail. Such a replace ref can
be the result of fetching refs/replace/* without the branch that
contains the replaced commit, which fsck does not complain about,
but it still takes a sender that sends an incomplete pack.

check_connected() passes --connectivity-check to its rev-list
subprocess, so make rev-list disable replacements when that option
is given, for both the full and the incremental check. Also drop
OBJECT_INFO_LOOKUP_REPLACE from the object reads in tree-verify.c,
used by the incremental check, to match. Disabling replacements
already overrides the flag, but it suggests the opposite intent.

The t5413 test that expected the check to accept a commit whose
original tree is incomplete because a replacement is complete now
expects a rejection, and the test that disabled replacements
explicitly to get one is redundant.

Signed-off-by: Kristofer Karlsson <krka@spotify.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 files changed
tree: 7ddb1206a3028b4d6e07d8ccd02b34555ebd70e4
  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