aboutsummaryrefslogtreecommitdiffstats
path: root/sparse-index.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-01-17 14:31:26 -0800
committerJunio C Hamano <gitster@pobox.com>2023-01-17 14:31:26 -0800
commit73f69f22e590c2ddc2c6fb678a5b11d9d0ba39fa (patch)
tree3009eb67c05e69ccb782d7234cda170e24a9c459 /sparse-index.c
parentSync with 'maint' (diff)
parentcache API: add a "INDEX_STATE_INIT" macro/function, add release_index() (diff)
downloadgit-73f69f22e590c2ddc2c6fb678a5b11d9d0ba39fa.tar.gz
git-73f69f22e590c2ddc2c6fb678a5b11d9d0ba39fa.zip
Merge branch 'ab/cache-api-cleanup' into ab/cache-api-cleanup-users
* ab/cache-api-cleanup: cache API: add a "INDEX_STATE_INIT" macro/function, add release_index() read-cache.c: refactor set_new_index_sparsity() for subsequent commit sparse-index API: BUG() out on NULL ensure_full_index() sparse-index.c: expand_to_path() can assume non-NULL "istate" builtin/difftool.c: { 0 }-initialize rather than using memset()
Diffstat (limited to 'sparse-index.c')
-rw-r--r--sparse-index.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sparse-index.c b/sparse-index.c
index 8c269dab80..86e3b99870 100644
--- a/sparse-index.c
+++ b/sparse-index.c
@@ -299,7 +299,7 @@ void expand_index(struct index_state *istate, struct pattern_list *pl)
* If the index is already full, then keep it full. We will convert
* it to a sparse index on write, if possible.
*/
- if (!istate || istate->sparse_index == INDEX_EXPANDED)
+ if (istate->sparse_index == INDEX_EXPANDED)
return;
/*
@@ -424,6 +424,8 @@ void expand_index(struct index_state *istate, struct pattern_list *pl)
void ensure_full_index(struct index_state *istate)
{
+ if (!istate)
+ BUG("ensure_full_index() must get an index!");
expand_index(istate, NULL);
}
@@ -547,7 +549,7 @@ void expand_to_path(struct index_state *istate,
if (in_expand_to_path)
return;
- if (!istate || !istate->sparse_index)
+ if (!istate->sparse_index)
return;
if (!istate->repo)