git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: git@vger.kernel.org
Cc: "SZEDER Gábor" <szeder.dev@gmail.com>
Subject: [PATCH 1/2] treewide: include parse-options.h in source files
Date: Sun, 19 Mar 2023 17:27:11 +0100	[thread overview]
Message-ID: <20230319162712.654137-2-szeder.dev@gmail.com> (raw)
In-Reply-To: <20230319162712.654137-1-szeder.dev@gmail.com>

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>
---
 builtin/ls-remote.c           | 1 +
 builtin/pack-objects.c        | 1 +
 builtin/receive-pack.c        | 1 +
 builtin/reflog.c              | 1 +
 builtin/send-pack.c           | 1 +
 diagnose.c                    | 1 +
 list-objects-filter-options.c | 1 +
 remote.c                      | 1 +
 revision.c                    | 1 +
 send-pack.c                   | 1 +
 10 files changed, 10 insertions(+)

diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c
index 2dfbd8ed9b..a9de0575ce 100644
--- a/builtin/ls-remote.c
+++ b/builtin/ls-remote.c
@@ -5,6 +5,7 @@
 #include "ref-filter.h"
 #include "remote.h"
 #include "refs.h"
+#include "parse-options.h"
 
 static const char * const ls_remote_usage[] = {
 	N_("git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n"
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 545b8bddc8..7e9e20172a 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -39,6 +39,7 @@
 #include "shallow.h"
 #include "promisor-remote.h"
 #include "pack-mtimes.h"
+#include "parse-options.h"
 
 /*
  * Objects we are going to pack are collected in the `to_pack` structure.
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index fe68c79ee3..fcc87595ac 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -31,6 +31,7 @@
 #include "commit-reach.h"
 #include "worktree.h"
 #include "shallow.h"
+#include "parse-options.h"
 
 static const char * const receive_pack_usage[] = {
 	N_("git receive-pack <git-dir>"),
diff --git a/builtin/reflog.c b/builtin/reflog.c
index 270681dcdf..9b000bb6bc 100644
--- a/builtin/reflog.c
+++ b/builtin/reflog.c
@@ -4,6 +4,7 @@
 #include "reachable.h"
 #include "worktree.h"
 #include "reflog.h"
+#include "parse-options.h"
 
 #define BUILTIN_REFLOG_SHOW_USAGE \
 	N_("git reflog [show] [<log-options>] [<ref>]")
diff --git a/builtin/send-pack.c b/builtin/send-pack.c
index fb5b2bad2c..42a04ed6fc 100644
--- a/builtin/send-pack.c
+++ b/builtin/send-pack.c
@@ -16,6 +16,7 @@
 #include "gpg-interface.h"
 #include "gettext.h"
 #include "protocol.h"
+#include "parse-options.h"
 
 static const char * const send_pack_usage[] = {
 	N_("git send-pack [--mirror] [--dry-run] [--force]\n"
diff --git a/diagnose.c b/diagnose.c
index 5b398f0cff..998f517c48 100644
--- a/diagnose.c
+++ b/diagnose.c
@@ -8,6 +8,7 @@
 #include "strvec.h"
 #include "object-store.h"
 #include "packfile.h"
+#include "parse-options.h"
 
 struct archive_dir {
 	const char *path;
diff --git a/list-objects-filter-options.c b/list-objects-filter-options.c
index 1d25a5737d..72aeb089cc 100644
--- a/list-objects-filter-options.c
+++ b/list-objects-filter-options.c
@@ -11,6 +11,7 @@
 #include "promisor-remote.h"
 #include "trace.h"
 #include "url.h"
+#include "parse-options.h"
 
 static int parse_combine_filter(
 	struct list_objects_filter_options *filter_options,
diff --git a/remote.c b/remote.c
index b04e5da338..641b083d90 100644
--- a/remote.c
+++ b/remote.c
@@ -17,6 +17,7 @@
 #include "commit-reach.h"
 #include "advice.h"
 #include "connect.h"
+#include "parse-options.h"
 
 enum map_direction { FROM_SRC, FROM_DST };
 
diff --git a/revision.c b/revision.c
index e4c066e90b..8b1ecf07fc 100644
--- a/revision.c
+++ b/revision.c
@@ -37,6 +37,7 @@
 #include "json-writer.h"
 #include "list-objects-filter-options.h"
 #include "resolve-undo.h"
+#include "parse-options.h"
 
 volatile show_early_output_fn_t show_early_output;
 
diff --git a/send-pack.c b/send-pack.c
index 423a5cfe22..0d05191162 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -17,6 +17,7 @@
 #include "gpg-interface.h"
 #include "cache.h"
 #include "shallow.h"
+#include "parse-options.h"
 
 int option_parse_push_signed(const struct option *opt,
 			     const char *arg, int unset)
-- 
2.40.0.499.g88fa0b00d2


  reply	other threads:[~2023-03-19 16:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-19 16:27 [PATCH 0/2] Remove unnecessary inclusions of parse-options.h from headers SZEDER Gábor
2023-03-19 16:27 ` SZEDER Gábor [this message]
2023-03-19 16:27 ` [PATCH 2/2] treewide: remove " SZEDER Gábor
2023-03-20 16:41 ` [PATCH 0/2] Remove " 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=20230319162712.654137-2-szeder.dev@gmail.com \
    --to=szeder.dev@gmail.com \
    --cc=git@vger.kernel.org \
    /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).