git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Taylor Blau" <me@ttaylorr.com>,
	"Junio C Hamano" <gitster@pobox.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH 05/12] cocci: add a index-compatibility.pending.cocci
Date: Fri, 18 Nov 2022 12:30:59 +0100	[thread overview]
Message-ID: <patch-05.12-14bf6e7188c-20221118T112205Z-avarab@gmail.com> (raw)
In-Reply-To: <cover-00.12-00000000000-20221118T112205Z-avarab@gmail.com>

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@gmail.com>
---
 .../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


  parent reply	other threads:[~2022-11-18 11:31 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-18 11:30 [PATCH 00/12] tree-wide: chip away at USE_THE_INDEX_COMPATIBILITY_MACROS Ævar Arnfjörð Bjarmason
2022-11-18 11:30 ` [PATCH 01/12] cache.h: remove unused "the_index" compat macros Ævar Arnfjörð Bjarmason
2022-11-18 11:30 ` [PATCH 02/12] builtin/{grep,log}.: don't define "USE_THE_INDEX_COMPATIBILITY_MACROS" Ævar Arnfjörð Bjarmason
2022-11-18 11:30 ` [PATCH 03/12] cocci & cache.h: remove rarely used "the_index" compat macros Ævar Arnfjörð Bjarmason
2022-11-18 11:30 ` [PATCH 04/12] read-cache API & users: make discard_index() return void Ævar Arnfjörð Bjarmason
2022-11-18 11:30 ` Ævar Arnfjörð Bjarmason [this message]
2022-11-18 11:31 ` [PATCH 06/12] cocci & cache.h: apply a selection of "pending" index-compatibility Ævar Arnfjörð Bjarmason
2022-11-18 11:31 ` [PATCH 07/12] cocci & cache.h: apply variable section " Ævar Arnfjörð Bjarmason
2022-11-18 11:31 ` [PATCH 08/12] cocci: apply "pending" index-compatibility to "t/helper/*.c" Ævar Arnfjörð Bjarmason
2022-11-18 11:31 ` [PATCH 09/12] {builtin/*,repository}.c: add & use "USE_THE_INDEX_VARIABLE" Ævar Arnfjörð Bjarmason
2022-11-18 18:41   ` Taylor Blau
2022-11-18 11:31 ` [PATCH 10/12] cache.h & test-tool.h: " Ævar Arnfjörð Bjarmason
2022-11-18 18:41   ` Taylor Blau
2022-11-18 11:31 ` [PATCH 11/12] cocci: apply "pending" index-compatibility to some "builtin/*.c" Ævar Arnfjörð Bjarmason
2022-11-18 11:31 ` [PATCH 12/12] builtin/*: remove or amend "USE_THE_INDEX_COMPATIBILITY_MACROS" Ævar Arnfjörð Bjarmason
2022-11-18 18:42   ` Taylor Blau
2022-11-18 19:27     ` Ævar Arnfjörð Bjarmason
2022-11-18 23:04       ` Taylor Blau
2022-11-18 12:13 ` [PATCH 00/12] tree-wide: chip away at USE_THE_INDEX_COMPATIBILITY_MACROS Phillip Wood
2022-11-18 12:21   ` Ævar Arnfjörð Bjarmason
2022-11-19 13:07 ` [PATCH v2 00/11] " Ævar Arnfjörð Bjarmason
2022-11-19 13:07   ` [PATCH v2 01/11] cache.h: remove unused "the_index" compat macros Ævar Arnfjörð Bjarmason
2022-11-19 13:07   ` [PATCH v2 02/11] builtin/{grep,log}.: don't define "USE_THE_INDEX_COMPATIBILITY_MACROS" Ævar Arnfjörð Bjarmason
2022-11-19 13:07   ` [PATCH v2 03/11] cocci & cache.h: remove rarely used "the_index" compat macros Ævar Arnfjörð Bjarmason
2022-11-19 13:07   ` [PATCH v2 04/11] read-cache API & users: make discard_index() return void Ævar Arnfjörð Bjarmason
2022-11-19 13:07   ` [PATCH v2 05/11] cocci: add a index-compatibility.pending.cocci Ævar Arnfjörð Bjarmason
2022-11-19 13:07   ` [PATCH v2 06/11] cocci & cache.h: apply a selection of "pending" index-compatibility Ævar Arnfjörð Bjarmason
2022-11-19 13:07   ` [PATCH v2 07/11] cocci & cache.h: apply variable section " Ævar Arnfjörð Bjarmason
2022-11-19 13:07   ` [PATCH v2 08/11] cocci: apply "pending" index-compatibility to "t/helper/*.c" Ævar Arnfjörð Bjarmason
2022-11-19 13:07   ` [PATCH v2 09/11] {builtin/*,repository}.c: add & use "USE_THE_INDEX_VARIABLE" Ævar Arnfjörð Bjarmason
2022-11-19 13:07   ` [PATCH v2 10/11] cache.h & test-tool.h: " Ævar Arnfjörð Bjarmason
2022-11-19 13:07   ` [PATCH v2 11/11] cocci: apply "pending" index-compatibility to some "builtin/*.c" Ævar Arnfjörð Bjarmason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=patch-05.12-14bf6e7188c-20221118T112205Z-avarab@gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=me@ttaylorr.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).