]> git.ipfire.org Git - thirdparty/git.git/commit
read-cache: add remove_file_from_index_with_flags()
authorJunio C Hamano <gitster@pobox.com>
Wed, 29 Jul 2026 17:25:23 +0000 (10:25 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 29 Jul 2026 17:26:47 +0000 (10:26 -0700)
commit0318d75783f915542d63f253e15783a2e2ae01ee
tree4891a0f8a0029d43247f1f63e8188eaadec5b6db
parent045b7055cfa52c9a708366c5b92b2ca461525865
read-cache: add remove_file_from_index_with_flags()

add_file_to_index() takes flags such as ADD_CACHE_PRETEND and
ADD_CACHE_VERBOSE and internally handles both reporting (e.g.,
"add 'path'") and suppressing index updates during dry runs.

In contrast, remove_file_from_index() takes only istate and path
without flags.  Callers that perform file removals (such as
update_callback() in read-cache.c) are forced to manually inspect
ADD_CACHE_PRETEND and ADD_CACHE_VERBOSE flags for removed
files.

Introduce remove_file_from_index_with_flags() to encapsulate
pretend mode and verbose reporting for index removals.  Update
update_callback() to use the new helper.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
read-cache-ll.h
read-cache.c