git/Documentation
Taylor Blau 0ad7b239b2 pack-objects: ensure tree/tag closure with '--stdin-packs=follow'
Since 5ee86c273b (repack: exclude cruft pack(s) from the MIDX where
possible, 2025-06-23), when the 'repack.midxMustContainCruft'
configuration is set to "false", geometric repacks use
'--stdin-packs=follow' to copy needed objects out of cruft packs so the
MIDX can omit those packs.

In cd846bacc7 (pack-objects: introduce '--stdin-packs=follow',
2025-06-23), this behavior changed such that whenever excluded-open
('!') packs are present, the walk stops at objects in excluded-closed
('^') packs. Geometric repacks use '^' for retained packs already in the
MIDX, relying on the indexed object set being closed under reachability.

However, the walk introduced in cd846bacc7 starts only from commit
objects. A geometric repack can therefore produce a MIDX that does not
maintain reachability closure for lone trees (that are not reachable
from any commit otherwise in the closure).

A subsequent repack with '!' packs can stop at that tree in a retained
'^' pack even if a new commit reaches it. If the cruft pack remains
excluded, and the bitmap selection picks one or more commits which reach
that tree, the MIDX cannot generate a bitmap for that commit.

Add trees and tags from included and '!' packs (and loose ones with
'--unpacked') as roots in '--stdin-packs=follow' mode. This rescues
their descendants even when no input commit reaches them. Walk these
roots after the existing traversal, preserving the `SEEN` bit to avoid
redundant traversals. This gives directly enumerated commits priority
for the path prefixes used by name hashes and delta attributes. Tags can
introduce commits in the second walk, so path selection remains
best-effort.

Collect the extra roots in an oidset to avoid queuing duplicates. This
uses memory for each distinct root and walks its unvisited descendants.

Objects in '^' packs remain cutoffs to avoid rewalking packs that are
known to be closed under reachability, provided '!' packs are present.
This does not repair existing MIDXs lacking closure; those need a full
repack.

Signed-off-by: Taylor Blau <ttaylorr@openai.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-10-01 06:39:05 -07:00
..
RelNotes Revert "Merge branch 'en/no-amend-during-conflicts'" 2026-09-23 11:18:51 -07:00
config Merge branch 'ps/tune-rerere-gc' 2026-09-14 14:02:53 -07:00
howto
…
includes
…
mergetools
…
technical Merge branch 'jc/rerere-doc-typofix' 2026-09-02 09:21:59 -07:00
.gitignore
…
BreakingChanges.adoc
…
CodingGuidelines Merge branch 'jc/doc-timestamps-in-stat' 2026-05-11 10:05:54 +09:00
DecisionMaking.adoc
…
Makefile Documentation/technical: add paint-down-to-common doc 2026-08-11 07:34:31 -07:00
MyFirstContribution.adoc Merge branch 'wy/doc-myfirstcontribution-trim-quotes' 2026-07-19 10:42:18 -07:00
MyFirstObjectWalk.adoc
…
ReviewingGuidelines.adoc
…
SubmittingPatches Merge branch 'ss/submittingpatches-typofix' 2026-08-25 10:53:32 -07:00
ToolsForGit.adoc
…
asciidoc.conf.in doc: convert git-bisect to synopsis style 2026-05-25 20:05:44 +09:00
asciidoctor-extensions.rb.in
…
blame-options.adoc
…
build-docdep.perl
…
cat-texi.perl
…
cmd-list.sh
…
config.adoc Merge branch 'kh/doc-replay-config' 2026-08-11 10:07:00 -07:00
date-formats.adoc doc: document and test `@` prefix for raw timestamps 2026-06-02 18:13:12 +09:00
diff-algorithm-option.adoc
…
diff-context-options.adoc
…
diff-format.adoc
…
diff-generate-patch.adoc
…
diff-options.adoc doc: convert git-format-patch synopsis and options to new style 2026-07-23 14:26:58 -07:00
doc-diff
…
docbook-xsl.css
…
docbook.xsl
…
docinfo-html.in
…
everyday.adoco
…
fetch-options.adoc Merge branch 'wy/docs-typofixes' 2026-06-16 09:01:03 -07:00
fix-texi.sh
…
for-each-ref-options.adoc
…
format-patch-caveats.adoc doc: convert git-am synopsis and options to new style 2026-05-25 20:05:44 +09:00
format-patch-end-of-commit-message.adoc doc: convert git-am synopsis and options to new style 2026-05-25 20:05:44 +09:00
fsck-msgids.adoc
…
generate-mergetool-list.sh
…
git-add.adoc add: introduce '--resolved' option 2026-07-31 08:52:16 -07:00
git-am.adoc doc: convert git-am synopsis and options to new style 2026-05-25 20:05:44 +09:00
git-annotate.adoc
…
git-apply.adoc doc: convert git-apply synopsis and options to new style 2026-05-25 20:05:44 +09:00
git-archimport.adoc
…
git-archive.adoc
…
git-backfill.adoc pack-objects: support sparse:oid filter with path-walk 2026-05-24 18:41:06 +09:00
git-bisect-lk2009.adoc
…
git-bisect.adoc bisect: add --reset-when-found to leave when done 2026-08-02 16:34:36 -07:00
git-blame.adoc blame: reserve mark column only if necessary 2026-07-06 07:34:48 -07:00
git-branch.adoc branch: add --dry-run for --delete-merged 2026-08-05 10:08:28 -07:00
git-bugreport.adoc
…
git-bundle.adoc
…
git-cat-file.adoc cat-file: unify default format 2026-08-07 18:50:08 -07:00
git-check-attr.adoc
…
git-check-ignore.adoc
…
git-check-mailmap.adoc
…
git-check-ref-format.adoc
…
git-checkout-index.adoc
…
git-checkout.adoc
…
git-cherry-pick.adoc doc: cherry-pick: note --no-commit skips CHERRY_PICK_HEAD 2026-09-05 17:46:26 -07:00
git-cherry.adoc
…
git-citool.adoc
…
git-clean.adoc
…
git-clone.adoc
…
git-column.adoc
…
git-commit-graph.adoc
…
git-commit-tree.adoc
…
git-commit.adoc
…
git-config.adoc doc: git-config: escape erroneous highlight markup 2026-06-11 12:08:17 -07:00
git-count-objects.adoc
…
git-credential-cache--daemon.adoc
…
git-credential-cache.adoc
…
git-credential-store.adoc
…
git-credential.adoc
…
git-cvsexportcommit.adoc
…
git-cvsimport.adoc
…
git-cvsserver.adoc
…
git-daemon.adoc
…
git-describe.adoc
…
git-diagnose.adoc
…
git-diff-files.adoc
…
git-diff-index.adoc
…
git-diff-pairs.adoc
…
git-diff-tree.adoc
…
git-diff.adoc
…
git-difftool.adoc
…
git-fast-export.adoc fast-export: standardize usage string and SYNOPSIS 2026-07-13 08:54:29 -07:00
git-fast-import.adoc fast-import: use parse_options() for command line options 2026-08-11 07:33:17 -07:00
git-fetch-pack.adoc
…
git-fetch.adoc
…
git-filter-branch.adoc
…
git-fmt-merge-msg.adoc
…
git-for-each-ref.adoc
…
git-for-each-repo.adoc
…
git-format-patch.adoc doc: convert git-format-patch synopsis and options to new style 2026-07-23 14:26:58 -07:00
git-format-rev.adoc doc: format-rev: use [synopsis] on code block 2026-08-17 13:33:06 -07:00
git-fsck-objects.adoc
…
git-fsck.adoc
…
git-fsmonitor--daemon.adoc
…
git-gc.adoc
…
git-get-tar-commit-id.adoc
…
git-grep.adoc doc: convert git-grep synopsis and options to new style 2026-05-25 20:05:44 +09:00
git-gui.adoc
…
git-hash-object.adoc
…
git-help.adoc
…
git-history.adoc builtin/history: implement "drop" subcommand 2026-07-03 10:32:47 -07:00
git-hook.adoc doc: hook: don’t self-link via config include 2026-05-22 09:36:20 +09:00
git-http-backend.adoc
…
git-http-fetch.adoc http: avoid concurrent appends to partial packs 2026-07-27 12:57:20 -07:00
git-http-push.adoc
…
git-imap-send.adoc Merge branch 'wf/imap-send-draft' 2026-09-14 14:02:52 -07:00
git-index-pack.adoc
…
git-init-db.adoc
…
git-init.adoc
…
git-instaweb.adoc
…
git-interpret-trailers.adoc trailers: stop recognizing URLs as trailers 2026-08-21 08:53:27 -07:00
git-last-modified.adoc
…
git-log.adoc
…
git-ls-files.adoc
…
git-ls-remote.adoc
…
git-ls-tree.adoc
…
git-mailinfo.adoc
…
git-mailsplit.adoc
…
git-maintenance.adoc
…
git-merge-base.adoc
…
git-merge-file.adoc
…
git-merge-index.adoc
…
git-merge-one-file.adoc
…
git-merge-tree.adoc
…
git-merge.adoc
…
git-mergetool--lib.adoc
…
git-mergetool.adoc
…
git-mktag.adoc
…
git-mktree.adoc
…
git-multi-pack-index.adoc
…
git-mv.adoc
…
git-name-rev.adoc
…
git-notes.adoc
…
git-p4.adoc
…
git-pack-objects.adoc pack-objects: ensure tree/tag closure with '--stdin-packs=follow' 2026-10-01 06:39:05 -07:00
git-pack-redundant.adoc
…
git-pack-refs.adoc doc/pack-refs: convert synopsis and options to new style 2026-09-15 09:22:15 -07:00
git-patch-id.adoc
…
git-prune-packed.adoc
…
git-prune.adoc
…
git-pull.adoc
…
git-push.adoc
…
git-quiltimport.adoc
…
git-range-diff.adoc Merge branch 'sp/doc-range-diff-takes-notes' 2026-05-31 10:00:39 +09:00
git-read-tree.adoc
…
git-rebase.adoc
…
git-receive-pack.adoc
…
git-reflog.adoc
…
git-refs.adoc doc/refs: backtick-quote commands and options consistently 2026-09-15 09:22:16 -07:00
git-remote-ext.adoc
…
git-remote-fd.adoc
…
git-remote-helpers.adoco
…
git-remote.adoc
…
git-repack.adoc builtin/repack: add guards for --drop-filtered 2026-08-13 13:34:50 -07:00
git-replace.adoc
…
git-replay.adoc Merge branch 'tc/replay-linearize' 2026-09-10 05:36:17 -07:00
git-repo.adoc repo: add path.gitdir with absolute and relative suffix formatting 2026-06-23 21:15:52 -07:00
git-request-pull.adoc doc: convert git-request-pull synopsis and options to new style 2026-07-23 14:26:58 -07:00
git-rerere.adoc
…
git-reset.adoc
…
git-restore.adoc
…
git-rev-list.adoc
…
git-rev-parse.adoc
…
git-revert.adoc
…
git-rm.adoc
…
git-send-email.adoc doc: convert git-send-email synopsis and options to new style 2026-07-23 14:26:58 -07:00
git-send-pack.adoc
…
git-sh-i18n--envsubst.adoc
…
git-sh-i18n.adoc
…
git-sh-setup.adoc
…
git-shell.adoc
…
git-shortlog.adoc
…
git-show-branch.adoc
…
git-show-index.adoc
…
git-show-ref.adoc
…
git-show.adoc
…
git-sparse-checkout.adoc doc: fix typos via codespell 2026-06-08 00:21:35 +09:00
git-stage.adoc
…
git-stash.adoc stash: reserve exit status 1 for conflicts 2026-09-03 11:32:36 -07:00
git-status.adoc
…
git-stripspace.adoc
…
git-submodule.adoc
…
git-svn.adoc
…
git-switch.adoc
…
git-symbolic-ref.adoc
…
git-tag.adoc
…
git-tools.adoc
…
git-unpack-file.adoc
…
git-unpack-objects.adoc
…
git-update-index.adoc
…
git-update-ref.adoc
…
git-update-server-info.adoc
…
git-upload-archive.adoc
…
git-upload-pack.adoc
…
git-url-parse.adoc
…
git-var.adoc
…
git-verify-commit.adoc
…
git-verify-pack.adoc
…
git-verify-tag.adoc
…
git-version.adoc
…
git-web--browse.adoc
…
git-whatchanged.adoc
…
git-worktree.adoc worktree add: treat multiple matches with --guess-remote as an error 2026-08-27 10:29:43 -07:00
git-write-tree.adoc
…
git.adoc doc: git: link to the gitdatamodel(7) tutorial 2026-09-05 17:37:49 -07:00
gitattributes.adoc userdiff: add support for Swift 2026-07-23 07:14:34 -07:00
gitcli.adoc
…
gitcore-tutorial.adoc
…
gitcredentials.adoc
…
gitcvs-migration.adoc
…
gitdatamodel.adoc doc: datamodel: link to the glossary 2026-09-05 17:37:49 -07:00
gitdiffcore.adoc
…
giteveryday.adoc
…
gitfaq.adoc
…
gitformat-bundle.adoc
…
gitformat-chunk.adoc
…
gitformat-commit-graph.adoc
…
gitformat-index.adoc
…
gitformat-loose.adoc
…
gitformat-pack.adoc
…
gitformat-signature.adoc
…
gitglossary.adoc doc: glossary: link four of the terms to gitdatamodel(7) 2026-09-05 17:37:49 -07:00
githooks.adoc
…
gitignore.adoc
…
gitk.adoc
…
gitmailmap.adoc
…
gitmodules.adoc
…
gitnamespaces.adoc
…
gitpacking.adoc
…
gitprotocol-capabilities.adoc
…
gitprotocol-common.adoc
…
gitprotocol-http.adoc
…
gitprotocol-pack.adoc
…
gitprotocol-v2.adoc cat-file: unify default format 2026-08-07 18:50:08 -07:00
gitremote-helpers.adoc
…
gitrepository-layout.adoc
…
gitrevisions.adoc
…
gitsubmodules.adoc
…
gittutorial-2.adoc
…
gittutorial.adoc
…
gitweb.adoc
…
gitweb.conf.adoc
…
gitworkflows.adoc
…
glossary-content.adoc doc: glossary: link four of the terms to gitdatamodel(7) 2026-09-05 17:37:49 -07:00
i18n.adoc
…
install-doc-quick.sh
…
install-webdoc.sh
…
line-range-format.adoc
…
line-range-options.adoc line-log: allow non-patch diff formats with -L 2026-05-29 14:06:21 +09:00
lint-delimited-sections.perl
…
lint-documentation-style.perl
…
lint-fsck-msgids.perl
…
lint-gitlink.perl lint-gitlink: don't use empty lower bound in .{0,8} 2026-09-08 15:07:01 -07:00
lint-man-end-blurb.perl
…
lint-man-section-order.perl
…
lint-manpages.sh
…
manpage-bold-literal.xsl
…
manpage-normal.xsl
…
manpage.xsl
…
merge-options.adoc
…
merge-strategies.adoc
…
meson.build
…
object-format-disclaimer.adoc
…
pack-refs-options.adoc doc/pack-refs: convert synopsis and options to new style 2026-09-15 09:22:15 -07:00
pretty-formats.adoc
…
pretty-options.adoc
…
pull-fetch-param.adoc
…
ref-reachability-filters.adoc
…
ref-storage-format.adoc
…
rerere-options.adoc
…
rev-list-description.adoc
…
rev-list-options.adoc rev-list: add --missing-only option to filter output 2026-09-03 14:39:41 -07:00
revisions.adoc remote: find tracking branches for URL push destinations 2026-07-22 11:29:49 -07:00
scalar.adoc
…
sequencer.adoc
…
signoff-option.adoc
…
texi.xsl
…
trace2-target-values.adoc
…
transfer-data-leaks.adoc
…
urls-remotes.adoc
…
urls.adoc
…
user-manual.adoc
…