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>
This commit is contained in:

committed by
Junio C Hamano

parent
b4c476c43a
commit
71e5afee8b
@ -1211,7 +1211,7 @@ static int parse_mail(struct am_state *state, const char *mail)
|
||||
int ret = 0;
|
||||
struct mailinfo mi;
|
||||
|
||||
setup_mailinfo(&mi);
|
||||
setup_mailinfo(the_repository, &mi);
|
||||
|
||||
if (state->utf8)
|
||||
mi.metainfo_charset = get_commit_output_encoding();
|
||||
|
@ -83,7 +83,7 @@ int cmd_mailinfo(int argc,
|
||||
OPT_END()
|
||||
};
|
||||
|
||||
setup_mailinfo(&mi);
|
||||
setup_mailinfo(the_repository, &mi);
|
||||
meta_charset.policy = CHARSET_DEFAULT;
|
||||
|
||||
argc = parse_options(argc, argv, prefix, options, mailinfo_usage, 0);
|
||||
|
@ -1,4 +1,3 @@
|
||||
#define USE_THE_REPOSITORY_VARIABLE
|
||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||
|
||||
#include "git-compat-util.h"
|
||||
@ -1269,7 +1268,7 @@ static int git_mailinfo_config(const char *var, const char *value,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void setup_mailinfo(struct mailinfo *mi)
|
||||
void setup_mailinfo(struct repository *r, struct mailinfo *mi)
|
||||
{
|
||||
memset(mi, 0, sizeof(*mi));
|
||||
strbuf_init(&mi->name, 0);
|
||||
@ -1281,7 +1280,7 @@ void setup_mailinfo(struct mailinfo *mi)
|
||||
mi->header_stage = 1;
|
||||
mi->use_inbody_headers = 1;
|
||||
mi->content_top = mi->content;
|
||||
git_config(git_mailinfo_config, mi);
|
||||
repo_config(r, git_mailinfo_config, mi);
|
||||
}
|
||||
|
||||
void clear_mailinfo(struct mailinfo *mi)
|
||||
|
@ -5,6 +5,8 @@
|
||||
|
||||
#define MAX_BOUNDARIES 5
|
||||
|
||||
struct repository;
|
||||
|
||||
enum quoted_cr_action {
|
||||
quoted_cr_unset = -1,
|
||||
quoted_cr_nowarn,
|
||||
@ -49,7 +51,7 @@ struct mailinfo {
|
||||
};
|
||||
|
||||
int mailinfo_parse_quoted_cr_action(const char *actionstr, int *action);
|
||||
void setup_mailinfo(struct mailinfo *);
|
||||
void setup_mailinfo(struct repository *r, struct mailinfo *);
|
||||
int mailinfo(struct mailinfo *, const char *msg, const char *patch);
|
||||
void clear_mailinfo(struct mailinfo *);
|
||||
|
||||
|
Reference in New Issue
Block a user