git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/4] add -i: hide init/clear_add_i_state() functions

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 30, 2026, 17:39 UTC
Message-ID
<20261030173956.585250-3-gitster@pobox.com>
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
Previous: Jeff KingNext: Junio C Hamano
Message 4 of 8 in “mark symbols that are unnecessarily public static”
  1. 0/4 mark symbols that are unnecessarily public staticJunio C Hamano, Oct 30, 2026
  2. 1/4 ident: remove unused author_ident_sufficiently_given()Junio C Hamano, Oct 30, 2026
  3. Jeff KingOct 30, 2026
  4. 2/4 add -i: hide init/clear_add_i_state() functionsJunio C Hamano, Oct 30, 2026
  5. 3/4 read-cache: hide refresh_cache_entry()Junio C Hamano, Oct 30, 2026
  6. Jeff KingOct 30, 2026
  7. 4/4 unpack-trees: hide verify_uptodate()Junio C Hamano, Oct 30, 2026
  8. Jeff KingOct 30, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.