]> git.ipfire.org Git - thirdparty/git.git/commit
sparse-index API: BUG() out on NULL ensure_full_index()
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Thu, 12 Jan 2023 12:55:25 +0000 (13:55 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 13 Jan 2023 18:36:57 +0000 (10:36 -0800)
commit29fefafcba0a3608465491835d84b646ce1e1b6e
tree9dfc63c3e148690e6ed818cbd0551539d5deb8e9
parentd2cdf2c285b091f44e0bdc154ee39c0071f8934e
sparse-index API: BUG() out on NULL ensure_full_index()

Make the ensure_full_index() function stricter, and have it only
accept a non-NULL "struct index_state". This function (and this
behavior) was added in [1].

The only reason it needed to be this lax was due to interaction with
repo_index_has_changes(). See the addition of that code in [2].

The other reason for why this was needed dates back to interaction
with code added in [3]. In [4] we started calling ensure_full_index()
in unpack_trees(), but the caller added in 34110cd4e39 wants to pass
us a NULL "dst_index". Let's instead do the NULL check in
unpack_trees() itself.

1. 4300f8442a2 (sparse-index: implement ensure_full_index(), 2021-03-30)
2. 0c18c059a15 (read-cache: ensure full index, 2021-04-01)
3. 34110cd4e39 (Make 'unpack_trees()' have a separate source and
   destination index, 2008-03-06)
4. 6863df35503 (unpack-trees: ensure full index, 2021-03-30)

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Acked-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sparse-index.c
unpack-trees.c