git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Emily Shaffer <nasamuffin@google.com>, Elijah Newren <newren@gmail.com>
Subject: [PATCH 00/16] Header cleanups
Date: Thu, 23 Feb 2023 08:05:05 +0000	[thread overview]
Message-ID: <pull.1485.git.1677139521.gitgitgadget@gmail.com> (raw)

Maintainer note: This series cleanly merges with next, but has a minor
conflict with ed/fsmonitor-inotify. The correct resolution is to take
ed/fsmonitor-inotify's copy of compat/fsmonitor/fsm-settings-darwin.c, but
to add a #include "git-compat-util.h" line at the top of
compat/fsmonitor/fsm-settings-unix.c.

This series cleans up headers a bit, trying to remove excessive dependency
on "cache.h". I created this series a while ago, but decided to clean it up
and submit it due to Emily's recent thread and suggestion that this might be
helpful to their efforts[1].

There are many more cleanups I could do in this area, but the series is
already a good size.

Notes:

 * Big props to Dscho for gitgitgadget; being able to test on a bunch of
   platforms with a variety of configurations easily is a big win in general
   but especially for series like this one.
 * I used the scripts at
   https://github.com/newren/git/commit/db81c8d7fb554b3edf04320e218bddeb98bb6194,
   and some tweaks thereof, repeatedly while making this series (though they
   are prone to produce both false positive and false negatives, so if you
   use them, only use them to generate hints about which files to look at).

[1] Search for "Extremely yes" in
https://lore.kernel.org/git/CAJoAoZm+TkCL0Jpg_qFgKottxbtiG2QOiY0qGrz3-uQy+=waPg@mail.gmail.com/

Elijah Newren (16):
  treewide: ensure one of the appropriate headers is sourced first
  treewide: remove unnecessary git-compat-util.h includes in headers
  treewide: remove unnecessary cache.h includes
  treewide: remove unnecessary cache.h includes in source files
  alloc.h: move ALLOC_GROW() functions from cache.h
  hash.h: move some oid-related declarations from cache.h
  hex.h: move some hex-related declarations from cache.h
  pretty.h: move has_non_ascii() declaration from commit.h
  ident.h: move ident-related declarations out of cache.h
  object.h: stop depending on cache.h; make cache.h depend on object.h
  dir.h: refactor to no longer need to include cache.h
  object-store.h: move struct object_info from cache.h
  replace-object.h: move read_replace_refs declaration from cache.h to
    here
  treewide: replace cache.h with more direct headers, where possible
  Remove unnecessary includes of builtin.h
  diff.h: remove unnecessary include of object.h

 Documentation/CodingGuidelines               |   8 +-
 add-patch.c                                  |   2 +
 advice.c                                     |   4 +-
 advice.h                                     |   2 -
 alias.c                                      |   4 +-
 alloc.c                                      |   2 +-
 alloc.h                                      |  75 +++++
 apply.c                                      |   1 +
 archive-tar.c                                |   3 +-
 archive.c                                    |   3 +-
 attr.c                                       |   1 +
 blame.h                                      |   1 -
 blob.c                                       |   2 +-
 builtin/blame.c                              |   3 +-
 builtin/cat-file.c                           |   3 +
 builtin/check-mailmap.c                      |   1 +
 builtin/checkout--worker.c                   |   1 +
 builtin/commit-graph.c                       |   1 +
 builtin/config.c                             |   3 +-
 builtin/credential-cache--daemon.c           |   1 +
 builtin/fetch-pack.c                         |   1 +
 builtin/fsck.c                               |   1 +
 builtin/fsmonitor--daemon.c                  |   1 +
 builtin/grep.c                               |   1 +
 builtin/index-pack.c                         |   2 +
 builtin/log.c                                |   3 +-
 builtin/merge.c                              |   1 +
 builtin/mktree.c                             |   1 +
 builtin/mv.c                                 |   1 +
 builtin/name-rev.c                           |   2 +-
 builtin/pack-objects.c                       |   3 +-
 builtin/prune.c                              |   1 +
 builtin/repack.c                             |   2 +-
 builtin/replace.c                            |   1 +
 builtin/rev-parse.c                          |   1 +
 builtin/revert.c                             |   3 +-
 builtin/rm.c                                 |   1 +
 builtin/submodule--helper.c                  |   1 +
 builtin/unpack-objects.c                     |   1 +
 builtin/upload-pack.c                        |   1 +
 builtin/var.c                                |   1 +
 bulk-checkin.c                               |   3 +-
 cache-tree.c                                 |   3 +-
 cache-tree.h                                 |   1 -
 cache.h                                      | 306 +------------------
 cbtree.c                                     |   1 +
 cbtree.h                                     |   2 -
 checkout.h                                   |   2 +-
 chunk-format.c                               |   3 +-
 chunk-format.h                               |   1 -
 commit-graph.h                               |   1 -
 commit-reach.c                               |   3 +-
 commit-slab-impl.h                           |   2 -
 commit.h                                     |   1 -
 compat/fsmonitor/fsm-ipc-win32.c             |   1 +
 compat/fsmonitor/fsm-settings-darwin.c       |   1 +
 compat/mingw.c                               |   1 +
 config.c                                     |   5 +-
 daemon.c                                     |   1 +
 decorate.c                                   |   3 +-
 delta-islands.c                              |   3 +-
 diff-merges.c                                |   2 +
 diff-no-index.c                              |   1 -
 diff.c                                       |   1 +
 diff.h                                       |   3 +-
 diffcore-delta.c                             |   2 +-
 diffcore-order.c                             |   3 +-
 diffcore-pickaxe.c                           |   4 +-
 diffcore-rename.c                            |   7 +-
 diffcore-rotate.c                            |   3 +-
 diffcore.h                                   |   4 +-
 dir-iterator.c                               |   3 +-
 dir.c                                        |   3 +-
 dir.h                                        |  16 +-
 entry.h                                      |   4 +-
 environment.c                                |   1 +
 ewah/bitmap.c                                |   3 +-
 ewah/ewah_bitmap.c                           |   2 +-
 fetch-pack.c                                 |   3 +-
 fmt-merge-msg.c                              |   2 +
 fsck.c                                       |   3 +-
 fsck.h                                       |   1 +
 fsmonitor-settings.c                         |   3 +-
 git-compat-util.h                            |   1 +
 git.c                                        |   1 +
 gpg-interface.c                              |   1 +
 graph.c                                      |   3 +-
 hash.h                                       |  35 ++-
 hashmap.c                                    |   2 +-
 help.c                                       |   4 +-
 hex.c                                        |   3 +-
 hex.h                                        |  84 +++++
 hook.c                                       |   5 +-
 http-backend.c                               |   3 +-
 ident.c                                      |   5 +-
 ident.h                                      |  67 ++++
 imap-send.c                                  |   2 +-
 json-writer.c                                |   2 +-
 khash.h                                      |   1 -
 kwset.c                                      |   2 +-
 levenshtein.c                                |   2 +-
 line-log.c                                   |   1 +
 line-log.h                                   |   1 +
 linear-assignment.c                          |   2 +-
 list-objects-filter-options.c                |   4 +-
 list-objects-filter-options.h                |   3 +-
 list-objects-filter.c                        |   1 +
 log-tree.c                                   |   1 +
 mailinfo.c                                   |   4 +-
 mem-pool.c                                   |   2 +-
 merge-blobs.c                                |   2 +-
 merge-recursive.c                            |   1 -
 midx.c                                       |   3 +-
 negotiator/noop.c                            |   2 +-
 object-file.c                                |   3 +-
 object-store.h                               | 128 ++++----
 object.h                                     |  22 +-
 oid-array.c                                  |   3 +-
 oidmap.c                                     |   2 +-
 oidmap.h                                     |   1 -
 oidset.c                                     |   4 +-
 oidtree.c                                    |   1 +
 oss-fuzz/fuzz-commit-graph.c                 |   1 +
 oss-fuzz/fuzz-pack-headers.c                 |   1 +
 oss-fuzz/fuzz-pack-idx.c                     |   1 +
 pack-bitmap-write.c                          |   3 +-
 pack-bitmap.c                                |   3 +-
 pack-mtimes.h                                |   2 -
 pack-objects.c                               |   3 +-
 packfile.c                                   |   3 +-
 parallel-checkout.c                          |   1 +
 pathspec.h                                   |   5 +
 pkt-line.h                                   |   1 -
 pretty.c                                     |   1 +
 pretty.h                                     |   4 +-
 prio-queue.c                                 |   3 +-
 protocol-caps.c                              |   1 +
 prune-packed.c                               |   1 +
 quote.c                                      |   2 +
 read-cache.c                                 |   1 +
 rebase.c                                     |   1 +
 ref-filter.c                                 |   5 +-
 reflog-walk.c                                |   3 +-
 reflog-walk.h                                |   2 -
 refs.c                                       |   3 +-
 refs/debug.c                                 |   2 +-
 refs/files-backend.c                         |   1 +
 refs/packed-backend.c                        |   3 +-
 refs/ref-cache.c                             |   3 +-
 refs/refs-internal.h                         |   1 -
 refspec.c                                    |   3 +-
 remote-curl.c                                |   3 +-
 remote.c                                     |   3 +-
 remote.h                                     |   1 -
 replace-object.h                             |   8 +
 repo-settings.c                              |   2 +-
 repository.h                                 |   1 -
 rerere.c                                     |   3 +-
 revision.c                                   |   3 +-
 revision.h                                   |   1 +
 send-pack.c                                  |   2 +-
 sequencer.c                                  |   1 +
 sequencer.h                                  |   2 +-
 serve.c                                      |   3 +-
 server-info.c                                |   3 +-
 sha1dc_git.c                                 |   4 +-
 shallow.c                                    |   3 +-
 shallow.h                                    |   2 +
 shell.c                                      |   2 +-
 sigchain.c                                   |   3 +-
 sparse-index.c                               |   1 +
 split-index.c                                |   1 +
 statinfo.h                                   |  24 ++
 strbuf.c                                     |   3 +-
 string-list.c                                |   3 +-
 strvec.c                                     |   3 +-
 sub-process.c                                |   1 +
 sub-process.h                                |   1 -
 submodule-config.c                           |   1 +
 submodule-config.h                           |   1 -
 submodule.c                                  |   4 +-
 t/helper/test-bloom.c                        |   2 +-
 t/helper/test-crontab.c                      |   1 -
 t/helper/test-ctype.c                        |   1 -
 t/helper/test-example-decorate.c             |   2 +-
 t/helper/test-json-writer.c                  |   1 -
 t/helper/test-pcre2-config.c                 |   1 -
 t/helper/test-prio-queue.c                   |   1 -
 t/helper/test-reach.c                        |   2 +-
 t/helper/test-run-command.c                  |   2 -
 t/helper/test-sigchain.c                     |   1 -
 t/helper/test-simple-ipc.c                   |   3 +-
 t/helper/test-submodule-nested-repo-config.c |   1 +
 t/helper/test-wildmatch.c                    |   1 -
 thread-utils.c                               |   2 +-
 trace.h                                      |   1 -
 trace2.c                                     |   3 +-
 trace2/tr2_ctr.c                             |   2 +-
 trace2/tr2_sysenv.c                          |   2 +-
 trace2/tr2_tbuf.c                            |   2 +-
 trace2/tr2_tgt_event.c                       |   2 +-
 trace2/tr2_tgt_normal.c                      |   2 +-
 trace2/tr2_tgt_perf.c                        |   2 +-
 trace2/tr2_tls.c                             |   4 +-
 trace2/tr2_tmr.c                             |   3 +-
 trailer.c                                    |   1 +
 transport.c                                  |   4 +-
 tree-walk.c                                  |   1 +
 tree-walk.h                                  |   4 +-
 unix-socket.c                                |   3 +-
 unix-stream-server.c                         |   2 +-
 url.c                                        |   4 +-
 urlmatch.c                                   |   5 +-
 userdiff.c                                   |   4 +-
 wildmatch.c                                  |   2 +-
 worktree.c                                   |   3 +-
 worktree.h                                   |   1 -
 xdiff-interface.h                            |   2 +-
 218 files changed, 691 insertions(+), 529 deletions(-)
 create mode 100644 hex.h
 create mode 100644 ident.h
 create mode 100644 statinfo.h


base-commit: 06dd2baa8da4a73421b959ec026a43711b9d77f9
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1485%2Fnewren%2Fheader-cleanups-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1485/newren/header-cleanups-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1485
-- 
gitgitgadget

             reply	other threads:[~2023-02-23  8:05 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-23  8:05 Elijah Newren via GitGitGadget [this message]
2023-02-23  8:05 ` [PATCH 01/16] treewide: ensure one of the appropriate headers is sourced first Elijah Newren via GitGitGadget
2023-02-23  8:05 ` [PATCH 02/16] treewide: remove unnecessary git-compat-util.h includes in headers Elijah Newren via GitGitGadget
2023-02-23 13:52   ` Derrick Stolee
2023-02-23 18:13     ` Elijah Newren
2023-02-23 19:35   ` Junio C Hamano
2023-02-23 19:53     ` Elijah Newren
2023-02-23 22:07       ` Junio C Hamano
2023-02-23 23:41         ` Elijah Newren
2023-02-23  8:05 ` [PATCH 03/16] treewide: remove unnecessary cache.h includes Elijah Newren via GitGitGadget
2023-02-23  8:05 ` [PATCH 04/16] treewide: remove unnecessary cache.h includes in source files Elijah Newren via GitGitGadget
2023-02-23 13:57   ` Derrick Stolee
2023-02-23  8:05 ` [PATCH 05/16] alloc.h: move ALLOC_GROW() functions from cache.h Elijah Newren via GitGitGadget
2023-02-23 14:06   ` Derrick Stolee
2023-02-23 18:22     ` Elijah Newren
2023-02-23 19:40     ` Junio C Hamano
2023-02-23 19:39   ` Junio C Hamano
2023-02-23  8:05 ` [PATCH 06/16] hash.h: move some oid-related declarations " Elijah Newren via GitGitGadget
2023-02-23 14:08   ` Derrick Stolee
2023-02-23 18:25     ` Elijah Newren
2023-02-24 23:55   ` Jonathan Tan
2023-02-23  8:05 ` [PATCH 07/16] hex.h: move some hex-related " Elijah Newren via GitGitGadget
2023-02-23 14:11   ` Derrick Stolee
2023-02-23 19:31     ` Elijah Newren
2023-02-23  8:05 ` [PATCH 08/16] pretty.h: move has_non_ascii() declaration from commit.h Elijah Newren via GitGitGadget
2023-02-23  8:05 ` [PATCH 09/16] ident.h: move ident-related declarations out of cache.h Elijah Newren via GitGitGadget
2023-02-23  8:05 ` [PATCH 10/16] object.h: stop depending on cache.h; make cache.h depend on object.h Elijah Newren via GitGitGadget
2023-02-23 14:17   ` Derrick Stolee
2023-02-23 19:55     ` Elijah Newren
2023-02-23  8:05 ` [PATCH 11/16] dir.h: refactor to no longer need to include cache.h Elijah Newren via GitGitGadget
2023-02-23  8:05 ` [PATCH 12/16] object-store.h: move struct object_info from cache.h Elijah Newren via GitGitGadget
2023-02-23 14:20   ` Derrick Stolee
2023-02-23 19:55     ` Elijah Newren
2023-02-23  8:05 ` [PATCH 13/16] replace-object.h: move read_replace_refs declaration from cache.h to here Elijah Newren via GitGitGadget
2023-02-23  8:05 ` [PATCH 14/16] treewide: replace cache.h with more direct headers, where possible Elijah Newren via GitGitGadget
2023-02-23  8:05 ` [PATCH 15/16] Remove unnecessary includes of builtin.h Elijah Newren via GitGitGadget
2023-02-23  8:05 ` [PATCH 16/16] diff.h: remove unnecessary include of object.h Elijah Newren via GitGitGadget
2023-02-23 14:27 ` [PATCH 00/16] Header cleanups Derrick Stolee
2023-02-24  0:09 ` [PATCH v2 00/17] " Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 01/17] treewide: ensure one of the appropriate headers is sourced first Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 02/17] treewide: remove unnecessary git-compat-util.h includes in headers Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 03/17] treewide: remove unnecessary cache.h includes Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 04/17] treewide: remove unnecessary cache.h includes in source files Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 05/17] alloc.h: move ALLOC_GROW() functions from cache.h Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 06/17] hash.h: move some oid-related declarations " Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 07/17] hex.h: move some hex-related " Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 08/17] cache.h: remove dependence on hex.h; make other files include it explicitly Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 09/17] pretty.h: move has_non_ascii() declaration from commit.h Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 10/17] ident.h: move ident-related declarations out of cache.h Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 11/17] object.h: stop depending on cache.h; make cache.h depend on object.h Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 12/17] dir.h: refactor to no longer need to include cache.h Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 13/17] object-store.h: move struct object_info from cache.h Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 14/17] replace-object.h: move read_replace_refs declaration from cache.h to here Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 15/17] treewide: replace cache.h with more direct headers, where possible Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 16/17] Remove unnecessary includes of builtin.h Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 17/17] diff.h: remove unnecessary include of object.h Elijah Newren via GitGitGadget
2023-02-24 14:03   ` [PATCH v2 00/17] Header cleanups Johannes Schindelin
2023-02-25  0:10   ` Jonathan Tan
2023-02-25  0:57     ` Elijah Newren
2023-02-27 13:51   ` Derrick Stolee
  -- strict thread matches above, loose matches on Subject: below --
2023-03-19  6:27 [PATCH 00/16] " Elijah Newren via GitGitGadget
2023-03-20  9:58 ` Ævar Arnfjörð Bjarmason
2023-03-20 16:18   ` Elijah Newren

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=pull.1485.git.1677139521.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=nasamuffin@google.com \
    --cc=newren@gmail.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.
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).