sparse-index: add guard to ensure full index
authorDerrick Stolee <dstolee@microsoft.com>
Tue, 30 Mar 2021 13:10:47 +0000 (13:10 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 30 Mar 2021 19:57:45 +0000 (12:57 -0700)
commit3964fc2aae7c7420a4c5da1b9530e8e8de1ed367
tree6b4872a266678c396757fcaa36c89351671a23b9
parent4b3f765a2f38064c0bb221c76c7bb4f28f94a9dc
sparse-index: add guard to ensure full index

Upcoming changes will introduce modifications to the index format that
allow sparse directories. It will be useful to have a mechanism for
converting those sparse index files into full indexes by walking the
tree at those sparse directories. Name this method ensure_full_index()
as it will guarantee that the index is fully expanded.

This method is not implemented yet, and instead we focus on the
scaffolding to declare it and call it at the appropriate time.

Add a 'command_requires_full_index' member to struct repo_settings. This
will be an indicator that we need the index in full mode to do certain
index operations. This starts as being true for every command, then we
will set it to false as some commands integrate with sparse indexes.

If 'command_requires_full_index' is true, then we will immediately
expand a sparse index to a full one upon reading from disk. This
suffices for now, but we will want to add more callers to
ensure_full_index() later.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile
repo-settings.c
repository.c
repository.h
sparse-index.c [new file with mode: 0644]
sparse-index.h [new file with mode: 0644]