From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH] add -i: hide init/clear_add_i_state() functions
Date: Wed, 28 Oct 2026 12:57:51 -0700 [thread overview]
Message-ID: <xmqqh5i58uo0.fsf@gitster.g> (raw)
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().
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-433-ga9209adf11
next reply other threads:[~2026-10-28 19:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 19:57 Junio C Hamano [this message]
2026-10-28 20:48 ` [PATCH] add -i: hide init/clear_add_i_state() functions Ben Knoble
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=xmqqh5i58uo0.fsf@gitster.g \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox