git/contrib/coccinelle/index-compatibility.cocci
Ævar Arnfjörð Bjarmason 07047d6829 cocci: apply "pending" index-compatibility to some "builtin/*.c"
Apply "index-compatibility.pending.cocci" rule to "builtin/*", but
exclude those where we conflict with in-flight changes.

As a result some of them end up using only "the_index", so let's have
them use the more narrow "USE_THE_INDEX_VARIABLE" rather than
"USE_THE_INDEX_COMPATIBILITY_MACROS".

Manual changes not made by coccinelle, that were squashed in:

* Whitespace-wrap argument lists for repo_hold_locked_index(),
  repo_read_index_preload() and repo_refresh_and_write_index(), in cases
  where the line became too long after the transformation.
* Change "refresh_cache()" to "refresh_index()" in a comment in
  "builtin/update-index.c".
* For those whose call was followed by perror("<macro-name>"), change
  it to perror("<function-name>"), referring to the new function.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-11-21 12:06:15 +09:00

136 lines
1.5 KiB
Plaintext

// the_index.* variables
@@
@@
(
- active_cache
+ the_index.cache
|
- active_cache_changed
+ the_index.cache_changed
|
- active_cache_tree
+ the_index.cache_tree
)
@@
identifier f != prepare_to_commit;
@@
f(...) {<...
- active_nr
+ the_index.cache_nr
...>}
// "the_repository" simple cases
@@
@@
(
- read_cache_unmerged
+ repo_read_index_unmerged
|
- hold_locked_index
+ repo_hold_locked_index
)
(
+ the_repository,
...)
// "the_repository" special-cases
@@
@@
(
- read_cache_preload
+ repo_read_index_preload
)
(
+ the_repository,
...
+ , 0
)
// "the_index" simple cases
@@
@@
(
- is_cache_unborn
+ is_index_unborn
|
- unmerged_cache
+ unmerged_index
|
- rename_cache_entry_at
+ rename_index_entry_at
|
- chmod_cache_entry
+ chmod_index_entry
|
- cache_file_exists
+ index_file_exists
|
- cache_name_is_other
+ index_name_is_other
|
- unmerge_cache_entry_at
+ unmerge_index_entry_at
|
- add_to_cache
+ add_to_index
|
- add_file_to_cache
+ add_file_to_index
|
- 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,
...)
@@
@@
(
- 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
)