"Victoria Dye via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes: > From: Victoria Dye <vdye@xxxxxxxxxx> > > When the index read in 'do_read_index()' does not exist on-disk, mark the > index "sparse" if the executing command does not require a full index and > sparse index is otherwise enabled. > > Some commands (such as 'git stash -u') implicitly create a new index (when > the 'GIT_INDEX_FILE' variable points to a non-existent file) and perform > some operation on it. However, when this index is created, it isn't created > with the same sparsity settings as the repo index. As a result, while these > indexes may be sparse during the operation, they are always expanded before > being written to disk. We can avoid that expansion by defaulting the index > to "sparse", in which case it will only be expanded if the full index is > needed. Makes sense.