treewide: include parse-options.h in source files

The builtins 'ls-remote', 'pack-objects', 'receive-pack', 'reflog' and 'send-pack' use parse_options(), but their source files don't directly include 'parse-options.h'. Furthermore, the source files 'diagnose.c', 'list-objects-filter-options.c', 'remote.c' and 'send-pack.c' define option parsing callback functions, while 'revision.c' defines an option parsing helper function, and thus need access to various fields in 'struct option' and 'struct parse_opt_ctx_t', but they don't directly include 'parse-options.h' either. They all can still be built, of course, because they include one of the header files that does include 'parse-options.h' (though unnecessarily, see the next commit). Add those missing includes to these files, as our general rule is that "a C file must directly include the header files that declare the functions and the types it uses". Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Reviewed-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

SZEDER Gábor committed Mar 19, 2023 at 17:27 UTC 49fd5511945977882ef2cd8b3c00ed25ac208512
10 files changed +10
builtin/ls-remote.c
+1
@@ -4,6 +4,7 @@
4 #include "ref-filter.h"
5 #include "remote.h"
6 #include "refs.h"
7 +#include "parse-options.h"
8
9 static const char * const ls_remote_usage[] = {
10 N_("git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n"
builtin/pack-objects.c
+1
@@ -37,6 +37,7 @@
37 #include "shallow.h"
38 #include "promisor-remote.h"
39 #include "pack-mtimes.h"
40 +#include "parse-options.h"
41
42 /*
43 * Objects we are going to pack are collected in the `to_pack` structure.
builtin/receive-pack.c
+1
@@ -30,6 +30,7 @@
30 #include "commit-reach.h"
31 #include "worktree.h"
32 #include "shallow.h"
33 +#include "parse-options.h"
34
35 static const char * const receive_pack_usage[] = {
36 N_("git receive-pack <git-dir>"),
builtin/reflog.c
+1
@@ -4,6 +4,7 @@
4 #include "reachable.h"
5 #include "worktree.h"
6 #include "reflog.h"
7 +#include "parse-options.h"
8
9 #define BUILTIN_REFLOG_SHOW_USAGE \
10 N_("git reflog [show] [<log-options>] [<ref>]")
builtin/send-pack.c
+1
@@ -15,6 +15,7 @@
15 #include "gpg-interface.h"
16 #include "gettext.h"
17 #include "protocol.h"
18 +#include "parse-options.h"
19
20 static const char * const send_pack_usage[] = {
21 N_("git send-pack [--mirror] [--dry-run] [--force]\n"
diagnose.c
+1
@@ -7,6 +7,7 @@
7 #include "strvec.h"
8 #include "object-store.h"
9 #include "packfile.h"
10 +#include "parse-options.h"
11
12 struct archive_dir {
13 const char *path;
list-objects-filter-options.c
+1
@@ -9,6 +9,7 @@
9 #include "promisor-remote.h"
10 #include "trace.h"
11 #include "url.h"
12 +#include "parse-options.h"
13
14 static int parse_combine_filter(
15 struct list_objects_filter_options *filter_options,
remote.c
+1
@@ -15,6 +15,7 @@
15 #include "commit-reach.h"
16 #include "advice.h"
17 #include "connect.h"
18 +#include "parse-options.h"
19
20 enum map_direction { FROM_SRC, FROM_DST };
21
revision.c
+1
@@ -35,6 +35,7 @@
35 #include "json-writer.h"
36 #include "list-objects-filter-options.h"
37 #include "resolve-undo.h"
38 +#include "parse-options.h"
39
40 volatile show_early_output_fn_t show_early_output;
41
send-pack.c
+1
@@ -16,6 +16,7 @@
16 #include "gpg-interface.h"
17 #include "cache.h"
18 #include "shallow.h"
19 +#include "parse-options.h"
20
21 int option_parse_push_signed(const struct option *opt,
22 const char *arg, int unset)