Skip to content

Commit 50367bf

Browse files
committed
checkout-index: improve ensure_full_index scope in checkout_all
Update `checkout_all` to only run `ensure_full_index` when entries in sparse directories are needed (i.e., `--sparse` is specified). Signed-off-by: Victoria Dye <[email protected]>
1 parent 2e96d80 commit 50367bf

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

builtin/checkout-index.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,9 @@ static int checkout_all(const char *prefix, int prefix_length, int include_spars
128128
int i, errs = 0;
129129
struct cache_entry *last_ce = NULL;
130130

131-
/* TODO: audit for interaction with sparse-index. */
132-
ensure_full_index(&the_index);
131+
if (include_sparse)
132+
ensure_full_index(&the_index);
133+
133134
for (i = 0; i < active_nr ; i++) {
134135
struct cache_entry *ce = active_cache[i];
135136
if (!include_sparse && !path_in_sparse_checkout(ce->name, &the_index))

t/t1092-sparse-checkout-compatibility.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,7 @@ test_expect_success 'sparse-index is not expanded' '
10451045
ensure_not_expanded add . &&
10461046
10471047
ensure_not_expanded checkout-index -f a &&
1048+
ensure_not_expanded checkout-index -f --all &&
10481049
for ref in update-deep update-folder1 update-folder2 update-deep
10491050
do
10501051
echo >>sparse-index/README.md &&

0 commit comments

Comments
 (0)