Git fork

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>

authored by

Patrick Steinhardt and committed by
Junio C Hamano
71e5afee b4c476c4

+7 -6
+1 -1
builtin/am.c
··· 1211 1211 int ret = 0; 1212 1212 struct mailinfo mi; 1213 1213 1214 - setup_mailinfo(&mi); 1214 + setup_mailinfo(the_repository, &mi); 1215 1215 1216 1216 if (state->utf8) 1217 1217 mi.metainfo_charset = get_commit_output_encoding();
+1 -1
builtin/mailinfo.c
··· 83 83 OPT_END() 84 84 }; 85 85 86 - setup_mailinfo(&mi); 86 + setup_mailinfo(the_repository, &mi); 87 87 meta_charset.policy = CHARSET_DEFAULT; 88 88 89 89 argc = parse_options(argc, argv, prefix, options, mailinfo_usage, 0);
+2 -3
mailinfo.c
··· 1 - #define USE_THE_REPOSITORY_VARIABLE 2 1 #define DISABLE_SIGN_COMPARE_WARNINGS 3 2 4 3 #include "git-compat-util.h" ··· 1269 1268 return 0; 1270 1269 } 1271 1270 1272 - void setup_mailinfo(struct mailinfo *mi) 1271 + void setup_mailinfo(struct repository *r, struct mailinfo *mi) 1273 1272 { 1274 1273 memset(mi, 0, sizeof(*mi)); 1275 1274 strbuf_init(&mi->name, 0); ··· 1281 1280 mi->header_stage = 1; 1282 1281 mi->use_inbody_headers = 1; 1283 1282 mi->content_top = mi->content; 1284 - git_config(git_mailinfo_config, mi); 1283 + repo_config(r, git_mailinfo_config, mi); 1285 1284 } 1286 1285 1287 1286 void clear_mailinfo(struct mailinfo *mi)
+3 -1
mailinfo.h
··· 5 5 6 6 #define MAX_BOUNDARIES 5 7 7 8 + struct repository; 9 + 8 10 enum quoted_cr_action { 9 11 quoted_cr_unset = -1, 10 12 quoted_cr_nowarn, ··· 49 51 }; 50 52 51 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 *); 53 55 int mailinfo(struct mailinfo *, const char *msg, const char *patch); 54 56 void clear_mailinfo(struct mailinfo *); 55 57