Add a coccinelle rule which covers the rest of the macros guarded by "USE_THE_INDEX_COMPATIBILITY_MACROS" cache.h. If the result of this were applied it can be reduced down to just: #ifdef USE_THE_INDEX_COMPATIBILITY_MACROS extern struct index_state the_index; #endif But that patch is just under 2000 lines, so let's first add this as a "pending", and then incrementally pick changes from it in subsequent commits. In doing that we'll migrate rules from this "index-compatibility.pending.cocci" to the "index-compatibility.cocci" created in a preceding commit. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> --- .../index-compatibility.pending.cocci | 110 ++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 contrib/coccinelle/index-compatibility.pending.cocci diff --git a/contrib/coccinelle/index-compatibility.pending.cocci b/contrib/coccinelle/index-compatibility.pending.cocci new file mode 100644 index 00000000000..6e96de0f638 --- /dev/null +++ b/contrib/coccinelle/index-compatibility.pending.cocci @@ -0,0 +1,110 @@ +// the_index.* variables +@@ +@@ +( +- active_cache ++ the_index.cache +| +- active_nr ++ the_index.cache_nr +| +- active_cache_changed ++ the_index.cache_changed +| +- active_cache_tree ++ the_index.cache_tree +) + +// "the_repository" simple cases +@@ +@@ +( +- read_cache ++ repo_read_index +| +- hold_locked_index ++ repo_hold_locked_index +) + ( ++ the_repository, + ...) + +// "the_index" simple cases +@@ +@@ +( +- discard_cache ++ discard_index +| +- cache_name_pos ++ index_name_pos +| +- add_cache_entry ++ add_index_entry +| +- remove_file_from_cache ++ remove_file_from_index +| +- ce_match_stat ++ ie_match_stat +| +- ce_modified ++ ie_modified +| +- resolve_undo_clear ++ resolve_undo_clear_index +) + ( ++ &the_index, + ...) + +// "the_repository" special-cases +@@ +@@ +( +- read_cache_preload ++ repo_read_index_preload +) + ( ++ the_repository, + ... ++ , 0 + ) + +@@ +@@ +( +- refresh_and_write_cache ++ repo_refresh_and_write_index +) + ( ++ the_repository, + ... ++ , NULL, NULL, NULL + ) + + +// "the_index" special-cases +@@ +@@ +( +- read_cache_from ++ read_index_from +) + ( ++ &the_index, + ... ++ , get_git_dir() + ) + +@@ +@@ +( +- refresh_cache ++ refresh_index +) + ( ++ &the_index, + ... ++ , NULL, NULL, NULL + ) -- 2.38.0.1511.gcdcff1f1dc2