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

[PATCH v7 07/12] add-patch: split out `struct interactive_options`

From
Patrick Steinhardt <ps@pks.im>
Date
Dec 3, 2025, 10:48 UTC
Message-ID
<20251203-b4-pks-history-builtin-v7-7-9e9f849bfd0e@pks.im>
In-Reply-To
<20251203-b4-pks-history-builtin-v7-0-9e9f849bfd0e@pks.im>

The `struct add_p_opt` is reused both by our infra for "git add -p" and "git add -i". Users of `run_add_i()` for example are expected to pass `struct add_p_opt`. This is somewhat confusing and raises the question of which options apply to what part of the stack.

But things are even more confusing than that: while callers are expected to pass in `struct add_p_opt`, these options ultimately get used to initialize a `struct add_i_state` that is used by both subsystems. So we are basically going full circle here.

Refactor the code and split out a new `struct interactive_options` that hosts common options used by both. These options are then applied to a `struct interactive_config` that hosts common configuration.

This refactoring doesn't yet fully detangle the two subsystems from one another, as we still end up calling `init_add_i_state()` in the "git add -p" subsystem. This will be fixed in a subsequent commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 add-interactive.c  | 174 +++++++++++------------------------------------------
 add-interactive.h  |  23 +------
 add-patch.c        | 170 +++++++++++++++++++++++++++++++++++++++++++--------
 add-patch.h        |  36 ++++++++++-
 builtin/add.c      |  22 +++----
 builtin/checkout.c |   4 +-
 builtin/commit.c   |  16 ++---
 builtin/reset.c    |  16 ++---
 builtin/stash.c    |  46 +++++++-------
 commit.h           |   2 +-
 10 files changed, 270 insertions(+), 239 deletions(-)
diff --git a/add-interactive.c b/add-interactive.c
index 68fc09547d..05d2e7eefe 100644
--- a/add-interactive.c
+++ b/add-interactive.c
@@ -3,7 +3,6 @@
 #include "git-compat-util.h"
 #include "add-interactive.h"
 #include "color.h"
-#include "config.h"
 #include "diffcore.h"
 #include "gettext.h"
 #include "hash.h"
@@ -20,119 +19,18 @@
 #include "prompt.h"
 #include "tree.h"
 
-static void init_color(struct repository *r, enum git_colorbool use_color,
-		       const char *section_and_slot, char *dst,
-		       const char *default_color)
-{
-	char *key = xstrfmt("color.%s", section_and_slot);
-	const char *value;
-
-	if (!want_color(use_color))
-		dst[0] = '\0';
-	else if (repo_config_get_value(r, key, &value) ||
-		 color_parse(value, dst))
-		strlcpy(dst, default_color, COLOR_MAXLEN);
-
-	free(key);
-}
-
-static enum git_colorbool check_color_config(struct repository *r, const char *var)
-{
-	const char *value;
-	enum git_colorbool ret;
-
-	if (repo_config_get_value(r, var, &value))
-		ret = GIT_COLOR_UNKNOWN;
-	else
-		ret = git_config_colorbool(var, value);
-
-	/*
-	 * Do not rely on want_color() to fall back to color.ui for us. It uses
-	 * the value parsed by git_color_config(), which may not have been
-	 * called by the main command.
-	 */
-	if (ret == GIT_COLOR_UNKNOWN &&
-	    !repo_config_get_value(r, "color.ui", &value))
-		ret = git_config_colorbool("color.ui", value);
-
-	return ret;
-}
-
 void init_add_i_state(struct add_i_state *s, struct repository *r,
-		      struct add_p_opt *add_p_opt)
+		      struct interactive_options *opts)
 {
 	s->r = r;
-	s->context = -1;
-	s->interhunkcontext = -1;
-
-	s->use_color_interactive = check_color_config(r, "color.interactive");
-
-	init_color(r, s->use_color_interactive, "interactive.header",
-		   s->header_color, GIT_COLOR_BOLD);
-	init_color(r, s->use_color_interactive, "interactive.help",
-		   s->help_color, GIT_COLOR_BOLD_RED);
-	init_color(r, s->use_color_interactive, "interactive.prompt",
-		   s->prompt_color, GIT_COLOR_BOLD_BLUE);
-	init_color(r, s->use_color_interactive, "interactive.error",
-		   s->error_color, GIT_COLOR_BOLD_RED);
-	strlcpy(s->reset_color_interactive,
-		want_color(s->use_color_interactive) ? GIT_COLOR_RESET : "", COLOR_MAXLEN);
-
-	s->use_color_diff = check_color_config(r, "color.diff");
-
-	init_color(r, s->use_color_diff, "diff.frag", s->fraginfo_color,
-		   diff_get_color(s->use_color_diff, DIFF_FRAGINFO));
-	init_color(r, s->use_color_diff, "diff.context", s->context_color,
-		   "fall back");
-	if (!strcmp(s->context_color, "fall back"))
-		init_color(r, s->use_color_diff, "diff.plain",
-			   s->context_color,
-			   diff_get_color(s->use_color_diff, DIFF_CONTEXT));
-	init_color(r, s->use_color_diff, "diff.old", s->file_old_color,
-		   diff_get_color(s->use_color_diff, DIFF_FILE_OLD));
-	init_color(r, s->use_color_diff, "diff.new", s->file_new_color,
-		   diff_get_color(s->use_color_diff, DIFF_FILE_NEW));
-	strlcpy(s->reset_color_diff,
-		want_color(s->use_color_diff) ? GIT_COLOR_RESET : "", COLOR_MAXLEN);
-
-	FREE_AND_NULL(s->interactive_diff_filter);
-	repo_config_get_string(r, "interactive.difffilter",
-			       &s->interactive_diff_filter);
-
-	FREE_AND_NULL(s->interactive_diff_algorithm);
-	repo_config_get_string(r, "diff.algorithm",
-			       &s->interactive_diff_algorithm);
-
-	if (!repo_config_get_int(r, "diff.context", &s->context))
-		if (s->context < 0)
-			die(_("%s cannot be negative"), "diff.context");
-	if (!repo_config_get_int(r, "diff.interHunkContext", &s->interhunkcontext))
-		if (s->interhunkcontext < 0)
-			die(_("%s cannot be negative"), "diff.interHunkContext");
-
-	repo_config_get_bool(r, "interactive.singlekey", &s->use_single_key);
-	if (s->use_single_key)
-		setbuf(stdin, NULL);
-
-	if (add_p_opt->context != -1) {
-		if (add_p_opt->context < 0)
-			die(_("%s cannot be negative"), "--unified");
-		s->context = add_p_opt->context;
-	}
-	if (add_p_opt->interhunkcontext != -1) {
-		if (add_p_opt->interhunkcontext < 0)
-			die(_("%s cannot be negative"), "--inter-hunk-context");
-		s->interhunkcontext = add_p_opt->interhunkcontext;
-	}
+	interactive_config_init(&s->cfg, r, opts);
 }
 
 void clear_add_i_state(struct add_i_state *s)
 {
-	FREE_AND_NULL(s->interactive_diff_filter);
-	FREE_AND_NULL(s->interactive_diff_algorithm);
+	interactive_config_clear(&s->cfg);
 	memset(s, 0, sizeof(*s));
-	s->use_color_interactive = GIT_COLOR_UNKNOWN;
-	s->use_color_diff = GIT_COLOR_UNKNOWN;
+	interactive_config_clear(&s->cfg);
 }
 
 /*
@@ -286,7 +184,7 @@ static void list(struct add_i_state *s, struct string_list *list, int *selected,
 		return;
 
 	if (opts->header)
-		color_fprintf_ln(stdout, s->header_color,
+		color_fprintf_ln(stdout, s->cfg.header_color,
 				 "%s", opts->header);
 
 	for (i = 0; i < list->nr; i++) {
@@ -354,7 +252,7 @@ static ssize_t list_and_choose(struct add_i_state *s,
 
 		list(s, &items->items, items->selected, &opts->list_opts);
 
-		color_fprintf(stdout, s->prompt_color, "%s", opts->prompt);
+		color_fprintf(stdout, s->cfg.prompt_color, "%s", opts->prompt);
 		fputs(singleton ? "> " : ">> ", stdout);
 		fflush(stdout);
 
@@ -432,7 +330,7 @@ static ssize_t list_and_choose(struct add_i_state *s,
 
 			if (from < 0 || from >= items->items.nr ||
 			    (singleton && from + 1 != to)) {
-				color_fprintf_ln(stderr, s->error_color,
+				color_fprintf_ln(stderr, s->cfg.error_color,
 						 _("Huh (%s)?"), p);
 				break;
 			} else if (singleton) {
@@ -992,7 +890,7 @@ static int run_patch(struct add_i_state *s, const struct pathspec *ps,
 				free(files->items.items[i].string);
 			} else if (item->index.unmerged ||
 				 item->worktree.unmerged) {
-				color_fprintf_ln(stderr, s->error_color,
+				color_fprintf_ln(stderr, s->cfg.error_color,
 						 _("ignoring unmerged: %s"),
 						 files->items.items[i].string);
 				free(item);
@@ -1014,9 +912,9 @@ static int run_patch(struct add_i_state *s, const struct pathspec *ps,
 	opts->prompt = N_("Patch update");
 	count = list_and_choose(s, files, opts);
 	if (count > 0) {
-		struct add_p_opt add_p_opt = {
-			.context = s->context,
-			.interhunkcontext = s->interhunkcontext,
+		struct interactive_options opts = {
+			.context = s->cfg.context,
+			.interhunkcontext = s->cfg.interhunkcontext,
 		};
 		struct strvec args = STRVEC_INIT;
 		struct pathspec ps_selected = { 0 };
@@ -1028,7 +926,7 @@ static int run_patch(struct add_i_state *s, const struct pathspec *ps,
 		parse_pathspec(&ps_selected,
 			       PATHSPEC_ALL_MAGIC & ~PATHSPEC_LITERAL,
 			       PATHSPEC_LITERAL_PATH, "", args.v);
-		res = run_add_p(s->r, ADD_P_ADD, &add_p_opt, NULL, &ps_selected);
+		res = run_add_p(s->r, ADD_P_ADD, &opts, NULL, &ps_selected);
 		strvec_clear(&args);
 		clear_pathspec(&ps_selected);
 	}
@@ -1064,10 +962,10 @@ static int run_diff(struct add_i_state *s, const struct pathspec *ps,
 		struct child_process cmd = CHILD_PROCESS_INIT;
 
 		strvec_pushl(&cmd.args, "git", "diff", "-p", "--cached", NULL);
-		if (s->context != -1)
-			strvec_pushf(&cmd.args, "--unified=%i", s->context);
-		if (s->interhunkcontext != -1)
-			strvec_pushf(&cmd.args, "--inter-hunk-context=%i", s->interhunkcontext);
+		if (s->cfg.context != -1)
+			strvec_pushf(&cmd.args, "--unified=%i", s->cfg.context);
+		if (s->cfg.interhunkcontext != -1)
+			strvec_pushf(&cmd.args, "--inter-hunk-context=%i", s->cfg.interhunkcontext);
 		strvec_pushl(&cmd.args, oid_to_hex(!is_initial ? &oid :
 			     s->r->hash_algo->empty_tree), "--", NULL);
 		for (i = 0; i < files->items.nr; i++)
@@ -1085,17 +983,17 @@ static int run_help(struct add_i_state *s, const struct pathspec *ps UNUSED,
 		    struct prefix_item_list *files UNUSED,
 		    struct list_and_choose_options *opts UNUSED)
 {
-	color_fprintf_ln(stdout, s->help_color, "status        - %s",
+	color_fprintf_ln(stdout, s->cfg.help_color, "status        - %s",
 			 _("show paths with changes"));
-	color_fprintf_ln(stdout, s->help_color, "update        - %s",
+	color_fprintf_ln(stdout, s->cfg.help_color, "update        - %s",
 			 _("add working tree state to the staged set of changes"));
-	color_fprintf_ln(stdout, s->help_color, "revert        - %s",
+	color_fprintf_ln(stdout, s->cfg.help_color, "revert        - %s",
 			 _("revert staged set of changes back to the HEAD version"));
-	color_fprintf_ln(stdout, s->help_color, "patch         - %s",
+	color_fprintf_ln(stdout, s->cfg.help_color, "patch         - %s",
 			 _("pick hunks and update selectively"));
-	color_fprintf_ln(stdout, s->help_color, "diff          - %s",
+	color_fprintf_ln(stdout, s->cfg.help_color, "diff          - %s",
 			 _("view diff between HEAD and index"));
-	color_fprintf_ln(stdout, s->help_color, "add untracked - %s",
+	color_fprintf_ln(stdout, s->cfg.help_color, "add untracked - %s",
 			 _("add contents of untracked files to the staged set of changes"));
 
 	return 0;
@@ -1103,21 +1001,21 @@ static int run_help(struct add_i_state *s, const struct pathspec *ps UNUSED,
 
 static void choose_prompt_help(struct add_i_state *s)
 {
-	color_fprintf_ln(stdout, s->help_color, "%s",
+	color_fprintf_ln(stdout, s->cfg.help_color, "%s",
 			 _("Prompt help:"));
-	color_fprintf_ln(stdout, s->help_color, "1          - %s",
+	color_fprintf_ln(stdout, s->cfg.help_color, "1          - %s",
 			 _("select a single item"));
-	color_fprintf_ln(stdout, s->help_color, "3-5        - %s",
+	color_fprintf_ln(stdout, s->cfg.help_color, "3-5        - %s",
 			 _("select a range of items"));
-	color_fprintf_ln(stdout, s->help_color, "2-3,6-9    - %s",
+	color_fprintf_ln(stdout, s->cfg.help_color, "2-3,6-9    - %s",
 			 _("select multiple ranges"));
-	color_fprintf_ln(stdout, s->help_color, "foo        - %s",
+	color_fprintf_ln(stdout, s->cfg.help_color, "foo        - %s",
 			 _("select item based on unique prefix"));
-	color_fprintf_ln(stdout, s->help_color, "-...       - %s",
+	color_fprintf_ln(stdout, s->cfg.help_color, "-...       - %s",
 			 _("unselect specified items"));
-	color_fprintf_ln(stdout, s->help_color, "*          - %s",
+	color_fprintf_ln(stdout, s->cfg.help_color, "*          - %s",
 			 _("choose all items"));
-	color_fprintf_ln(stdout, s->help_color, "           - %s",
+	color_fprintf_ln(stdout, s->cfg.help_color, "           - %s",
 			 _("(empty) finish selecting"));
 }
 
@@ -1152,7 +1050,7 @@ static void print_command_item(int i, int selected UNUSED,
 
 static void command_prompt_help(struct add_i_state *s)
 {
-	const char *help_color = s->help_color;
+	const char *help_color = s->cfg.help_color;
 	color_fprintf_ln(stdout, help_color, "%s", _("Prompt help:"));
 	color_fprintf_ln(stdout, help_color, "1          - %s",
 			 _("select a numbered item"));
@@ -1163,7 +1061,7 @@ static void command_prompt_help(struct add_i_state *s)
 }
 
 int run_add_i(struct repository *r, const struct pathspec *ps,
-	      struct add_p_opt *add_p_opt)
+	      struct interactive_options *interactive_opts)
 {
 	struct add_i_state s = { NULL };
 	struct print_command_item_data data = { "[", "]" };
@@ -1206,15 +1104,15 @@ int run_add_i(struct repository *r, const struct pathspec *ps,
 			->util = util;
 	}
 
-	init_add_i_state(&s, r, add_p_opt);
+	init_add_i_state(&s, r, interactive_opts);
 
 	/*
 	 * When color was asked for, use the prompt color for
 	 * highlighting, otherwise use square brackets.
 	 */
-	if (want_color(s.use_color_interactive)) {
-		data.color = s.prompt_color;
-		data.reset = s.reset_color_interactive;
+	if (want_color(s.cfg.use_color_interactive)) {
+		data.color = s.cfg.prompt_color;
+		data.reset = s.cfg.reset_color_interactive;
 	}
 	print_file_item_data.color = data.color;
 	print_file_item_data.reset = data.reset;
diff --git a/add-interactive.h b/add-interactive.h
index 2e3d1d871d..eefa2edc7c 100644
--- a/add-interactive.h
+++ b/add-interactive.h
@@ -2,37 +2,20 @@
 #define ADD_INTERACTIVE_H
 
 #include "add-patch.h"
-#include "color.h"
 
 struct pathspec;
 struct repository;
 
 struct add_i_state {
 	struct repository *r;
-	enum git_colorbool use_color_interactive;
-	enum git_colorbool use_color_diff;
-	char header_color[COLOR_MAXLEN];
-	char help_color[COLOR_MAXLEN];
-	char prompt_color[COLOR_MAXLEN];
-	char error_color[COLOR_MAXLEN];
-	char reset_color_interactive[COLOR_MAXLEN];
-
-	char fraginfo_color[COLOR_MAXLEN];
-	char context_color[COLOR_MAXLEN];
-	char file_old_color[COLOR_MAXLEN];
-	char file_new_color[COLOR_MAXLEN];
-	char reset_color_diff[COLOR_MAXLEN];
-
-	int use_single_key;
-	char *interactive_diff_filter, *interactive_diff_algorithm;
-	int context, interhunkcontext;
+	struct interactive_config cfg;
 };
 
 void init_add_i_state(struct add_i_state *s, struct repository *r,
-		      struct add_p_opt *add_p_opt);
+		      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 add_p_opt *add_p_opt);
+	      struct interactive_options *opts);
 
 #endif
diff --git a/add-patch.c b/add-patch.c
index 5e3481083b..6797d2f690 100644
--- a/add-patch.c
+++ b/add-patch.c
@@ -5,6 +5,8 @@
 #include "add-interactive.h"
 #include "add-patch.h"
 #include "advice.h"
+#include "config.h"
+#include "diff.h"
 #include "editor.h"
 #include "environment.h"
 #include "gettext.h"
@@ -279,6 +281,122 @@ struct add_p_state {
 	const char *revision;
 };
 
+static void init_color(struct repository *r,
+		       enum git_colorbool use_color,
+		       const char *section_and_slot, char *dst,
+		       const char *default_color)
+{
+	char *key = xstrfmt("color.%s", section_and_slot);
+	const char *value;
+
+	if (!want_color(use_color))
+		dst[0] = '\0';
+	else if (repo_config_get_value(r, key, &value) ||
+		 color_parse(value, dst))
+		strlcpy(dst, default_color, COLOR_MAXLEN);
+
+	free(key);
+}
+
+static enum git_colorbool check_color_config(struct repository *r, const char *var)
+{
+	const char *value;
+	enum git_colorbool ret;
+
+	if (repo_config_get_value(r, var, &value))
+		ret = GIT_COLOR_UNKNOWN;
+	else
+		ret = git_config_colorbool(var, value);
+
+	/*
+	 * Do not rely on want_color() to fall back to color.ui for us. It uses
+	 * the value parsed by git_color_config(), which may not have been
+	 * called by the main command.
+	 */
+	if (ret == GIT_COLOR_UNKNOWN &&
+	    !repo_config_get_value(r, "color.ui", &value))
+		ret = git_config_colorbool("color.ui", value);
+
+	return ret;
+}
+
+void interactive_config_init(struct interactive_config *cfg,
+			     struct repository *r,
+			     struct interactive_options *opts)
+{
+	cfg->context = -1;
+	cfg->interhunkcontext = -1;
+
+	cfg->use_color_interactive = check_color_config(r, "color.interactive");
+
+	init_color(r, cfg->use_color_interactive, "interactive.header",
+		   cfg->header_color, GIT_COLOR_BOLD);
+	init_color(r, cfg->use_color_interactive, "interactive.help",
+		   cfg->help_color, GIT_COLOR_BOLD_RED);
+	init_color(r, cfg->use_color_interactive, "interactive.prompt",
+		   cfg->prompt_color, GIT_COLOR_BOLD_BLUE);
+	init_color(r, cfg->use_color_interactive, "interactive.error",
+		   cfg->error_color, GIT_COLOR_BOLD_RED);
+	strlcpy(cfg->reset_color_interactive,
+		want_color(cfg->use_color_interactive) ? GIT_COLOR_RESET : "", COLOR_MAXLEN);
+
+	cfg->use_color_diff = check_color_config(r, "color.diff");
+
+	init_color(r, cfg->use_color_diff, "diff.frag", cfg->fraginfo_color,
+		   diff_get_color(cfg->use_color_diff, DIFF_FRAGINFO));
+	init_color(r, cfg->use_color_diff, "diff.context", cfg->context_color,
+		   "fall back");
+	if (!strcmp(cfg->context_color, "fall back"))
+		init_color(r, cfg->use_color_diff, "diff.plain",
+			   cfg->context_color,
+			   diff_get_color(cfg->use_color_diff, DIFF_CONTEXT));
+	init_color(r, cfg->use_color_diff, "diff.old", cfg->file_old_color,
+		diff_get_color(cfg->use_color_diff, DIFF_FILE_OLD));
+	init_color(r, cfg->use_color_diff, "diff.new", cfg->file_new_color,
+		diff_get_color(cfg->use_color_diff, DIFF_FILE_NEW));
+	strlcpy(cfg->reset_color_diff,
+		want_color(cfg->use_color_diff) ? GIT_COLOR_RESET : "", COLOR_MAXLEN);
+
+	FREE_AND_NULL(cfg->interactive_diff_filter);
+	repo_config_get_string(r, "interactive.difffilter",
+			       &cfg->interactive_diff_filter);
+
+	FREE_AND_NULL(cfg->interactive_diff_algorithm);
+	repo_config_get_string(r, "diff.algorithm",
+			       &cfg->interactive_diff_algorithm);
+
+	if (!repo_config_get_int(r, "diff.context", &cfg->context))
+		if (cfg->context < 0)
+			die(_("%s cannot be negative"), "diff.context");
+	if (!repo_config_get_int(r, "diff.interHunkContext", &cfg->interhunkcontext))
+		if (cfg->interhunkcontext < 0)
+			die(_("%s cannot be negative"), "diff.interHunkContext");
+
+	repo_config_get_bool(r, "interactive.singlekey", &cfg->use_single_key);
+	if (cfg->use_single_key)
+		setbuf(stdin, NULL);
+
+	if (opts->context != -1) {
+		if (opts->context < 0)
+			die(_("%s cannot be negative"), "--unified");
+		cfg->context = opts->context;
+	}
+	if (opts->interhunkcontext != -1) {
+		if (opts->interhunkcontext < 0)
+			die(_("%s cannot be negative"), "--inter-hunk-context");
+		cfg->interhunkcontext = opts->interhunkcontext;
+	}
+}
+
+void interactive_config_clear(struct interactive_config *cfg)
+{
+	FREE_AND_NULL(cfg->interactive_diff_filter);
+	FREE_AND_NULL(cfg->interactive_diff_algorithm);
+	memset(cfg, 0, sizeof(*cfg));
+	cfg->use_color_interactive = GIT_COLOR_UNKNOWN;
+	cfg->use_color_diff = GIT_COLOR_UNKNOWN;
+}
+
 static void add_p_state_clear(struct add_p_state *s)
 {
 	size_t i;
@@ -299,9 +417,9 @@ static void err(struct add_p_state *s, const char *fmt, ...)
 	va_list args;
 
 	va_start(args, fmt);
-	fputs(s->s.error_color, stdout);
+	fputs(s->s.cfg.error_color, stdout);
 	vprintf(fmt, args);
-	puts(s->s.reset_color_interactive);
+	puts(s->s.cfg.reset_color_interactive);
 	va_end(args);
 }
 
@@ -424,12 +542,12 @@ static int parse_diff(struct add_p_state *s, const struct pathspec *ps)
 	int res;
 
 	strvec_pushv(&args, s->mode->diff_cmd);
-	if (s->s.context != -1)
-		strvec_pushf(&args, "--unified=%i", s->s.context);
-	if (s->s.interhunkcontext != -1)
-		strvec_pushf(&args, "--inter-hunk-context=%i", s->s.interhunkcontext);
-	if (s->s.interactive_diff_algorithm)
-		strvec_pushf(&args, "--diff-algorithm=%s", s->s.interactive_diff_algorithm);
+	if (s->s.cfg.context != -1)
+		strvec_pushf(&args, "--unified=%i", s->s.cfg.context);
+	if (s->s.cfg.interhunkcontext != -1)
+		strvec_pushf(&args, "--inter-hunk-context=%i", s->s.cfg.interhunkcontext);
+	if (s->s.cfg.interactive_diff_algorithm)
+		strvec_pushf(&args, "--diff-algorithm=%s", s->s.cfg.interactive_diff_algorithm);
 	if (s->revision) {
 		struct object_id oid;
 		strvec_push(&args,
@@ -458,9 +576,9 @@ static int parse_diff(struct add_p_state *s, const struct pathspec *ps)
 	}
 	strbuf_complete_line(plain);
 
-	if (want_color_fd(1, s->s.use_color_diff)) {
+	if (want_color_fd(1, s->s.cfg.use_color_diff)) {
 		struct child_process colored_cp = CHILD_PROCESS_INIT;
-		const char *diff_filter = s->s.interactive_diff_filter;
+		const char *diff_filter = s->s.cfg.interactive_diff_filter;
 
 		setup_child_process(s, &colored_cp, NULL);
 		xsnprintf((char *)args.v[color_arg_index], 8, "--color");
@@ -693,7 +811,7 @@ static void render_hunk(struct add_p_state *s, struct hunk *hunk,
 				   hunk->colored_end - hunk->colored_start);
 			return;
 		} else {
-			strbuf_addstr(out, s->s.fraginfo_color);
+			strbuf_addstr(out, s->s.cfg.fraginfo_color);
 			p = s->colored.buf + header->colored_extra_start;
 			len = header->colored_extra_end
 				- header->colored_extra_start;
@@ -715,7 +833,7 @@ static void render_hunk(struct add_p_state *s, struct hunk *hunk,
 		if (len)
 			strbuf_add(out, p, len);
 		else if (colored)
-			strbuf_addf(out, "%s\n", s->s.reset_color_diff);
+			strbuf_addf(out, "%s\n", s->s.cfg.reset_color_diff);
 		else
 			strbuf_addch(out, '\n');
 	}
@@ -1104,12 +1222,12 @@ static void recolor_hunk(struct add_p_state *s, struct hunk *hunk)
 
 		strbuf_addstr(&s->colored,
 			      plain[current] == '-' ?
-			      s->s.file_old_color :
+			      s->s.cfg.file_old_color :
 			      plain[current] == '+' ?
-			      s->s.file_new_color :
-			      s->s.context_color);
+			      s->s.cfg.file_new_color :
+			      s->s.cfg.context_color);
 		strbuf_add(&s->colored, plain + current, eol - current);
-		strbuf_addstr(&s->colored, s->s.reset_color_diff);
+		strbuf_addstr(&s->colored, s->s.cfg.reset_color_diff);
 		if (next > eol)
 			strbuf_add(&s->colored, plain + eol, next - eol);
 		current = next;
@@ -1238,7 +1356,7 @@ static int run_apply_check(struct add_p_state *s,
 
 static int read_single_character(struct add_p_state *s)
 {
-	if (s->s.use_single_key) {
+	if (s->s.cfg.use_single_key) {
 		int res = read_key_without_echo(&s->answer);
 		printf("%s\n", res == EOF ? "" : s->answer.buf);
 		return res;
@@ -1252,7 +1370,7 @@ static int read_single_character(struct add_p_state *s)
 static int prompt_yesno(struct add_p_state *s, const char *prompt)
 {
 	for (;;) {
-		color_fprintf(stdout, s->s.prompt_color, "%s", _(prompt));
+		color_fprintf(stdout, s->s.cfg.prompt_color, "%s", _(prompt));
 		fflush(stdout);
 		if (read_single_character(s) == EOF)
 			return -1;
@@ -1560,15 +1678,15 @@ static int patch_update_file(struct add_p_state *s,
 		else
 			prompt_mode_type = PROMPT_HUNK;
 
-		printf("%s(%"PRIuMAX"/%"PRIuMAX") ", s->s.prompt_color,
+		printf("%s(%"PRIuMAX"/%"PRIuMAX") ", s->s.cfg.prompt_color,
 			      (uintmax_t)hunk_index + 1,
 			      (uintmax_t)(file_diff->hunk_nr
 						? file_diff->hunk_nr
 						: 1));
 		printf(_(s->mode->prompt_mode[prompt_mode_type]),
 		       s->buf.buf);
-		if (*s->s.reset_color_interactive)
-			fputs(s->s.reset_color_interactive, stdout);
+		if (*s->s.cfg.reset_color_interactive)
+			fputs(s->s.cfg.reset_color_interactive, stdout);
 		fflush(stdout);
 		if (read_single_character(s) == EOF) {
 			quit = 1;
@@ -1731,7 +1849,7 @@ static int patch_update_file(struct add_p_state *s,
 				err(s, _("Sorry, cannot split this hunk"));
 			} else if (!split_hunk(s, file_diff,
 					     hunk - file_diff->hunk)) {
-				color_fprintf_ln(stdout, s->s.header_color,
+				color_fprintf_ln(stdout, s->s.cfg.header_color,
 						 _("Split into %d hunks."),
 						 (int)splittable_into);
 				rendered_hunk_index = -1;
@@ -1749,7 +1867,7 @@ static int patch_update_file(struct add_p_state *s,
 		} else if (s->answer.buf[0] == '?') {
 			const char *p = _(help_patch_remainder), *eol = p;
 
-			color_fprintf(stdout, s->s.help_color, "%s",
+			color_fprintf(stdout, s->s.cfg.help_color, "%s",
 				      _(s->mode->help_patch_text));
 
 			/*
@@ -1767,7 +1885,7 @@ static int patch_update_file(struct add_p_state *s,
 				if (*p != '?' && !strchr(s->buf.buf, *p))
 					continue;
 
-				color_fprintf_ln(stdout, s->s.help_color,
+				color_fprintf_ln(stdout, s->s.cfg.help_color,
 						 "%.*s", (int)(eol - p), p);
 			}
 		} else {
@@ -1808,7 +1926,7 @@ static int patch_update_file(struct add_p_state *s,
 }
 
 int run_add_p(struct repository *r, enum add_p_mode mode,
-	      struct add_p_opt *o, const char *revision,
+	      struct interactive_options *opts, const char *revision,
 	      const struct pathspec *ps)
 {
 	struct add_p_state s = {
@@ -1816,7 +1934,7 @@ int run_add_p(struct repository *r, enum add_p_mode mode,
 	};
 	size_t i, binary_count = 0;
 
-	init_add_i_state(&s.s, r, o);
+	init_add_i_state(&s.s, r, opts);
 
 	if (mode == ADD_P_STASH)
 		s.mode = &patch_mode_stash;
diff --git a/add-patch.h b/add-patch.h
index 4394c74107..a4a05d9d14 100644
--- a/add-patch.h
+++ b/add-patch.h
@@ -1,15 +1,45 @@
 #ifndef ADD_PATCH_H
 #define ADD_PATCH_H
 
+#include "color.h"
+
 struct pathspec;
 struct repository;
 
-struct add_p_opt {
+struct interactive_options {
 	int context;
 	int interhunkcontext;
 };
 
-#define ADD_P_OPT_INIT { .context = -1, .interhunkcontext = -1 }
+#define INTERACTIVE_OPTIONS_INIT { \
+	.context = -1, \
+	.interhunkcontext = -1, \
+}
+
+struct interactive_config {
+	enum git_colorbool use_color_interactive;
+	enum git_colorbool use_color_diff;
+	char header_color[COLOR_MAXLEN];
+	char help_color[COLOR_MAXLEN];
+	char prompt_color[COLOR_MAXLEN];
+	char error_color[COLOR_MAXLEN];
+	char reset_color_interactive[COLOR_MAXLEN];
+
+	char fraginfo_color[COLOR_MAXLEN];
+	char context_color[COLOR_MAXLEN];
+	char file_old_color[COLOR_MAXLEN];
+	char file_new_color[COLOR_MAXLEN];
+	char reset_color_diff[COLOR_MAXLEN];
+
+	int use_single_key;
+	char *interactive_diff_filter, *interactive_diff_algorithm;
+	int context, interhunkcontext;
+};
+
+void interactive_config_init(struct interactive_config *cfg,
+			     struct repository *r,
+			     struct interactive_options *opts);
+void interactive_config_clear(struct interactive_config *cfg);
 
 enum add_p_mode {
 	ADD_P_ADD,
@@ -20,7 +50,7 @@ enum add_p_mode {
 };
 
 int run_add_p(struct repository *r, enum add_p_mode mode,
-	      struct add_p_opt *o, const char *revision,
+	      struct interactive_options *opts, const char *revision,
 	      const struct pathspec *ps);
 
 #endif
diff --git a/builtin/add.c b/builtin/add.c
index 32709794b3..6f1e213052 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -31,7 +31,7 @@ static const char * const builtin_add_usage[] = {
 	NULL
 };
 static int patch_interactive, add_interactive, edit_interactive;
-static struct add_p_opt add_p_opt = ADD_P_OPT_INIT;
+static struct interactive_options interactive_opts = INTERACTIVE_OPTIONS_INIT;
 static int take_worktree_changes;
 static int add_renormalize;
 static int pathspec_file_nul;
@@ -160,7 +160,7 @@ static int refresh(struct repository *repo, int verbose, const struct pathspec *
 int interactive_add(struct repository *repo,
 		    const char **argv,
 		    const char *prefix,
-		    int patch, struct add_p_opt *add_p_opt)
+		    int patch, struct interactive_options *interactive_opts)
 {
 	struct pathspec pathspec;
 	int ret;
@@ -172,9 +172,9 @@ int interactive_add(struct repository *repo,
 		       prefix, argv);
 
 	if (patch)
-		ret = !!run_add_p(repo, ADD_P_ADD, add_p_opt, NULL, &pathspec);
+		ret = !!run_add_p(repo, ADD_P_ADD, interactive_opts, NULL, &pathspec);
 	else
-		ret = !!run_add_i(repo, &pathspec, add_p_opt);
+		ret = !!run_add_i(repo, &pathspec, interactive_opts);
 
 	clear_pathspec(&pathspec);
 	return ret;
@@ -256,8 +256,8 @@ static struct option builtin_add_options[] = {
 	OPT_GROUP(""),
 	OPT_BOOL('i', "interactive", &add_interactive, N_("interactive picking")),
 	OPT_BOOL('p', "patch", &patch_interactive, N_("select hunks interactively")),
-	OPT_DIFF_UNIFIED(&add_p_opt.context),
-	OPT_DIFF_INTERHUNK_CONTEXT(&add_p_opt.interhunkcontext),
+	OPT_DIFF_UNIFIED(&interactive_opts.context),
+	OPT_DIFF_INTERHUNK_CONTEXT(&interactive_opts.interhunkcontext),
 	OPT_BOOL('e', "edit", &edit_interactive, N_("edit current diff and apply")),
 	OPT__FORCE(&ignored_too, N_("allow adding otherwise ignored files"), 0),
 	OPT_BOOL('u', "update", &take_worktree_changes, N_("update tracked files")),
@@ -400,9 +400,9 @@ int cmd_add(int argc,
 	prepare_repo_settings(repo);
 	repo->settings.command_requires_full_index = 0;
 
-	if (add_p_opt.context < -1)
+	if (interactive_opts.context < -1)
 		die(_("'%s' cannot be negative"), "--unified");
-	if (add_p_opt.interhunkcontext < -1)
+	if (interactive_opts.interhunkcontext < -1)
 		die(_("'%s' cannot be negative"), "--inter-hunk-context");
 
 	if (patch_interactive)
@@ -412,11 +412,11 @@ int cmd_add(int argc,
 			die(_("options '%s' and '%s' cannot be used together"), "--dry-run", "--interactive/--patch");
 		if (pathspec_from_file)
 			die(_("options '%s' and '%s' cannot be used together"), "--pathspec-from-file", "--interactive/--patch");
-		exit(interactive_add(repo, argv + 1, prefix, patch_interactive, &add_p_opt));
+		exit(interactive_add(repo, argv + 1, prefix, patch_interactive, &interactive_opts));
 	} else {
-		if (add_p_opt.context != -1)
+		if (interactive_opts.context != -1)
 			die(_("the option '%s' requires '%s'"), "--unified", "--interactive/--patch");
-		if (add_p_opt.interhunkcontext != -1)
+		if (interactive_opts.interhunkcontext != -1)
 			die(_("the option '%s' requires '%s'"), "--inter-hunk-context", "--interactive/--patch");
 	}
 
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 66b69df6e6..530ae956ad 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -546,7 +546,7 @@ static int checkout_paths(const struct checkout_opts *opts,
 
 	if (opts->patch_mode) {
 		enum add_p_mode patch_mode;
-		struct add_p_opt add_p_opt = {
+		struct interactive_options interactive_opts = {
 			.context = opts->patch_context,
 			.interhunkcontext = opts->patch_interhunk_context,
 		};
@@ -575,7 +575,7 @@ static int checkout_paths(const struct checkout_opts *opts,
 		else
 			BUG("either flag must have been set, worktree=%d, index=%d",
 			    opts->checkout_worktree, opts->checkout_index);
-		return !!run_add_p(the_repository, patch_mode, &add_p_opt,
+		return !!run_add_p(the_repository, patch_mode, &interactive_opts,
 				   rev, &opts->pathspec);
 	}
 
diff --git a/builtin/commit.c b/builtin/commit.c
index 0243f17d53..640495cc57 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -123,7 +123,7 @@ static const char *edit_message, *use_message;
 static char *fixup_message, *fixup_commit, *squash_message;
 static const char *fixup_prefix;
 static int all, also, interactive, patch_interactive, only, amend, signoff;
-static struct add_p_opt add_p_opt = ADD_P_OPT_INIT;
+static struct interactive_options interactive_opts = INTERACTIVE_OPTIONS_INIT;
 static int edit_flag = -1; /* unspecified */
 static int quiet, verbose, no_verify, allow_empty, dry_run, renew_authorship;
 static int config_commit_verbose = -1; /* unspecified */
@@ -356,9 +356,9 @@ static const char *prepare_index(const char **argv, const char *prefix,
 	const char *ret;
 	char *path = NULL;
 
-	if (add_p_opt.context < -1)
+	if (interactive_opts.context < -1)
 		die(_("'%s' cannot be negative"), "--unified");
-	if (add_p_opt.interhunkcontext < -1)
+	if (interactive_opts.interhunkcontext < -1)
 		die(_("'%s' cannot be negative"), "--inter-hunk-context");
 
 	if (is_status)
@@ -407,7 +407,7 @@ static const char *prepare_index(const char **argv, const char *prefix,
 		old_index_env = xstrdup_or_null(getenv(INDEX_ENVIRONMENT));
 		setenv(INDEX_ENVIRONMENT, the_repository->index_file, 1);
 
-		if (interactive_add(the_repository, argv, prefix, patch_interactive, &add_p_opt) != 0)
+		if (interactive_add(the_repository, argv, prefix, patch_interactive, &interactive_opts) != 0)
 			die(_("interactive add failed"));
 
 		the_repository->index_file = old_repo_index_file;
@@ -432,9 +432,9 @@ static const char *prepare_index(const char **argv, const char *prefix,
 		ret = get_lock_file_path(&index_lock);
 		goto out;
 	} else {
-		if (add_p_opt.context != -1)
+		if (interactive_opts.context != -1)
 			die(_("the option '%s' requires '%s'"), "--unified", "--interactive/--patch");
-		if (add_p_opt.interhunkcontext != -1)
+		if (interactive_opts.interhunkcontext != -1)
 			die(_("the option '%s' requires '%s'"), "--inter-hunk-context", "--interactive/--patch");
 	}
 
@@ -1742,8 +1742,8 @@ int cmd_commit(int argc,
 		OPT_BOOL('i', "include", &also, N_("add specified files to index for commit")),
 		OPT_BOOL(0, "interactive", &interactive, N_("interactively add files")),
 		OPT_BOOL('p', "patch", &patch_interactive, N_("interactively add changes")),
-		OPT_DIFF_UNIFIED(&add_p_opt.context),
-		OPT_DIFF_INTERHUNK_CONTEXT(&add_p_opt.interhunkcontext),
+		OPT_DIFF_UNIFIED(&interactive_opts.context),
+		OPT_DIFF_INTERHUNK_CONTEXT(&interactive_opts.interhunkcontext),
 		OPT_BOOL('o', "only", &only, N_("commit only specified files")),
 		OPT_BOOL('n', "no-verify", &no_verify, N_("bypass pre-commit and commit-msg hooks")),
 		OPT_BOOL(0, "dry-run", &dry_run, N_("show what would be committed")),
diff --git a/builtin/reset.c b/builtin/reset.c
index ed35802af1..088449e120 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -346,7 +346,7 @@ int cmd_reset(int argc,
 	struct object_id oid;
 	struct pathspec pathspec;
 	int intent_to_add = 0;
-	struct add_p_opt add_p_opt = ADD_P_OPT_INIT;
+	struct interactive_options interactive_opts = INTERACTIVE_OPTIONS_INIT;
 	const struct option options[] = {
 		OPT__QUIET(&quiet, N_("be quiet, only report errors")),
 		OPT_BOOL(0, "no-refresh", &no_refresh,
@@ -371,8 +371,8 @@ int cmd_reset(int argc,
 			       PARSE_OPT_OPTARG,
 			       option_parse_recurse_submodules_worktree_updater),
 		OPT_BOOL('p', "patch", &patch_mode, N_("select hunks interactively")),
-		OPT_DIFF_UNIFIED(&add_p_opt.context),
-		OPT_DIFF_INTERHUNK_CONTEXT(&add_p_opt.interhunkcontext),
+		OPT_DIFF_UNIFIED(&interactive_opts.context),
+		OPT_DIFF_INTERHUNK_CONTEXT(&interactive_opts.interhunkcontext),
 		OPT_BOOL('N', "intent-to-add", &intent_to_add,
 				N_("record only the fact that removed paths will be added later")),
 		OPT_PATHSPEC_FROM_FILE(&pathspec_from_file),
@@ -423,9 +423,9 @@ int cmd_reset(int argc,
 		oidcpy(&oid, &tree->object.oid);
 	}
 
-	if (add_p_opt.context < -1)
+	if (interactive_opts.context < -1)
 		die(_("'%s' cannot be negative"), "--unified");
-	if (add_p_opt.interhunkcontext < -1)
+	if (interactive_opts.interhunkcontext < -1)
 		die(_("'%s' cannot be negative"), "--inter-hunk-context");
 
 	prepare_repo_settings(the_repository);
@@ -436,12 +436,12 @@ int cmd_reset(int argc,
 			die(_("options '%s' and '%s' cannot be used together"), "--patch", "--{hard,mixed,soft}");
 		trace2_cmd_mode("patch-interactive");
 		update_ref_status = !!run_add_p(the_repository, ADD_P_RESET,
-						&add_p_opt, rev, &pathspec);
+						&interactive_opts, rev, &pathspec);
 		goto cleanup;
 	} else {
-		if (add_p_opt.context != -1)
+		if (interactive_opts.context != -1)
 			die(_("the option '%s' requires '%s'"), "--unified", "--patch");
-		if (add_p_opt.interhunkcontext != -1)
+		if (interactive_opts.interhunkcontext != -1)
 			die(_("the option '%s' requires '%s'"), "--inter-hunk-context", "--patch");
 	}
 
diff --git a/builtin/stash.c b/builtin/stash.c
index 948eba06fb..3b50905233 100644
--- a/builtin/stash.c
+++ b/builtin/stash.c
@@ -1306,7 +1306,7 @@ static int stash_staged(struct stash_info *info, struct strbuf *out_patch,
 
 static int stash_patch(struct stash_info *info, const struct pathspec *ps,
 		       struct strbuf *out_patch, int quiet,
-		       struct add_p_opt *add_p_opt)
+		       struct interactive_options *interactive_opts)
 {
 	int ret = 0;
 	struct child_process cp_read_tree = CHILD_PROCESS_INIT;
@@ -1331,7 +1331,7 @@ static int stash_patch(struct stash_info *info, const struct pathspec *ps,
 	old_index_env = xstrdup_or_null(getenv(INDEX_ENVIRONMENT));
 	setenv(INDEX_ENVIRONMENT, the_repository->index_file, 1);
 
-	ret = !!run_add_p(the_repository, ADD_P_STASH, add_p_opt, NULL, ps);
+	ret = !!run_add_p(the_repository, ADD_P_STASH, interactive_opts, NULL, ps);
 
 	the_repository->index_file = old_repo_index_file;
 	if (old_index_env && *old_index_env)
@@ -1427,7 +1427,8 @@ static int stash_working_tree(struct stash_info *info, const struct pathspec *ps
 }
 
 static int do_create_stash(const struct pathspec *ps, struct strbuf *stash_msg_buf,
-			   int include_untracked, int patch_mode, struct add_p_opt *add_p_opt,
+			   int include_untracked, int patch_mode,
+			   struct interactive_options *interactive_opts,
 			   int only_staged, struct stash_info *info, struct strbuf *patch,
 			   int quiet)
 {
@@ -1509,7 +1510,7 @@ static int do_create_stash(const struct pathspec *ps, struct strbuf *stash_msg_b
 		untracked_commit_option = 1;
 	}
 	if (patch_mode) {
-		ret = stash_patch(info, ps, patch, quiet, add_p_opt);
+		ret = stash_patch(info, ps, patch, quiet, interactive_opts);
 		if (ret < 0) {
 			if (!quiet)
 				fprintf_ln(stderr, _("Cannot save the current "
@@ -1595,7 +1596,8 @@ static int create_stash(int argc, const char **argv, const char *prefix UNUSED,
 }
 
 static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int quiet,
-			 int keep_index, int patch_mode, struct add_p_opt *add_p_opt,
+			 int keep_index, int patch_mode,
+			 struct interactive_options *interactive_opts,
 			 int include_untracked, int only_staged)
 {
 	int ret = 0;
@@ -1667,7 +1669,7 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q
 	if (stash_msg)
 		strbuf_addstr(&stash_msg_buf, stash_msg);
 	if (do_create_stash(ps, &stash_msg_buf, include_untracked, patch_mode,
-			    add_p_opt, only_staged, &info, &patch, quiet)) {
+			    interactive_opts, only_staged, &info, &patch, quiet)) {
 		ret = -1;
 		goto done;
 	}
@@ -1841,7 +1843,7 @@ static int push_stash(int argc, const char **argv, const char *prefix,
 	const char *stash_msg = NULL;
 	char *pathspec_from_file = NULL;
 	struct pathspec ps;
-	struct add_p_opt add_p_opt = ADD_P_OPT_INIT;
+	struct interactive_options interactive_opts = INTERACTIVE_OPTIONS_INIT;
 	struct option options[] = {
 		OPT_BOOL('k', "keep-index", &keep_index,
 			 N_("keep index")),
@@ -1849,8 +1851,8 @@ static int push_stash(int argc, const char **argv, const char *prefix,
 			 N_("stash staged changes only")),
 		OPT_BOOL('p', "patch", &patch_mode,
 			 N_("stash in patch mode")),
-		OPT_DIFF_UNIFIED(&add_p_opt.context),
-		OPT_DIFF_INTERHUNK_CONTEXT(&add_p_opt.interhunkcontext),
+		OPT_DIFF_UNIFIED(&interactive_opts.context),
+		OPT_DIFF_INTERHUNK_CONTEXT(&interactive_opts.interhunkcontext),
 		OPT__QUIET(&quiet, N_("quiet mode")),
 		OPT_BOOL('u', "include-untracked", &include_untracked,
 			 N_("include untracked files in stash")),
@@ -1907,19 +1909,19 @@ static int push_stash(int argc, const char **argv, const char *prefix,
 	}
 
 	if (!patch_mode) {
-		if (add_p_opt.context != -1)
+		if (interactive_opts.context != -1)
 			die(_("the option '%s' requires '%s'"), "--unified", "--patch");
-		if (add_p_opt.interhunkcontext != -1)
+		if (interactive_opts.interhunkcontext != -1)
 			die(_("the option '%s' requires '%s'"), "--inter-hunk-context", "--patch");
 	}
 
-	if (add_p_opt.context < -1)
+	if (interactive_opts.context < -1)
 		die(_("'%s' cannot be negative"), "--unified");
-	if (add_p_opt.interhunkcontext < -1)
+	if (interactive_opts.interhunkcontext < -1)
 		die(_("'%s' cannot be negative"), "--inter-hunk-context");
 
 	ret = do_push_stash(&ps, stash_msg, quiet, keep_index, patch_mode,
-			    &add_p_opt, include_untracked, only_staged);
+			    &interactive_opts, include_untracked, only_staged);
 
 	clear_pathspec(&ps);
 	free(pathspec_from_file);
@@ -1944,7 +1946,7 @@ static int save_stash(int argc, const char **argv, const char *prefix,
 	const char *stash_msg = NULL;
 	struct pathspec ps;
 	struct strbuf stash_msg_buf = STRBUF_INIT;
-	struct add_p_opt add_p_opt = ADD_P_OPT_INIT;
+	struct interactive_options interactive_opts = INTERACTIVE_OPTIONS_INIT;
 	struct option options[] = {
 		OPT_BOOL('k', "keep-index", &keep_index,
 			 N_("keep index")),
@@ -1952,8 +1954,8 @@ static int save_stash(int argc, const char **argv, const char *prefix,
 			 N_("stash staged changes only")),
 		OPT_BOOL('p', "patch", &patch_mode,
 			 N_("stash in patch mode")),
-		OPT_DIFF_UNIFIED(&add_p_opt.context),
-		OPT_DIFF_INTERHUNK_CONTEXT(&add_p_opt.interhunkcontext),
+		OPT_DIFF_UNIFIED(&interactive_opts.context),
+		OPT_DIFF_INTERHUNK_CONTEXT(&interactive_opts.interhunkcontext),
 		OPT__QUIET(&quiet, N_("quiet mode")),
 		OPT_BOOL('u', "include-untracked", &include_untracked,
 			 N_("include untracked files in stash")),
@@ -1973,20 +1975,20 @@ static int save_stash(int argc, const char **argv, const char *prefix,
 
 	memset(&ps, 0, sizeof(ps));
 
-	if (add_p_opt.context < -1)
+	if (interactive_opts.context < -1)
 		die(_("'%s' cannot be negative"), "--unified");
-	if (add_p_opt.interhunkcontext < -1)
+	if (interactive_opts.interhunkcontext < -1)
 		die(_("'%s' cannot be negative"), "--inter-hunk-context");
 
 	if (!patch_mode) {
-		if (add_p_opt.context != -1)
+		if (interactive_opts.context != -1)
 			die(_("the option '%s' requires '%s'"), "--unified", "--patch");
-		if (add_p_opt.interhunkcontext != -1)
+		if (interactive_opts.interhunkcontext != -1)
 			die(_("the option '%s' requires '%s'"), "--inter-hunk-context", "--patch");
 	}
 
 	ret = do_push_stash(&ps, stash_msg, quiet, keep_index,
-			    patch_mode, &add_p_opt, include_untracked,
+			    patch_mode, &interactive_opts, include_untracked,
 			    only_staged);
 
 	strbuf_release(&stash_msg_buf);
diff --git a/commit.h b/commit.h
index 1d6e0c7518..7b6e59d6c1 100644
--- a/commit.h
+++ b/commit.h
@@ -258,7 +258,7 @@ int for_each_commit_graft(each_commit_graft_fn, void *);
 int interactive_add(struct repository *repo,
 		    const char **argv,
 		    const char *prefix,
-		    int patch, struct add_p_opt *add_p_opt);
+		    int patch, struct interactive_options *opts);
 
 struct commit_extra_header {
 	struct commit_extra_header *next;
-- 
2.52.0.239.gd5f0c6e74e.dirty
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 276 of 325 in “Introduce git-history(1) command for easy history editing”
  1. 00/11 Introduce git-history(1) command for easy history editingPatrick Steinhardt, Aug 19, 2025
  2. 01/11 sequencer: optionally skip printing commit summaryPatrick Steinhardt, Aug 19, 2025
  3. 02/11 sequencer: add option to rewind HEAD after picking commitsPatrick Steinhardt, Aug 19, 2025
  4. 03/11 cache-tree: allow writing in-memory index as treePatrick Steinhardt, Aug 19, 2025
  5. 04/11 builtin: add new "history" commandPatrick Steinhardt, Aug 19, 2025
  6. 05/11 builtin/history: implement "drop" subcommandPatrick Steinhardt, Aug 19, 2025
  7. Ben KnobleAug 20, 2025
  8. Patrick SteinhardtAug 22, 2025
  9. Jean-Noël AVILAAug 23, 2025
  10. Patrick SteinhardtAug 24, 2025
  11. 06/11 builtin/history: implement "reorder" subcommandPatrick Steinhardt, Aug 19, 2025
  12. Jean-Noël AVILAAug 23, 2025
  13. Kristoffer HaugsbakkAug 24, 2025
  14. Patrick SteinhardtAug 24, 2025
  15. 07/11 add-patch: split out header from "add-interactive.h"Patrick Steinhardt, Aug 19, 2025
  16. 08/11 add-patch: split out `struct interactive_options`Patrick Steinhardt, Aug 19, 2025
  17. 09/11 add-patch: remove dependency on "add-interactive" subsystemPatrick Steinhardt, Aug 19, 2025
  18. 10/11 add-patch: add support for in-memory index patchingPatrick Steinhardt, Aug 19, 2025
  19. D. Ben KnobleAug 20, 2025
  20. Patrick SteinhardtAug 22, 2025
  21. 11/11 builtin/history: implement "split" subcommandPatrick Steinhardt, Aug 19, 2025
  22. D. Ben KnobleAug 20, 2025
  23. Patrick SteinhardtAug 22, 2025
  24. Junio C HamanoAug 22, 2025
  25. Patrick SteinhardtAug 24, 2025
  26. Jean-Noël AVILAAug 23, 2025
  27. Patrick SteinhardtAug 24, 2025
  28. D. Ben KnobleAug 19, 2025
  29. Patrick SteinhardtAug 20, 2025
  30. Ben KnobleAug 20, 2025
  31. Junio C HamanoAug 20, 2025
  32. Ben KnobleAug 20, 2025
  33. Patrick SteinhardtAug 22, 2025
  34. Junio C HamanoAug 22, 2025
  35. Sergey OrganovAug 21, 2025
  36. Ben KnobleAug 21, 2025
  37. Sergey OrganovAug 21, 2025
  38. Martin von ZweigbergkAug 24, 2025
  39. Patrick SteinhardtAug 24, 2025
  40. SZEDER GáborSep 17, 2025
  41. Matthias BeyerDec 3, 2025
  42. Phillip WoodDec 10, 2025
  43. Matthias BeyerDec 10, 2025
  44. Phillip WoodDec 10, 2025
  45. Junio C HamanoDec 10, 2025
  46. Patrick SteinhardtDec 19, 2025
  47. SZEDER GáborDec 19, 2025
  48. Patrick SteinhardtDec 19, 2025
  49. Elijah NewrenDec 19, 2025
  50. Elijah NewrenDec 20, 2025
  51. Patrick SteinhardtJan 6, 2026
  52. Phillip WoodDec 22, 2025
  53. Patrick SteinhardtJan 6, 2026
  54. D. Ben KnobleDec 22, 2025
  55. Martin von ZweigbergkDec 10, 2025
  56. Elijah NewrenDec 10, 2025
  57. Martin von ZweigbergkDec 10, 2025
  58. Elijah NewrenDec 10, 2025
  59. Kristoffer HaugsbakkDec 15, 2025
  60. Kristoffer HaugsbakkAug 24, 2025
  61. Patrick SteinhardtAug 24, 2025
  62. 00/16 Introduce git-history(1) command for easy history editingPatrick Steinhardt, Aug 24, 2025
  63. 01/16 sequencer: optionally skip printing commit summaryPatrick Steinhardt, Aug 24, 2025
  64. 02/16 sequencer: add option to rewind HEAD after picking commitsPatrick Steinhardt, Aug 24, 2025
  65. 03/16 sequencer: introduce new history editing modePatrick Steinhardt, Aug 24, 2025
  66. D. Ben KnobleAug 26, 2025
  67. Patrick SteinhardtSep 3, 2025
  68. 04/16 sequencer: stop using `the_repository` in `sequencer_remove_state()`Patrick Steinhardt, Aug 24, 2025
  69. 05/16 cache-tree: allow writing in-memory index as treePatrick Steinhardt, Aug 24, 2025
  70. Junio C HamanoAug 25, 2025
  71. Patrick SteinhardtSep 3, 2025
  72. 06/16 builtin: add new "history" commandPatrick Steinhardt, Aug 24, 2025
  73. 07/16 builtin/history: introduce subcommands to manage interrupted rewritesPatrick Steinhardt, Aug 24, 2025
  74. 08/16 builtin/history: implement "drop" subcommandPatrick Steinhardt, Aug 24, 2025
  75. 09/16 builtin/history: implement "reorder" subcommandPatrick Steinhardt, Aug 24, 2025
  76. D. Ben KnobleAug 26, 2025
  77. Patrick SteinhardtSep 3, 2025
  78. 10/16 add-patch: split out header from "add-interactive.h"Patrick Steinhardt, Aug 24, 2025
  79. Junio C HamanoAug 25, 2025
  80. 11/16 add-patch: split out `struct interactive_options`Patrick Steinhardt, Aug 24, 2025
  81. 12/16 add-patch: remove dependency on "add-interactive" subsystemPatrick Steinhardt, Aug 24, 2025
  82. Junio C HamanoAug 25, 2025
  83. 13/16 add-patch: add support for in-memory index patchingPatrick Steinhardt, Aug 24, 2025
  84. 14/16 wt-status: provide function to expose status for treesPatrick Steinhardt, Aug 24, 2025
  85. 15/16 builtin/history: implement "split" subcommandPatrick Steinhardt, Aug 24, 2025
  86. Kristoffer HaugsbakkAug 24, 2025
  87. Patrick SteinhardtSep 3, 2025
  88. D. Ben KnobleAug 26, 2025
  89. Patrick SteinhardtSep 3, 2025
  90. D. Ben KnobleSep 3, 2025
  91. Patrick SteinhardtSep 4, 2025
  92. D. Ben KnobleSep 12, 2025
  93. Patrick SteinhardtSep 15, 2025
  94. Ben KnobleSep 15, 2025
  95. 16/16 builtin/history: implement "reword" subcommandPatrick Steinhardt, Aug 24, 2025
  96. Kristoffer HaugsbakkAug 24, 2025
  97. Patrick SteinhardtSep 3, 2025
  98. D. Ben KnobleSep 3, 2025
  99. Patrick SteinhardtSep 4, 2025
  100. 00/18 Introduce git-history(1) command for easy history editingPatrick Steinhardt, Sep 4, 2025
  101. 01/18 sequencer: optionally skip printing commit summaryPatrick Steinhardt, Sep 4, 2025
  102. Phillip WoodSep 10, 2025
  103. Patrick SteinhardtSep 15, 2025
  104. 02/18 sequencer: add option to rewind HEAD after picking commitsPatrick Steinhardt, Sep 4, 2025
  105. Phillip WoodSep 10, 2025
  106. Patrick SteinhardtSep 15, 2025
  107. Phillip WoodSep 15, 2025
  108. 03/18 sequencer: introduce new history editing modePatrick Steinhardt, Sep 4, 2025
  109. 04/18 sequencer: stop using `the_repository` in `sequencer_remove_state()`Patrick Steinhardt, Sep 4, 2025
  110. 05/18 sequencer: wire up "rewritten-hook" for REPLAY_HISTORY_EDITPatrick Steinhardt, Sep 4, 2025
  111. 06/18 cache-tree: allow writing in-memory index as treePatrick Steinhardt, Sep 4, 2025
  112. 07/18 builtin: add new "history" commandPatrick Steinhardt, Sep 4, 2025
  113. 08/18 builtin/history: introduce subcommands to manage interrupted rewritesPatrick Steinhardt, Sep 4, 2025
  114. 09/18 builtin/history: implement "drop" subcommandPatrick Steinhardt, Sep 4, 2025
  115. 10/18 builtin/history: implement "reorder" subcommandPatrick Steinhardt, Sep 4, 2025
  116. 11/18 add-patch: split out header from "add-interactive.h"Patrick Steinhardt, Sep 4, 2025
  117. 12/18 add-patch: split out `struct interactive_options`Patrick Steinhardt, Sep 4, 2025
  118. 13/18 add-patch: remove dependency on "add-interactive" subsystemPatrick Steinhardt, Sep 4, 2025
  119. 14/18 add-patch: add support for in-memory index patchingPatrick Steinhardt, Sep 4, 2025
  120. 15/18 wt-status: provide function to expose status for treesPatrick Steinhardt, Sep 4, 2025
  121. 16/18 sequencer: allow callers to provide mappings for the old commitPatrick Steinhardt, Sep 4, 2025
  122. 17/18 builtin/history: implement "split" subcommandPatrick Steinhardt, Sep 4, 2025
  123. Phillip WoodSep 10, 2025
  124. Patrick SteinhardtSep 15, 2025
  125. 18/18 builtin/history: implement "reword" subcommandPatrick Steinhardt, Sep 4, 2025
  126. Phillip WoodSep 10, 2025
  127. Patrick SteinhardtSep 15, 2025
  128. Phillip WoodSep 15, 2025
  129. Patrick SteinhardtSep 16, 2025
  130. Phillip WoodSep 16, 2025
  131. Kristoffer HaugsbakkSep 5, 2025
  132. Patrick SteinhardtSep 5, 2025
  133. Elijah NewrenSep 7, 2025
  134. Phillip WoodSep 10, 2025
  135. Phillip WoodSep 10, 2025
  136. Patrick SteinhardtSep 15, 2025
  137. Oswald BuddenhagenSep 16, 2025
  138. Junio C HamanoSep 10, 2025
  139. Patrick SteinhardtSep 15, 2025
  140. 00/12 Introduce git-history(1) command for easy history editingPatrick Steinhardt, Oct 1, 2025
  141. 01/12 wt-status: provide function to expose status for treesPatrick Steinhardt, Oct 1, 2025
  142. Karthik NayakOct 14, 2025
  143. Patrick SteinhardtOct 21, 2025
  144. 02/12 replay: extract logic to pick commitsPatrick Steinhardt, Oct 1, 2025
  145. 03/12 replay: stop using `the_repository`Patrick Steinhardt, Oct 1, 2025
  146. Karthik NayakOct 14, 2025
  147. 04/12 replay: parse commits before dereferencing themPatrick Steinhardt, Oct 1, 2025
  148. Karthik NayakOct 14, 2025
  149. 05/12 builtin: add new "history" commandPatrick Steinhardt, Oct 1, 2025
  150. Kristoffer HaugsbakkOct 2, 2025
  151. Karthik NayakOct 14, 2025
  152. Patrick SteinhardtOct 21, 2025
  153. Junio C HamanoOct 22, 2025
  154. Karthik NayakOct 22, 2025
  155. 06/12 builtin/history: implement "reword" subcommandPatrick Steinhardt, Oct 1, 2025
  156. Karthik NayakOct 14, 2025
  157. Patrick SteinhardtOct 21, 2025
  158. 07/12 add-patch: split out header from "add-interactive.h"Patrick Steinhardt, Oct 1, 2025
  159. 08/12 add-patch: split out `struct interactive_options`Patrick Steinhardt, Oct 1, 2025
  160. Kristoffer HaugsbakkOct 2, 2025
  161. Karthik NayakOct 14, 2025
  162. Patrick SteinhardtOct 21, 2025
  163. 09/12 add-patch: remove dependency on "add-interactive" subsystemPatrick Steinhardt, Oct 1, 2025
  164. 10/12 add-patch: add support for in-memory index patchingPatrick Steinhardt, Oct 1, 2025
  165. Kristoffer HaugsbakkOct 2, 2025
  166. Patrick SteinhardtOct 2, 2025
  167. Karthik NayakOct 14, 2025
  168. 11/12 cache-tree: allow writing in-memory index as treePatrick Steinhardt, Oct 1, 2025
  169. 12/12 builtin/history: implement "split" subcommandPatrick Steinhardt, Oct 1, 2025
  170. Karthik NayakOct 14, 2025
  171. Patrick SteinhardtOct 21, 2025
  172. D. Ben KnobleOct 21, 2025
  173. Patrick SteinhardtOct 27, 2025
  174. Karthik NayakOct 14, 2025
  175. Junio C HamanoOct 14, 2025
  176. 00/12 Introduce git-history(1) command for easy history editingPatrick Steinhardt, Oct 21, 2025
  177. 01/12 wt-status: provide function to expose status for treesPatrick Steinhardt, Oct 21, 2025
  178. Junio C HamanoOct 21, 2025
  179. 02/12 replay: extract logic to pick commitsPatrick Steinhardt, Oct 21, 2025
  180. Junio C HamanoOct 21, 2025
  181. 03/12 replay: stop using `the_repository`Patrick Steinhardt, Oct 21, 2025
  182. Junio C HamanoOct 21, 2025
  183. Junio C HamanoOct 21, 2025
  184. 04/12 replay: parse commits before dereferencing themPatrick Steinhardt, Oct 21, 2025
  185. Junio C HamanoOct 21, 2025
  186. Patrick SteinhardtOct 27, 2025
  187. 05/12 builtin: add new "history" commandPatrick Steinhardt, Oct 21, 2025
  188. Junio C HamanoOct 21, 2025
  189. Patrick SteinhardtOct 27, 2025
  190. 06/12 builtin/history: implement "reword" subcommandPatrick Steinhardt, Oct 21, 2025
  191. Junio C HamanoOct 21, 2025
  192. D. Ben KnobleOct 21, 2025
  193. Patrick SteinhardtOct 27, 2025
  194. Patrick SteinhardtOct 27, 2025
  195. 07/12 add-patch: split out header from "add-interactive.h"Patrick Steinhardt, Oct 21, 2025
  196. 08/12 add-patch: split out `struct interactive_options`Patrick Steinhardt, Oct 21, 2025
  197. 09/12 add-patch: remove dependency on "add-interactive" subsystemPatrick Steinhardt, Oct 21, 2025
  198. 10/12 add-patch: add support for in-memory index patchingPatrick Steinhardt, Oct 21, 2025
  199. 11/12 cache-tree: allow writing in-memory index as treePatrick Steinhardt, Oct 21, 2025
  200. 12/12 builtin/history: implement "split" subcommandPatrick Steinhardt, Oct 21, 2025
  201. Junio C HamanoOct 21, 2025
  202. 00/11 Introduce git-history(1) command for easy history editingPatrick Steinhardt, Oct 27, 2025
  203. 01/11 wt-status: provide function to expose status for treesPatrick Steinhardt, Oct 27, 2025
  204. 02/11 replay: extract logic to pick commitsPatrick Steinhardt, Oct 27, 2025
  205. Phillip WoodNov 17, 2025
  206. Elijah NewrenNov 20, 2025
  207. 03/11 replay: stop using `the_repository`Patrick Steinhardt, Oct 27, 2025
  208. Elijah NewrenNov 20, 2025
  209. Patrick SteinhardtDec 2, 2025
  210. 04/11 builtin: add new "history" commandPatrick Steinhardt, Oct 27, 2025
  211. Phillip WoodNov 17, 2025
  212. Patrick SteinhardtDec 2, 2025
  213. Elijah NewrenNov 20, 2025
  214. Patrick SteinhardtDec 2, 2025
  215. D. Ben KnobleDec 2, 2025
  216. Patrick SteinhardtDec 3, 2025
  217. 05/11 builtin/history: implement "reword" subcommandPatrick Steinhardt, Oct 27, 2025
  218. Phillip WoodNov 17, 2025
  219. Patrick SteinhardtDec 2, 2025
  220. Phillip WoodDec 10, 2025
  221. Elijah NewrenNov 20, 2025
  222. Patrick SteinhardtDec 2, 2025
  223. SZEDER GáborNov 25, 2025
  224. Patrick SteinhardtDec 2, 2025
  225. 06/11 add-patch: split out header from "add-interactive.h"Patrick Steinhardt, Oct 27, 2025
  226. Elijah NewrenNov 20, 2025
  227. 07/11 add-patch: split out `struct interactive_options`Patrick Steinhardt, Oct 27, 2025
  228. Elijah NewrenNov 20, 2025
  229. Phillip WoodNov 20, 2025
  230. Patrick SteinhardtDec 2, 2025
  231. 08/11 add-patch: remove dependency on "add-interactive" subsystemPatrick Steinhardt, Oct 27, 2025
  232. Elijah NewrenNov 20, 2025
  233. Phillip WoodNov 20, 2025
  234. 09/11 add-patch: add support for in-memory index patchingPatrick Steinhardt, Oct 27, 2025
  235. Elijah NewrenNov 20, 2025
  236. Phillip WoodNov 20, 2025
  237. Patrick SteinhardtDec 2, 2025
  238. 10/11 cache-tree: allow writing in-memory index as treePatrick Steinhardt, Oct 27, 2025
  239. Elijah NewrenNov 20, 2025
  240. 11/11 builtin/history: implement "split" subcommandPatrick Steinhardt, Oct 27, 2025
  241. Elijah NewrenNov 20, 2025
  242. Patrick SteinhardtDec 2, 2025
  243. Phillip WoodNov 21, 2025
  244. Patrick SteinhardtDec 2, 2025
  245. Phillip WoodDec 10, 2025
  246. Patrick SteinhardtDec 19, 2025
  247. Sergey OrganovNov 12, 2025
  248. Elijah NewrenNov 20, 2025
  249. Junio C HamanoNov 20, 2025
  250. Elijah NewrenNov 20, 2025
  251. Junio C HamanoNov 20, 2025
  252. Elijah NewrenNov 20, 2025
  253. Phillip WoodNov 21, 2025
  254. Junio C HamanoNov 21, 2025
  255. Elijah NewrenNov 23, 2025
  256. Patrick SteinhardtDec 2, 2025
  257. Elijah NewrenDec 5, 2025
  258. Patrick SteinhardtDec 9, 2025
  259. Martin von ZweigbergkDec 9, 2025
  260. Phillip WoodDec 10, 2025
  261. Elijah NewrenDec 10, 2025
  262. Kristoffer HaugsbakkDec 9, 2025
  263. Working on top of mega mergesD. Ben Knoble, Dec 12, 2025
  264. Elijah NewrenNov 23, 2025
  265. Phillip WoodNov 24, 2025
  266. Elijah NewrenNov 25, 2025
  267. 00/12 Introduce git-history(1) command for easy history editingPatrick Steinhardt, Dec 3, 2025
  268. 01/12 wt-status: provide function to expose status for treesPatrick Steinhardt, Dec 3, 2025
  269. 02/12 replay: extract logic to pick commitsPatrick Steinhardt, Dec 3, 2025
  270. 03/12 replay: stop using `the_repository`Patrick Steinhardt, Dec 3, 2025
  271. 04/12 builtin: add new "history" commandPatrick Steinhardt, Dec 3, 2025
  272. Kristoffer HaugsbakkDec 22, 2025
  273. Patrick SteinhardtJan 6, 2026
  274. 05/12 builtin/history: implement "reword" subcommandPatrick Steinhardt, Dec 3, 2025
  275. 06/12 add-patch: split out header from "add-interactive.h"Patrick Steinhardt, Dec 3, 2025
  276. 07/12 add-patch: split out `struct interactive_options`Patrick Steinhardt, Dec 3, 2025
  277. 08/12 add-patch: remove dependency on "add-interactive" subsystemPatrick Steinhardt, Dec 3, 2025
  278. 09/12 add-patch: add support for in-memory index patchingPatrick Steinhardt, Dec 3, 2025
  279. 10/12 add-patch: allow disabling editing of hunksPatrick Steinhardt, Dec 3, 2025
  280. 11/12 cache-tree: allow writing in-memory index as treePatrick Steinhardt, Dec 3, 2025
  281. 12/12 builtin/history: implement "split" subcommandPatrick Steinhardt, Dec 3, 2025
  282. 0/7 Introduce git-history(1) command for easy history editingPatrick Steinhardt, Jan 9, 2026
  283. 1/7 builtin/replay: extract core logic to replay revisionsPatrick Steinhardt, Jan 9, 2026
  284. Elijah NewrenJan 10, 2026
  285. Patrick SteinhardtJan 12, 2026
  286. 2/7 builtin/replay: move core logic into "libgit.a"Patrick Steinhardt, Jan 9, 2026
  287. Elijah NewrenJan 10, 2026
  288. Patrick SteinhardtJan 12, 2026
  289. Elijah NewrenJan 13, 2026
  290. Patrick SteinhardtJan 13, 2026
  291. 3/7 replay: small set of cleanupsPatrick Steinhardt, Jan 9, 2026
  292. 4/7 replay: yield the object ID of the final rewritten commitPatrick Steinhardt, Jan 9, 2026
  293. Elijah NewrenJan 10, 2026
  294. Patrick SteinhardtJan 12, 2026
  295. 5/7 wt-status: provide function to expose status for treesPatrick Steinhardt, Jan 9, 2026
  296. 6/7 builtin: add new "history" commandPatrick Steinhardt, Jan 9, 2026
  297. Elijah NewrenJan 10, 2026
  298. Patrick SteinhardtJan 12, 2026
  299. 7/7 builtin/history: implement "reword" subcommandPatrick Steinhardt, Jan 9, 2026
  300. Elijah NewrenJan 10, 2026
  301. SZEDER GáborJan 10, 2026
  302. Patrick SteinhardtJan 12, 2026
  303. 0/2 SomeElijah Newren, Jan 11, 2026
  304. 8/7 SQUASH ME: FixupsElijah Newren, Jan 11, 2026
  305. 9/7 history: fix detached HEAD handlingElijah Newren, Jan 11, 2026
  306. Elijah NewrenJan 11, 2026
  307. Patrick SteinhardtJan 12, 2026
  308. 0/8 Introduce git-history(1) command for easy history editingPatrick Steinhardt, Jan 13, 2026
  309. 1/8 builtin/replay: extract core logic to replay revisionsPatrick Steinhardt, Jan 13, 2026
  310. 2/8 builtin/replay: move core logic into "libgit.a"Patrick Steinhardt, Jan 13, 2026
  311. 3/8 replay: small set of cleanupsPatrick Steinhardt, Jan 13, 2026
  312. 4/8 replay: support empty commit rangesPatrick Steinhardt, Jan 13, 2026
  313. 5/8 replay: support updating detached HEADPatrick Steinhardt, Jan 13, 2026
  314. 6/8 wt-status: provide function to expose status for treesPatrick Steinhardt, Jan 13, 2026
  315. 7/8 builtin: add new "history" commandPatrick Steinhardt, Jan 13, 2026
  316. 8/8 builtin/history: implement "reword" subcommandPatrick Steinhardt, Jan 13, 2026
  317. SZEDER GáborJan 16, 2026
  318. Elijah NewrenJan 17, 2026
  319. Junio C HamanoJan 18, 2026
  320. Junio C HamanoFeb 3, 2026
  321. Patrick SteinhardtFeb 5, 2026
  322. Elijah NewrenJan 16, 2026
  323. Junio C HamanoJan 16, 2026
  324. SZEDER GáborJan 16, 2026
  325. Junio C HamanoJan 21, 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.