Most of our use of these compatibility macros went away with 041df69edd3 (Merge branch 'ab/fewer-the-index-macros', 2022-11-28) , which was part of v2.39.0. That topic left out these stragglers, as some of this would have conflicted with in-flight topics, and I'd skipped the cache-tree.h cases altogether. The update in v2 is trivial, just to rebase the series for changes on "master". There are no semantic or textual conflicts with "seen" either, so finishing this migration before we get another user of them would be nice. The v1 had a side discussion that didn't need resolving here. The question was what a series like this might do if we needed to convert library code to make new use of "the_index" (as opposed to converting the functions themselves to take it from their callers). That's an interesting question, but irrelevant to this topic, as there's no such library users to deal with, and this migration closes the door on that hypothetical question needing to be addressed in the future. Ævar Arnfjörð Bjarmason (6): builtin/rm.c: use narrower "USE_THE_INDEX_VARIABLE" cocci & cache.h: fully apply "active_nr" part of index-compatibility cocci & cache.h: apply pending "index_cache_pos" rule cocci & cache-tree.h: migrate "write_cache_as_tree" to "*_index_*" cache-tree API: remove redundant update_main_cache_tree() cocci & cache.h: remove "USE_THE_INDEX_COMPATIBILITY_MACROS" builtin/am.c | 6 ++-- builtin/commit.c | 18 +++++----- builtin/merge.c | 8 ++--- builtin/mv.c | 8 +++-- builtin/rm.c | 2 +- builtin/stash.c | 11 +++--- builtin/update-index.c | 4 +-- builtin/write-tree.c | 5 +-- cache-tree.h | 15 -------- cache.h | 12 +------ contrib/coccinelle/index-compatibility.cocci | 36 ++++++++++++++----- .../index-compatibility.pending.cocci | 24 ------------- 12 files changed, 62 insertions(+), 87 deletions(-) delete mode 100644 contrib/coccinelle/index-compatibility.pending.cocci Range-diff against v1: 1: 3517389f732 = 1: 916761cb50f builtin/rm.c: use narrower "USE_THE_INDEX_VARIABLE" 2: 03c6e404367 = 2: 6040edad622 cocci & cache.h: fully apply "active_nr" part of index-compatibility 3: 2dbe4f45363 = 3: 3e9d97dbff2 cocci & cache.h: apply pending "index_cache_pos" rule 4: 679ddc857c1 ! 4: e36a0ae562f cocci & cache-tree.h: migrate "write_cache_as_tree" to "*_index_*" @@ builtin/am.c #include "config.h" #include "builtin.h" @@ builtin/am.c: static void do_commit(const struct am_state *state) - if (run_hooks("pre-applypatch")) + if (!state->no_verify && run_hooks("pre-applypatch")) exit(1); - if (write_cache_as_tree(&tree, 0, NULL)) 5: 7f956fd8b75 = 5: ab8794da29c cache-tree API: remove redundant update_main_cache_tree() 6: 4807a3fe8ff = 6: 77c30cfe455 cocci & cache.h: remove "USE_THE_INDEX_COMPATIBILITY_MACROS" -- 2.39.1.1475.gc2542cdc5ef