git-commit-vandalism/Documentation
Derrick Stolee 55dfcf9591 sparse-checkout: clear tracked sparse dirs
When changing the scope of a sparse-checkout using cone mode, we might
have some tracked directories go out of scope. The current logic removes
the tracked files from within those directories, but leaves the ignored
files within those directories. This is a bit unexpected to users who
have given input to Git saying they don't need those directories
anymore.

This is something that is new to the cone mode pattern type: the user
has explicitly said "I want these directories and _not_ those
directories." The typical sparse-checkout patterns more generally apply
to "I want files with with these patterns" so it is natural to leave
ignored files as they are. This focus on directories in cone mode
provides us an opportunity to change the behavior.

Leaving these ignored files in the sparse directories makes it
impossible to gain performance benefits in the sparse index. When we
track into these directories, we need to know if the files are ignored
or not, which might depend on the _tracked_ .gitignore file(s) within
the sparse directory. This depends on the indexed version of the file,
so the sparse directory must be expanded.

We must take special care to look for untracked, non-ignored files in
these directories before deleting them. We do not want to delete any
meaningful work that the users were doing in those directories and
perhaps forgot to add and commit before switching sparse-checkout
definitions. Since those untracked files might be code files that
generated ignored build output, also do not delete any ignored files
from these directories in that case. The users can recover their state
by resetting their sparse-checkout definition to include that directory
and continue. Alternatively, they can see the warning that is presented
and delete the directory themselves to regain the performance they
expect.

By deleting the sparse directories when changing scope (or running 'git
sparse-checkout reapply') we regain these performance benefits as if the
repository was in a clean state.

Since these ignored files are frequently build output or helper files
from IDEs, the users should not need the files now that the tracked
files are removed. If the tracked files reappear, then they will have
newer timestamps than the build artifacts, so the artifacts will need to
be regenerated anyway.

Use the sparse-index as a data structure in order to find the sparse
directories that can be safely deleted. Re-expand the index to a full
one if it was full before.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-09-07 22:41:10 -07:00
..
config Merge branch 'pb/submodule-recurse-doc' 2021-08-02 14:06:39 -07:00
howto Document how we do embargoed releases 2021-03-27 15:13:12 -07:00
RelNotes The eighth batch 2021-08-04 13:28:56 -07:00
technical Merge branch 'ar/typofix' 2021-07-08 13:14:59 -07:00
.gitattributes
.gitignore
asciidoc.conf Doc: drop support for docbook-xsl before 1.72.0 2020-03-29 09:25:38 -07:00
asciidoctor-extensions.rb
blame-options.txt blame-options.txt: camelcase blame.blankBoundary 2021-02-24 15:21:25 -08:00
build-docdep.perl
cat-texi.perl
cmd-list.perl git.txt: add list of guides 2020-08-04 18:34:02 -07:00
CodingGuidelines Merge branch 'ds/gender-neutral-doc-guidelines' 2021-07-28 13:18:02 -07:00
config.txt Merge branch 'km/config-doc-typofix' 2021-03-19 15:25:38 -07:00
date-formats.txt doc: mention approxidates for git-commit --date 2021-02-23 13:33:02 -08:00
diff-format.txt
diff-generate-patch.txt doc: point to diff attribute in patch format docs 2021-04-28 13:34:44 +09:00
diff-options.txt diffcore-rename: treat a rename_limit of 0 as unlimited 2021-07-15 16:54:24 -07:00
doc-diff doc-diff: use single-colon rule in rendering Makefile 2020-02-18 13:53:30 -08:00
docbook-xsl.css
docbook.xsl
everyday.txto
fetch-options.txt fetch: document the --negotiate-only option 2021-06-30 14:57:22 -07:00
fix-texi.perl
git-add.txt
git-am.txt am: learn to process quoted lines that ends with CRLF 2021-05-10 15:06:22 +09:00
git-annotate.txt
git-apply.txt git-apply: allow simultaneous --cached and --3way options 2021-04-07 22:20:33 -07:00
git-archimport.txt
git-archive.txt archive: add --add-file 2020-09-19 15:56:06 -07:00
git-bisect-lk2009.txt git-bisect-lk2009: make continuation of list indented 2020-10-08 14:01:15 -07:00
git-bisect.txt bisect: swap command-line options in documentation 2020-08-28 14:06:06 -07:00
git-blame.txt mailmap doc: create a new "gitmailmap(5)" man page 2021-01-12 14:04:39 -08:00
git-branch.txt Merge branch 'jc/maint-column-doc-typofix' 2021-02-25 16:43:30 -08:00
git-bugreport.txt Merge branch 'es/bugreport-shell' 2020-06-08 18:06:28 -07:00
git-bundle.txt bundle: add new version for use with SHA-256 2020-07-30 09:16:48 -07:00
git-cat-file.txt git-cat-file.txt: remove references to "sha1" 2021-03-03 16:43:06 -08:00
git-check-attr.txt
git-check-ignore.txt Merge branch 'en/check-ignore' into maint 2020-03-17 15:02:23 -07:00
git-check-mailmap.txt check-mailmap doc: note config options 2021-01-12 14:04:40 -08:00
git-check-ref-format.txt
git-checkout-index.txt
git-checkout.txt Merge branch 'dl/checkout-guess' 2020-10-27 15:09:51 -07:00
git-cherry-pick.txt Documentation: stylistically normalize references to Signed-off-by: 2020-10-20 11:57:40 -07:00
git-cherry.txt
git-citool.txt
git-clean.txt
git-clone.txt builtin/clone.c: add --reject-shallow option 2021-04-01 12:58:58 -07:00
git-column.txt
git-commit-graph.txt Merge branch 'ds/commit-graph-merging-fix' 2020-11-02 13:17:39 -08:00
git-commit-tree.txt Documentation: merge commit-tree --[no-]gpg-sign 2020-04-03 11:37:22 -07:00
git-commit.txt Documentation: fix typo in the --patch option of the commit command 2021-06-28 13:08:25 -07:00
git-config.txt doc/git-config: simplify "override" advice for FILES section 2021-07-20 14:55:06 -07:00
git-count-objects.txt
git-credential-cache--daemon.txt
git-credential-cache.txt
git-credential-store.txt Merge branch 'cb/credential-store-ignore-bogus-lines' 2020-05-08 14:25:01 -07:00
git-credential.txt doc lint: lint and fix missing "GIT" end sections 2021-04-10 23:36:34 -07:00
git-cvsexportcommit.txt
git-cvsimport.txt
git-cvsserver.txt docs: fix linting issues due to incorrect relative section order 2021-04-10 23:36:34 -07:00
git-daemon.txt
git-describe.txt describe-doc: clarify default length of abbreviation 2021-05-17 15:56:29 +09:00
git-diff-files.txt
git-diff-index.txt builtin/diff-index: learn --merge-base 2020-09-20 21:30:26 -07:00
git-diff-tree.txt builtin/diff-tree: learn --merge-base 2020-09-21 13:37:03 -07:00
git-diff.txt git-diff: fix missing --merge-base docs 2021-07-12 13:55:29 -07:00
git-difftool.txt difftool.c: learn a new way start at specified file 2021-02-22 13:35:49 -08:00
git-fast-export.txt fast-export: allow seeding the anonymized mapping 2020-06-25 14:19:23 -07:00
git-fast-import.txt fast-import: fix typo in documentation 2020-10-04 12:56:29 -07:00
git-fetch-pack.txt
git-fetch.txt Documentation: render special characters correctly 2021-07-30 09:08:12 -07:00
git-filter-branch.txt filter-branch doc: fix filter-repo typo 2020-10-20 12:22:25 -07:00
git-fmt-merge-msg.txt
git-for-each-ref.txt ref-filter: use pretty.c logic for trailers 2021-02-15 16:48:38 -08:00
git-for-each-repo.txt for-each-repo: run subcommands on configured repos 2020-09-25 10:59:44 -07:00
git-format-patch.txt Merge branch 'jk/doc-format-patch-skips-merges' 2021-05-11 15:27:23 +09:00
git-fsck-objects.txt
git-fsck.txt fsck doc: remove ancient out-of-date diagnostics 2021-01-20 19:10:42 -08:00
git-gc.txt docs: clarify that refs/notes/ do not keep the attached objects alive 2021-02-10 23:43:55 -08:00
git-get-tar-commit-id.txt
git-grep.txt docs: fix linting issues due to incorrect relative section order 2021-04-10 23:36:34 -07:00
git-gui.txt
git-hash-object.txt
git-help.txt help: drop usage of 'common' and 'useful' for guides 2020-08-04 18:34:01 -07:00
git-http-backend.txt
git-http-fetch.txt http-fetch: allow custom index-pack args 2021-02-22 12:07:40 -08:00
git-http-push.txt doc: keep first level section header in upper case 2018-05-02 17:03:33 +09:00
git-imap-send.txt git-imap-send.txt: add note about localized Gmail folders 2020-08-31 11:44:33 -07:00
git-index-pack.txt Merge branch 'jt/transfer-fsck-across-packs' 2021-03-01 14:02:57 -08:00
git-init-db.txt
git-init.txt init: document init.defaultBranch better 2020-12-13 15:53:50 -08:00
git-instaweb.txt
git-interpret-trailers.txt trailer: add new .cmd config option 2021-05-04 12:09:43 +09:00
git-log.txt doc/log: correct default for --decorate 2021-06-08 13:34:48 +09:00
git-ls-files.txt ls-files.c: add --deduplicate option 2021-01-23 11:48:20 -08:00
git-ls-remote.txt docs: adjust for the recent rename of pu to seen 2020-06-25 09:18:53 -07:00
git-ls-tree.txt doc: clarify that --abbrev=<n> is about the minimum length 2020-11-04 14:04:44 -08:00
git-mailinfo.txt mailinfo: allow stripping quoted CR without warning 2021-05-10 15:06:22 +09:00
git-mailsplit.txt
git-maintenance.txt maintenance: use 'git fetch --prefetch' 2021-04-16 13:36:55 -07:00
git-merge-base.txt
git-merge-file.txt
git-merge-index.txt
git-merge-one-file.txt
git-merge-tree.txt
git-merge.txt Doc: reference the "stash list" in autostash docs 2020-05-05 16:07:30 -07:00
git-mergetool--lib.txt mergetool: break setup_tool out into separate initialization function 2021-02-09 14:09:16 -08:00
git-mergetool.txt doc: describe mergetool configuration in git-mergetool(1) 2021-03-13 15:34:32 -08:00
git-mktag.txt docs: fix linting issues due to incorrect relative section order 2021-04-10 23:36:34 -07:00
git-mktree.txt Documentation: normalize spelling of 'normalised' 2018-04-09 14:15:07 +09:00
git-multi-pack-index.txt midx: allow marking a pack as preferred 2021-04-01 13:07:37 -07:00
git-mv.txt
git-name-rev.txt
git-notes.txt docs: improve the example that illustrates git-notes path names 2020-08-03 12:40:09 -07:00
git-p4.txt doc lint: lint and fix missing "GIT" end sections 2021-04-10 23:36:34 -07:00
git-pack-objects.txt Merge branch 'jk/doc-max-pack-size' 2021-07-08 13:15:03 -07:00
git-pack-redundant.txt
git-pack-refs.txt
git-patch-id.txt
git-prune-packed.txt
git-prune.txt
git-pull.txt doc: pull: fix rebase=false documentation 2021-07-21 16:34:06 -07:00
git-push.txt Merge branch 'ds/gender-neutral-doc' 2021-07-16 17:42:53 -07:00
git-quiltimport.txt
git-range-diff.txt Merge branch 'js/range-diff-one-side-only' 2021-02-17 17:21:41 -08:00
git-read-tree.txt doc: --recurse-submodules mostly applies to active submodules 2020-04-06 13:42:43 -07:00
git-rebase.txt Merge branch 'ab/rebase-no-reschedule-failed-exec' 2021-05-07 12:47:40 +09:00
git-receive-pack.txt
git-reflog.txt
git-remote-ext.txt
git-remote-fd.txt
git-remote-helpers.txto
git-remote.txt remote: add meaningful exit code on missing/existing 2020-10-27 11:40:33 -07:00
git-repack.txt Merge branch 'jk/doc-max-pack-size' 2021-07-08 13:15:03 -07:00
git-replace.txt
git-request-pull.txt
git-rerere.txt
git-reset.txt doc: document --recurse-submodules for reset and restore 2020-04-06 13:42:43 -07:00
git-restore.txt Doc: document "A...B" form for <tree-ish> in checkout and switch 2020-10-07 09:49:05 -07:00
git-rev-list.txt docs/rev-list: add some examples of --disk-usage 2021-02-17 16:25:29 -08:00
git-rev-parse.txt rev-parse: add option for absolute or relative path formatting 2020-12-12 23:35:51 -08:00
git-revert.txt Documentation: stylistically normalize references to Signed-off-by: 2020-10-20 11:57:40 -07:00
git-rm.txt rm: honor sparse checkout patterns 2021-04-08 14:18:03 -07:00
git-send-email.txt git-send-email: add option to specify sendmail command 2021-05-17 07:06:13 +09:00
git-send-pack.txt
git-sh-i18n--envsubst.txt correct a few doubled-word nits in comments and documentation 2012-03-28 11:18:35 -07:00
git-sh-i18n.txt
git-sh-setup.txt
git-shell.txt
git-shortlog.txt mailmap: only look for .mailmap in work tree 2021-02-10 13:34:51 -08:00
git-show-branch.txt
git-show-index.txt Documentation: mark --object-format=sha256 as experimental 2020-08-17 10:50:14 -07:00
git-show-ref.txt
git-show.txt doc/git-show: include --diff-merges description 2020-12-21 13:47:32 -08:00
git-sparse-checkout.txt sparse-checkout: clear tracked sparse dirs 2021-09-07 22:41:10 -07:00
git-stage.txt
git-stash.txt stash show: use stash.showIncludeUntracked even when diff options given 2021-05-22 17:56:46 +09:00
git-status.txt Documentation: typofix --column description 2021-02-19 19:36:47 -08:00
git-stripspace.txt usage: do not insist that standard input must come from a file 2015-10-16 15:27:52 -07:00
git-submodule.txt submodule: fall back to remote's HEAD for missing remote.<name>.branch 2020-06-24 09:14:21 -07:00
git-svn.txt docs: fix linting issues due to incorrect relative section order 2021-04-10 23:36:34 -07:00
git-switch.txt checkout: learn to respect checkout.guess 2020-10-08 09:25:29 -07:00
git-symbolic-ref.txt
git-tag.txt Documentation: typofix --column description 2021-02-19 19:36:47 -08:00
git-tools.txt
git-unpack-file.txt
git-unpack-objects.txt
git-update-index.txt doc: remove "directory cache" from man pages 2021-01-09 22:57:24 -08:00
git-update-ref.txt update-ref: allow creation of multiple transactions 2020-11-16 13:44:01 -08:00
git-update-server-info.txt
git-upload-archive.txt
git-upload-pack.txt
git-var.txt
git-verify-commit.txt
git-verify-pack.txt
git-verify-tag.txt
git-web--browse.txt
git-whatchanged.txt
git-worktree.txt Merge branch 'sm/worktree-add-lock' 2021-07-28 13:17:58 -07:00
git-write-tree.txt
git.txt Merge branch 'ps/config-global-override' 2021-05-07 12:47:39 +09:00
gitattributes.txt docs: document symlink restrictions for dot-files 2021-05-04 11:52:03 +09:00
gitcli.txt Merge branch 'jc/doc-single-h-is-for-help' into maint 2020-03-17 15:02:24 -07:00
gitcore-tutorial.txt doc/gitcore-tutorial: fix prose to match example command 2020-01-08 08:56:40 -08:00
gitcredentials.txt command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers' 2020-08-04 18:34:01 -07:00
gitcvs-migration.txt
gitdiffcore.txt Merge branch 'en/ort-perf-batch-8' 2021-03-22 14:00:24 -07:00
giteveryday.txt docs: adjust for the recent rename of pu to seen 2020-06-25 09:18:53 -07:00
gitfaq.txt docs: explain how to deal with files that are always modified 2020-09-20 21:29:02 -07:00
gitglossary.txt
githooks.txt githooks.txt: clarify documentation on reference-transaction hook 2021-03-01 09:02:01 -08:00
gitignore.txt docs: .gitignore parsing is to the top of the repo 2021-07-06 17:20:02 -07:00
gitk.txt doc: log, gitk: move '-L' description to 'line-range-options.txt' 2020-11-01 15:54:14 -08:00
gitmailmap.txt docs: document symlink restrictions for dot-files 2021-05-04 11:52:03 +09:00
gitmodules.txt docs: document symlink restrictions for dot-files 2021-05-04 11:52:03 +09:00
gitnamespaces.txt doc lint: lint and fix missing "GIT" end sections 2021-04-10 23:36:34 -07:00
gitremote-helpers.txt Merge branch 'bc/sha-256-part-2' 2020-07-06 22:09:13 -07:00
gitrepository-layout.txt
gitrevisions.txt
gitsubmodules.txt gitsubmodules doc: invoke 'ls-files' with '--recurse-submodules' 2020-10-04 12:54:07 -07:00
gittutorial-2.txt
gittutorial.txt Documentation: render special characters correctly 2021-07-30 09:08:12 -07:00
gitweb.conf.txt gitweb: add "e-mail privacy" feature to redact e-mail addresses 2021-04-08 15:54:26 -07:00
gitweb.txt
gitworkflows.txt gitworkflows.txt: fix broken subsection underline 2020-07-18 13:43:34 -07:00
glossary-content.txt docs: improve fast-forward in glossary content 2021-05-19 21:11:49 +09:00
howto-index.sh
i18n.txt i18n.txt: camel case and monospace "i18n.commitEncoding" 2021-02-24 15:21:25 -08:00
install-doc-quick.sh
install-webdoc.sh
line-range-format.txt doc: add more pointers to gitattributes(5) for userdiff 2020-11-01 15:54:14 -08:00
line-range-options.txt blame-options.txt: also mention 'funcname' in '-L' description 2020-11-01 15:54:14 -08:00
lint-gitlink.perl doc lint: fix bugs in, simplify and improve lint script 2021-04-10 23:36:34 -07:00
lint-man-end-blurb.perl doc lint: lint and fix missing "GIT" end sections 2021-04-10 23:36:34 -07:00
lint-man-section-order.perl docs: fix linting issues due to incorrect relative section order 2021-04-10 23:36:34 -07:00
Makefile doc: avoid using rm directly 2021-05-24 18:08:22 +09:00
manpage-base-url.xsl.in
manpage-bold-literal.xsl manpage-bold-literal.xsl: stop using git.docbook.backslash 2020-03-29 09:25:38 -07:00
manpage-normal.xsl manpage-normal.xsl: fold in manpage-base.xsl 2020-03-29 09:25:38 -07:00
manpage-quote-apos.xsl
manpage.xsl
merge-options.txt Documentation: define 'MERGE_AUTOSTASH' 2021-07-23 15:45:35 -07:00
merge-strategies.txt
MyFirstContribution.txt MyFirstContribution: link #git-devel to Libera Chat 2021-06-09 09:22:54 +09:00
MyFirstObjectWalk.txt MyFirstObjectWalk: drop init_walken_defaults() 2020-11-30 13:55:54 -08:00
object-format-disclaimer.txt Documentation: mark --object-format=sha256 as experimental 2020-08-17 10:50:14 -07:00
pretty-formats.txt Merge branch 'ls/typofix' 2021-05-16 21:05:24 +09:00
pretty-options.txt doc: clarify that --abbrev=<n> is about the minimum length 2020-11-04 14:04:44 -08:00
pull-fetch-param.txt refspec: add support for negative refspecs 2020-09-30 14:52:00 -07:00
ref-reachability-filters.txt Doc: prefer more specific file name 2020-09-18 15:41:56 -07:00
rev-list-description.txt git-log.txt: include rev-list-description.txt 2020-07-08 22:08:54 -07:00
rev-list-options.txt Merge branch 'bc/rev-list-without-commit-line' 2021-07-22 13:05:56 -07:00
revisions.txt revisions(7): clarify that most commands take a single revision range 2021-05-18 10:08:03 +09:00
sequencer.txt
signoff-option.txt Documentation: stylistically normalize references to Signed-off-by: 2020-10-20 11:57:40 -07:00
SubmittingPatches SubmittingPatches: replace discussion of Travis with GitHub Actions 2021-07-22 12:53:14 -07:00
texi.xsl
trace2-target-values.txt
transfer-data-leaks.txt
urls-remotes.txt
urls.txt
user-manual.conf user-manual.conf: don't specify [listingblock] 2020-03-31 16:08:02 -07:00
user-manual.txt Merge branch 'ds/gender-neutral-doc' 2021-07-16 17:42:53 -07:00