git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 00/12] tree-wide: chip away at USE_THE_INDEX_COMPATIBILITY_MACROS
@ 2022-11-18 11:30 Ævar Arnfjörð Bjarmason
  2022-11-18 11:30 ` [PATCH 01/12] cache.h: remove unused "the_index" compat macros Ævar Arnfjörð Bjarmason
                   ` (13 more replies)
  0 siblings, 14 replies; 32+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2022-11-18 11:30 UTC (permalink / raw)
  To: git; +Cc: Taylor Blau, Junio C Hamano,
	Ævar Arnfjörð Bjarmason

As 3/12 here notes we've been undergoing a sloooow migration away from
functions that provide "the_index" for you since 2007, with the last
major move away from some of them being in 2019.

This series has a large diffstat, but should be disproportionately
easy to review as I wrote almost none of the code: coccinelle did :)

I.e. after some trivial cleanup in 1-2/12 the C code changes in 3/12
are mostly generated from a new index-compatibility.cocci migration.

The commits that deviate from that are:

 * 04/12: Make a function that always returns "0" return "void"
   instead.

 * 09-10/12: Add a "USE_THE_INDEX_VARIABLE", for those leftover users
   that only need "the_index", but not the compatility macros.

 * 12/12: Manual follow-up to the cocci-applied 11/12.

The only exceptions to this are the changes to cache.h itself, and
moving things around in contrib/coccinelle/* as we can fully migrate
some things, so they move from a "pending" rule to a regular
coccinelle rule.

At the start of this the patch to migrate all of this would have been
~2k lines, after it's down to below ~1k.

I've carefully crafted this so that it doesn't have conflicts with
anything that's in-flight, or is likely to develop such conflicts (but
I could always get unlucky). If there are any the resolution should be
trivially validated by running the cocci rule on "theirs" and keeping
that version.

Branch & passing CI at:
https://github.com/avar/git/tree/avar/narrow-down-the-index-compatibilty-macros

Ævar Arnfjörð Bjarmason (12):
  cache.h: remove unused "the_index" compat macros
  builtin/{grep,log}.: don't define "USE_THE_INDEX_COMPATIBILITY_MACROS"
  cocci & cache.h: remove rarely used "the_index" compat macros
  read-cache API & users: make discard_index() return void
  cocci: add a index-compatibility.pending.cocci
  cocci & cache.h: apply a selection of "pending" index-compatibility
  cocci & cache.h: apply variable section of "pending"
    index-compatibility
  cocci: apply "pending" index-compatibility to "t/helper/*.c"
  {builtin/*,repository}.c: add & use "USE_THE_INDEX_VARIABLE"
  cache.h & test-tool.h: add & use "USE_THE_INDEX_VARIABLE"
  cocci: apply "pending" index-compatibility to some "builtin/*.c"
  builtin/*: remove or amend "USE_THE_INDEX_COMPATIBILITY_MACROS"

 add-interactive.c                             |  8 +-
 add-patch.c                                   |  3 +-
 builtin/add.c                                 | 21 ++---
 builtin/am.c                                  |  4 +-
 builtin/cat-file.c                            |  2 +-
 builtin/check-attr.c                          |  4 +-
 builtin/check-ignore.c                        |  4 +-
 builtin/checkout-index.c                      | 19 ++--
 builtin/checkout.c                            | 55 ++++++------
 builtin/clean.c                               |  6 +-
 builtin/clone.c                               |  4 +-
 builtin/commit.c                              | 20 ++---
 builtin/describe.c                            |  7 +-
 builtin/diff-files.c                          |  3 +-
 builtin/diff-index.c                          |  5 +-
 builtin/diff-tree.c                           |  4 +-
 builtin/difftool.c                            |  2 +-
 builtin/fsck.c                                | 16 ++--
 builtin/grep.c                                |  1 -
 builtin/log.c                                 |  1 -
 builtin/merge-index.c                         | 16 ++--
 builtin/merge-ours.c                          |  3 +-
 builtin/merge-tree.c                          |  2 +-
 builtin/merge.c                               | 13 +--
 builtin/mv.c                                  | 25 +++---
 builtin/pull.c                                |  6 +-
 builtin/read-tree.c                           |  6 +-
 builtin/rebase.c                              |  6 +-
 builtin/reset.c                               | 20 +++--
 builtin/rev-parse.c                           |  4 +-
 builtin/rm.c                                  | 18 ++--
 builtin/stash.c                               |  8 +-
 builtin/submodule--helper.c                   | 14 +--
 builtin/update-index.c                        | 72 +++++++--------
 cache.h                                       | 30 ++-----
 contrib/coccinelle/index-compatibility.cocci  | 87 +++++++++++++++++++
 .../index-compatibility.pending.cocci         | 78 +++++++++++++++++
 read-cache.c                                  |  4 +-
 repository.c                                  |  2 +-
 sequencer.c                                   | 15 ++--
 t/helper/test-dump-cache-tree.c               |  5 +-
 t/helper/test-dump-split-index.c              |  1 +
 t/helper/test-dump-untracked-cache.c          |  4 +-
 t/helper/test-fast-rebase.c                   |  4 +-
 t/helper/test-lazy-init-name-hash.c           | 21 ++---
 t/helper/test-read-cache.c                    |  5 +-
 t/helper/test-scrap-cache-tree.c              |  9 +-
 t/helper/test-write-cache.c                   |  6 +-
 48 files changed, 417 insertions(+), 256 deletions(-)
 create mode 100644 contrib/coccinelle/index-compatibility.cocci
 create mode 100644 contrib/coccinelle/index-compatibility.pending.cocci

-- 
2.38.0.1511.gcdcff1f1dc2


^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2022-11-19 13:08 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 05/12] cocci: add a index-compatibility.pending.cocci Ævar Arnfjörð Bjarmason
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

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).