Skip to content

Commit 68b1491

Browse files
pks-tgitster
authored andcommitted
add-patch: split out header from "add-interactive.h"
While we have a "add-patch.c" code file, its declarations are part of "add-interactive.h". This makes it somewhat harder than necessary to find relevant code and to identify clear boundaries between the two subsystems. Split up concerns and move declarations that relate to "add-patch.c" into a new "add-patch.h" header. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 8ebb0ce commit 68b1491

File tree

3 files changed

+30
-20
lines changed

3 files changed

+30
-20
lines changed

add-interactive.h

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
#ifndef ADD_INTERACTIVE_H
22
#define ADD_INTERACTIVE_H
33

4+
#include "add-patch.h"
45
#include "color.h"
56

6-
struct add_p_opt {
7-
int context;
8-
int interhunkcontext;
9-
};
10-
11-
#define ADD_P_OPT_INIT { .context = -1, .interhunkcontext = -1 }
7+
struct pathspec;
8+
struct repository;
129

1310
struct add_i_state {
1411
struct repository *r;
@@ -35,21 +32,7 @@ void init_add_i_state(struct add_i_state *s, struct repository *r,
3532
struct add_p_opt *add_p_opt);
3633
void clear_add_i_state(struct add_i_state *s);
3734

38-
struct repository;
39-
struct pathspec;
4035
int run_add_i(struct repository *r, const struct pathspec *ps,
4136
struct add_p_opt *add_p_opt);
4237

43-
enum add_p_mode {
44-
ADD_P_ADD,
45-
ADD_P_STASH,
46-
ADD_P_RESET,
47-
ADD_P_CHECKOUT,
48-
ADD_P_WORKTREE,
49-
};
50-
51-
int run_add_p(struct repository *r, enum add_p_mode mode,
52-
struct add_p_opt *o, const char *revision,
53-
const struct pathspec *ps);
54-
5538
#endif

add-patch.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "git-compat-util.h"
55
#include "add-interactive.h"
6+
#include "add-patch.h"
67
#include "advice.h"
78
#include "editor.h"
89
#include "environment.h"

add-patch.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#ifndef ADD_PATCH_H
2+
#define ADD_PATCH_H
3+
4+
struct pathspec;
5+
struct repository;
6+
7+
struct add_p_opt {
8+
int context;
9+
int interhunkcontext;
10+
};
11+
12+
#define ADD_P_OPT_INIT { .context = -1, .interhunkcontext = -1 }
13+
14+
enum add_p_mode {
15+
ADD_P_ADD,
16+
ADD_P_STASH,
17+
ADD_P_RESET,
18+
ADD_P_CHECKOUT,
19+
ADD_P_WORKTREE,
20+
};
21+
22+
int run_add_p(struct repository *r, enum add_p_mode mode,
23+
struct add_p_opt *o, const char *revision,
24+
const struct pathspec *ps);
25+
26+
#endif

0 commit comments

Comments
 (0)