mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
22 lines
465 B
C
22 lines
465 B
C
#ifndef ADD_INTERACTIVE_H
|
|
#define ADD_INTERACTIVE_H
|
|
|
|
#include "add-patch.h"
|
|
|
|
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);
|
|
|
|
#endif
|