From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH 2/4] add -i: hide init/clear_add_i_state() functions
Date: Fri, 30 Oct 2026 10:39:54 -0700 [thread overview]
Message-ID: <20261030173956.585250-3-gitster@pobox.com> (raw)
In-Reply-To: <20261030173956.585250-1-gitster@pobox.com>
The "add -i" machinery is encapsulated in run_add_i() function,
which uses init_add_i_state() to initialize the machinery, does its
thing, and clear_add_i_state() to tear it down. External callers
have no need to call anything other than run_add_i(), starting at
d51b61f5da (add-patch: remove dependency on "add-interactive"
subsystem, 2026-03-02) refactored the code paths involved.
Make init/clear_add_i_state() file-scope static functions, and
"struct add_i_state" type as well.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
add-interactive.c | 11 ++++++++---
add-interactive.h | 9 ---------
2 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/add-interactive.c b/add-interactive.c
index 3cf8a1dbf8..9a00daf9f9 100644
--- a/add-interactive.c
+++ b/add-interactive.c
@@ -19,14 +19,19 @@
#include "prompt.h"
#include "tree.h"
-void init_add_i_state(struct add_i_state *s, struct repository *r,
- struct interactive_options *opts)
+struct add_i_state {
+ struct repository *r;
+ struct interactive_config cfg;
+};
+
+static void init_add_i_state(struct add_i_state *s, struct repository *r,
+ struct interactive_options *opts)
{
s->r = r;
interactive_config_init(&s->cfg, r, opts);
}
-void clear_add_i_state(struct add_i_state *s)
+static void clear_add_i_state(struct add_i_state *s)
{
interactive_config_clear(&s->cfg);
memset(s, 0, sizeof(*s));
diff --git a/add-interactive.h b/add-interactive.h
index eefa2edc7c..47f67ede82 100644
--- a/add-interactive.h
+++ b/add-interactive.h
@@ -6,15 +6,6 @@
struct pathspec;
struct repository;
-struct add_i_state {
- struct repository *r;
- struct interactive_config cfg;
-};
-
-void init_add_i_state(struct add_i_state *s, struct repository *r,
- struct interactive_options *opts);
-void clear_add_i_state(struct add_i_state *s);
-
int run_add_i(struct repository *r, const struct pathspec *ps,
struct interactive_options *opts);
--
2.56.0-486-gd49ba3b80a
next prev parent reply other threads:[~2026-10-30 17:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-30 17:39 [PATCH 0/4] mark symbols that are unnecessarily public static Junio C Hamano
2026-10-30 17:39 ` [PATCH 1/4] ident: remove unused author_ident_sufficiently_given() Junio C Hamano
2026-10-30 18:22 ` Jeff King
2026-10-30 17:39 ` Junio C Hamano [this message]
2026-10-30 17:39 ` [PATCH 3/4] read-cache: hide refresh_cache_entry() Junio C Hamano
2026-10-30 18:25 ` Jeff King
2026-10-30 17:39 ` [PATCH 4/4] unpack-trees: hide verify_uptodate() Junio C Hamano
2026-10-30 18:26 ` [PATCH 0/4] mark symbols that are unnecessarily public static Jeff King
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261030173956.585250-3-gitster@pobox.com \
--to=gitster@pobox.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.