builtin/fsck: don't check alternates with "--no-full"

According to git-fsck(1), the "--full" option behaves in the following
way:

  Check not just objects in GIT_OBJECT_DIRECTORY ($GIT_DIR/objects), but
  also the ones found in alternate object pools listed in
  GIT_ALTERNATE_OBJECT_DIRECTORIES or $GIT_DIR/objects/info/alternates,
  and in packed Git archives found in $GIT_DIR/objects/pack and
  corresponding pack subdirectories in alternate object pools.

So ultimately, it is supposed to control two things: (1) whether we only
check the main object directory, and (2) whether we check packfiles.

In its current state though, the flag only controls whether we check
packfiles or not, and if so we verify packfiles of all attached sources.
But we also have checks for loose objects in git-fsck(1), and here we
unconditionally check them in all sources.

The flag is arguably conflating two unrelated concerns with one another,
and it really should be split up into two flags: one that controls how
thorough we want to check individual sources, and one that controls
which sources we want to check in the first place. So ideally, we would
have:

  - "--include-alternates": check all sources, not only the local one.

  - "--include-optimized-objects": check not only loose objects, but
    also those that have been packed. Note that we explicitly don't say
    "--include-packed-objects" here to be more backend-agnostic.

  - "--full": implies both of the above flags.

This feels out of scope for this series though. So for now, simply fix
the code by honoring locality of the sources for loose objects.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 files changed
tree: 2b57fc650a1777f32b27c072274f532239c497e6
  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. statinfo.c
  477. statinfo.h
  478. strbuf.c
  479. strbuf.h
  480. string-list.c
  481. string-list.h
  482. strmap.c
  483. strmap.h
  484. strvec.c
  485. strvec.h
  486. sub-process.c
  487. sub-process.h
  488. submodule-config.c
  489. submodule-config.h
  490. submodule.c
  491. submodule.h
  492. symlinks.c
  493. symlinks.h
  494. tag.c
  495. tag.h
  496. tar.h
  497. tempfile.c
  498. tempfile.h
  499. thread-utils.c
  500. thread-utils.h
  501. tmp-objdir.c
  502. tmp-objdir.h
  503. trace.c
  504. trace.h
  505. trace2.c
  506. trace2.h
  507. trailer.c
  508. trailer.h
  509. transport-helper.c
  510. transport-internal.h
  511. transport.c
  512. transport.h
  513. tree-diff.c
  514. tree-walk.c
  515. tree-walk.h
  516. tree.c
  517. tree.h
  518. unicode-width.h
  519. unimplemented.sh
  520. unix-socket.c
  521. unix-socket.h
  522. unix-stream-server.c
  523. unix-stream-server.h
  524. unpack-trees.c
  525. unpack-trees.h
  526. upload-pack.c
  527. upload-pack.h
  528. url.c
  529. url.h
  530. urlmatch.c
  531. urlmatch.h
  532. usage.c
  533. userdiff.c
  534. userdiff.h
  535. utf8.c
  536. utf8.h
  537. varint.c
  538. varint.h
  539. version-def.h.in
  540. version.c
  541. version.h
  542. versioncmp.c
  543. versioncmp.h
  544. walker.c
  545. walker.h
  546. wildmatch.c
  547. wildmatch.h
  548. worktree.c
  549. worktree.h
  550. wrapper.c
  551. wrapper.h
  552. write-or-die.c
  553. write-or-die.h
  554. ws.c
  555. ws.h
  556. wt-status.c
  557. wt-status.h
  558. xdiff-interface.c
  559. 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