treewide: remove unnecessary includes of cache.h

The last several commits were geared at replacing the include of cache.h
in strbuf.c with an include of git-compat-util.h.  Unfortunately, I had
to drop a patch moving some functions from cache.h to object-name.h, due
to excessive conflicts with other in-flight topics.

However, even without that patch, the series of patches so far allows us
to modify a number of C files to replace an include of cache.h with
git-compat-util.h.  Do that to reduce our dependencies.

(If we could have kept our object-name.h patch in this series, it would
have also let us reduce the includes in checkout.c and fmt-merge-msg.c
in addition to strbuf.c).

Just to ensure that nothing else was bringing in cache.h, all of the
affected files have been checked to ensure that
    gcc -E -I. $SOURCE_FILE | grep '"cache.h"'
found no hits and that
    make DEVELOPER=1 ${OBJECT_FILE_FOR_SOURCE_FILE}
successfully compiles without warnings.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Elijah Newren 2023-03-21 06:26:02 +00:00 коммит произвёл Junio C Hamano
Родитель d5ebb50dcb
Коммит a64acf7298
12 изменённых файлов: 17 добавлений и 12 удалений

Просмотреть файл

@ -1,4 +1,4 @@
#include "cache.h" #include "git-compat-util.h"
#include "compat/terminal.h" #include "compat/terminal.h"
#include "gettext.h" #include "gettext.h"
#include "sigchain.h" #include "sigchain.h"

Просмотреть файл

@ -1,4 +1,4 @@
#include "cache.h" #include "git-compat-util.h"
#include "commit.h" #include "commit.h"
#include "config.h" #include "config.h"
#include "gettext.h" #include "gettext.h"

Просмотреть файл

@ -2,7 +2,7 @@
* Copyright (c) 2005, Junio C Hamano * Copyright (c) 2005, Junio C Hamano
*/ */
#include "cache.h" #include "git-compat-util.h"
#include "abspath.h" #include "abspath.h"
#include "gettext.h" #include "gettext.h"
#include "lockfile.h" #include "lockfile.h"

Просмотреть файл

@ -1,7 +1,6 @@
#include "git-compat-util.h" #include "git-compat-util.h"
#include "parse-options.h" #include "parse-options.h"
#include "abspath.h" #include "abspath.h"
#include "cache.h"
#include "config.h" #include "config.h"
#include "commit.h" #include "commit.h"
#include "color.h" #include "color.h"

Просмотреть файл

@ -11,7 +11,6 @@
#include "test-tool.h" #include "test-tool.h"
#include "git-compat-util.h" #include "git-compat-util.h"
#include "delta.h" #include "delta.h"
#include "cache.h"
#include "wrapper.h" #include "wrapper.h"
static const char usage_str[] = static const char usage_str[] =

Просмотреть файл

@ -1,9 +1,9 @@
#include "test-tool.h" #include "test-tool.h"
#include "cache.h"
#include "strvec.h" #include "strvec.h"
#include "run-command.h" #include "run-command.h"
#include "exec-cmd.h" #include "exec-cmd.h"
#include "config.h" #include "config.h"
#include "trace2.h"
typedef int(fn_unit_test)(int argc, const char **argv); typedef int(fn_unit_test)(int argc, const char **argv);

Просмотреть файл

@ -42,7 +42,8 @@
* file created by its parent. * file created by its parent.
*/ */
#include "cache.h" #include "git-compat-util.h"
#include "path.h"
#include "tempfile.h" #include "tempfile.h"
#include "sigchain.h" #include "sigchain.h"
#include "wrapper.h" #include "wrapper.h"

Просмотреть файл

@ -1,5 +1,7 @@
#include "cache.h" #include "git-compat-util.h"
#include "config.h" #include "config.h"
#include "strbuf.h"
#include "trace2.h"
#include "trace2/tr2_cfg.h" #include "trace2/tr2_cfg.h"
#include "trace2/tr2_sysenv.h" #include "trace2/tr2_sysenv.h"

Просмотреть файл

@ -1,4 +1,5 @@
#include "cache.h" #include "git-compat-util.h"
#include "strbuf.h"
#include "trace2/tr2_cmd_name.h" #include "trace2/tr2_cmd_name.h"
#define TR2_ENVVAR_PARENT_NAME "GIT_TRACE2_PARENT_NAME" #define TR2_ENVVAR_PARENT_NAME "GIT_TRACE2_PARENT_NAME"

Просмотреть файл

@ -1,6 +1,7 @@
#include "cache.h" #include "git-compat-util.h"
#include "abspath.h" #include "abspath.h"
#include "sigchain.h" #include "sigchain.h"
#include "strbuf.h"
#include "trace2/tr2_dst.h" #include "trace2/tr2_dst.h"
#include "trace2/tr2_sid.h" #include "trace2/tr2_sid.h"
#include "trace2/tr2_sysenv.h" #include "trace2/tr2_sysenv.h"

Просмотреть файл

@ -1,5 +1,6 @@
#include "cache.h" #include "git-compat-util.h"
#include "hex.h" #include "hex.h"
#include "strbuf.h"
#include "trace2/tr2_tbuf.h" #include "trace2/tr2_tbuf.h"
#include "trace2/tr2_sid.h" #include "trace2/tr2_sid.h"

Просмотреть файл

@ -3,8 +3,9 @@
* *
* Copyright (C) Linus Torvalds, 2005 * Copyright (C) Linus Torvalds, 2005
*/ */
#include "cache.h" #include "git-compat-util.h"
#include "gettext.h" #include "gettext.h"
#include "trace2.h"
#include "wrapper.h" #include "wrapper.h"
static void vreportf(const char *prefix, const char *err, va_list params) static void vreportf(const char *prefix, const char *err, va_list params)