Skip to content

Commit 71e5afe

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b4c476c commit 71e5afe

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

builtin/am.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,7 @@ static int parse_mail(struct am_state *state, const char *mail)
12111211
int ret = 0;
12121212
struct mailinfo mi;
12131213

1214-
setup_mailinfo(&mi);
1214+
setup_mailinfo(the_repository, &mi);
12151215

12161216
if (state->utf8)
12171217
mi.metainfo_charset = get_commit_output_encoding();

builtin/mailinfo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ int cmd_mailinfo(int argc,
8383
OPT_END()
8484
};
8585

86-
setup_mailinfo(&mi);
86+
setup_mailinfo(the_repository, &mi);
8787
meta_charset.policy = CHARSET_DEFAULT;
8888

8989
argc = parse_options(argc, argv, prefix, options, mailinfo_usage, 0);

mailinfo.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#define USE_THE_REPOSITORY_VARIABLE
21
#define DISABLE_SIGN_COMPARE_WARNINGS
32

43
#include "git-compat-util.h"
@@ -1269,7 +1268,7 @@ static int git_mailinfo_config(const char *var, const char *value,
12691268
return 0;
12701269
}
12711270

1272-
void setup_mailinfo(struct mailinfo *mi)
1271+
void setup_mailinfo(struct repository *r, struct mailinfo *mi)
12731272
{
12741273
memset(mi, 0, sizeof(*mi));
12751274
strbuf_init(&mi->name, 0);
@@ -1281,7 +1280,7 @@ void setup_mailinfo(struct mailinfo *mi)
12811280
mi->header_stage = 1;
12821281
mi->use_inbody_headers = 1;
12831282
mi->content_top = mi->content;
1284-
git_config(git_mailinfo_config, mi);
1283+
repo_config(r, git_mailinfo_config, mi);
12851284
}
12861285

12871286
void clear_mailinfo(struct mailinfo *mi)

mailinfo.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
#define MAX_BOUNDARIES 5
77

8+
struct repository;
9+
810
enum quoted_cr_action {
911
quoted_cr_unset = -1,
1012
quoted_cr_nowarn,
@@ -49,7 +51,7 @@ struct mailinfo {
4951
};
5052

5153
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 *);
5355
int mailinfo(struct mailinfo *, const char *msg, const char *patch);
5456
void clear_mailinfo(struct mailinfo *);
5557

0 commit comments

Comments
 (0)