Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sparse index: integrate with git update-index #423

Merged
merged 5 commits into from
Sep 13, 2021
Merged

Sparse index: integrate with git update-index #423

merged 5 commits into from
Sep 13, 2021

Commits on Sep 10, 2021

  1. update-index (bugfix): --cacheinfo should block directories

    Add explicit check for directory entry mode, throwing an error if found.
    Without the check, sparse directory cache entries could be added to any
    index (including non-sparse). In a sparse index, this would at least cause
    inconsistencies in the cache tree; for a non-sparse index, such an entry
    being present at all is a bug.
    
    Signed-off-by: Victoria Dye <vdye@github.com>
    vdye committed Sep 10, 2021
    Configuration menu
    Copy the full SHA
    c01c8d3 View commit details
    Browse the repository at this point in the history

Commits on Sep 13, 2021

  1. update-index: add tests for sparse-checkout compatibility

    In preparation of integrating 'git update-index' with the sparse index,
    introduce tests for a variety of 'git update-index' uses. Some (namely those
    in update-index add/remove`) are focused specifically on how 'git stash' uses
    'git update-index' as a subcommand.
    
    Signed-off-by: Victoria Dye <vdye@github.com>
    vdye committed Sep 13, 2021
    Configuration menu
    Copy the full SHA
    db6ed4f View commit details
    Browse the repository at this point in the history
  2. update-index: integrate with sparse index

    Enable usage of the sparse index with `update-index`. Most variations of
    `update-index` work without explicitly expanding the index (due to the
    implicit expansion performed when attempting to find an existing entry).
    However, in order to prevent manually creating a sparse directory cache
    entry (current behavior is to throw an error when presented with a directory
    using `--cacheinfo`), the index is expanded before the the entry is added.
    
    
    Signed-off-by: Victoria Dye <vdye@github.com>
    vdye committed Sep 13, 2021
    Configuration menu
    Copy the full SHA
    6adbbab View commit details
    Browse the repository at this point in the history
  3. update-index: remove sparse index expansion for --cacheinfo

    Rearrange `add_index_entry_with_check` to allow `index_name_stage_pos` to
    expand the index _before_ attempting to invalidate the relevant cache tree
    path. This permits implicit index expansion when adding a cache entry
    outside the sparse checkout definition.
    
    Signed-off-by: Victoria Dye <vdye@github.com>
    vdye committed Sep 13, 2021
    Configuration menu
    Copy the full SHA
    c39d7f2 View commit details
    Browse the repository at this point in the history
  4. update-index: remove unnecessary index expansion in do_reupdate

    Instead of ensuring the full index, only need to prevent reupdating sparse
    directory entries to maintain expected behavior. Corresponding addition to
    index expansion test verifies the sparse index is not expanded.
    
    Signed-off-by: Victoria Dye <vdye@github.com>
    vdye committed Sep 13, 2021
    Configuration menu
    Copy the full SHA
    51dfddf View commit details
    Browse the repository at this point in the history