mailinfo: stop using `the_repository`
Stop using `the_repository` in the "mailinfo" subsystem by passing in a repository when setting up the mailinfo structure. Adjust callers accordingly by using `the_repository`. While there may be some callers that have a repository available in their context, this trivial conversion allows for easier verification and bubbles up the use of `the_repository` by one level. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
Dec 17, 2024 at 07:43 UTC
71e5afee8be62c9602838f859592539d8728cc56
4 files changed
+7
-6
builtin/am.c
+1
-1
@@ -1211,7 +1211,7 @@ static int parse_mail(struct am_state *state, const char *mail)
1211
int ret = 0;
1212
struct mailinfo mi;
1213
1214
- setup_mailinfo(&mi);
1214
+ setup_mailinfo(the_repository, &mi);
1215
1216
if (state->utf8)
1217
mi.metainfo_charset = get_commit_output_encoding();
builtin/mailinfo.c
+1
-1
@@ -83,7 +83,7 @@ int cmd_mailinfo(int argc,
83
OPT_END()
84
};
85
86
- setup_mailinfo(&mi);
86
+ setup_mailinfo(the_repository, &mi);
87
meta_charset.policy = CHARSET_DEFAULT;
88
89
argc = parse_options(argc, argv, prefix, options, mailinfo_usage, 0);
mailinfo.c
+2
-3
@@ -1,4 +1,3 @@
1
-#define USE_THE_REPOSITORY_VARIABLE
1
#define DISABLE_SIGN_COMPARE_WARNINGS
2
3
#include "git-compat-util.h"
@@ -1269,7 +1268,7 @@ static int git_mailinfo_config(const char *var, const char *value,
1268
return 0;
1269
}
1270
1272
-void setup_mailinfo(struct mailinfo *mi)
1271
+void setup_mailinfo(struct repository *r, struct mailinfo *mi)
1272
{
1273
memset(mi, 0, sizeof(*mi));
1274
strbuf_init(&mi->name, 0);
@@ -1281,7 +1280,7 @@ void setup_mailinfo(struct mailinfo *mi)
1280
mi->header_stage = 1;
1281
mi->use_inbody_headers = 1;
1282
mi->content_top = mi->content;
1284
- git_config(git_mailinfo_config, mi);
1283
+ repo_config(r, git_mailinfo_config, mi);
1284
}
1285
1286
void clear_mailinfo(struct mailinfo *mi)
mailinfo.h
+3
-1
@@ -5,6 +5,8 @@
5
6
#define MAX_BOUNDARIES 5
7
8
+struct repository;
9
+
10
enum quoted_cr_action {
11
quoted_cr_unset = -1,
12
quoted_cr_nowarn,
@@ -49,7 +51,7 @@ struct mailinfo {
51
};
52
53
int mailinfo_parse_quoted_cr_action(const char *actionstr, int *action);
52
-void setup_mailinfo(struct mailinfo *);
54
+void setup_mailinfo(struct repository *r, struct mailinfo *);
55
int mailinfo(struct mailinfo *, const char *msg, const char *patch);
56
void clear_mailinfo(struct mailinfo *);
57