Skip to content

Commit 2521e11

Browse files
committed
tests: mailmap: avoid definition of unused static variables
The mailmap testdata header contains a set of static variable definitions. As these variables aren't used in all places where they are used, they trigger the unused-const-variable warnings. As we have currently disabled those warnings explicitly, they are never triggered, but we intend to enable them. Avoid the issue by only keeping variable definitions that are actually used in all locations. Move the others to where they are used.
1 parent f2f5ec8 commit 2521e11

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

tests/mailmap/mailmap_testdata.h

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,6 @@ typedef struct mailmap_entry {
77
const char *replace_email;
88
} mailmap_entry;
99

10-
static const char string_mailmap[] =
11-
"# Simple Comment line\n"
12-
"<cto@company.xx> <cto@coompany.xx>\n"
13-
"Some Dude <some@dude.xx> nick1 <bugs@company.xx>\n"
14-
"Other Author <other@author.xx> nick2 <bugs@company.xx>\n"
15-
"Other Author <other@author.xx> <nick2@company.xx>\n"
16-
"Phil Hill <phil@company.xx> # Comment at end of line\n"
17-
"<joseph@company.xx> Joseph <bugs@company.xx>\n"
18-
"Santa Claus <santa.claus@northpole.xx> <me@company.xx>\n"
19-
"Untracked <untracked@company.xx>";
20-
21-
static const mailmap_entry entries[] = {
22-
{ NULL, "cto@company.xx", NULL, "cto@coompany.xx" },
23-
{ "Some Dude", "some@dude.xx", "nick1", "bugs@company.xx" },
24-
{ "Other Author", "other@author.xx", "nick2", "bugs@company.xx" },
25-
{ "Other Author", "other@author.xx", NULL, "nick2@company.xx" },
26-
{ "Phil Hill", NULL, NULL, "phil@company.xx" },
27-
{ NULL, "joseph@company.xx", "Joseph", "bugs@company.xx" },
28-
{ "Santa Claus", "santa.claus@northpole.xx", NULL, "me@company.xx" },
29-
/* This entry isn't in the bare repository */
30-
{ "Untracked", NULL, NULL, "untracked@company.xx" }
31-
};
32-
3310
static const mailmap_entry resolved[] = {
3411
{ "Brad", "cto@company.xx", "Brad", "cto@coompany.xx" },
3512
{ "Brad L", "cto@company.xx", "Brad L", "cto@coompany.xx" },

tests/mailmap/parsing.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,29 @@ static git_repository *g_repo;
88
static git_mailmap *g_mailmap;
99
static git_config *g_config;
1010

11+
static const char string_mailmap[] =
12+
"# Simple Comment line\n"
13+
"<cto@company.xx> <cto@coompany.xx>\n"
14+
"Some Dude <some@dude.xx> nick1 <bugs@company.xx>\n"
15+
"Other Author <other@author.xx> nick2 <bugs@company.xx>\n"
16+
"Other Author <other@author.xx> <nick2@company.xx>\n"
17+
"Phil Hill <phil@company.xx> # Comment at end of line\n"
18+
"<joseph@company.xx> Joseph <bugs@company.xx>\n"
19+
"Santa Claus <santa.claus@northpole.xx> <me@company.xx>\n"
20+
"Untracked <untracked@company.xx>";
21+
22+
static const mailmap_entry entries[] = {
23+
{ NULL, "cto@company.xx", NULL, "cto@coompany.xx" },
24+
{ "Some Dude", "some@dude.xx", "nick1", "bugs@company.xx" },
25+
{ "Other Author", "other@author.xx", "nick2", "bugs@company.xx" },
26+
{ "Other Author", "other@author.xx", NULL, "nick2@company.xx" },
27+
{ "Phil Hill", NULL, NULL, "phil@company.xx" },
28+
{ NULL, "joseph@company.xx", "Joseph", "bugs@company.xx" },
29+
{ "Santa Claus", "santa.claus@northpole.xx", NULL, "me@company.xx" },
30+
/* This entry isn't in the bare repository */
31+
{ "Untracked", NULL, NULL, "untracked@company.xx" }
32+
};
33+
1134
void test_mailmap_parsing__initialize(void)
1235
{
1336
g_repo = NULL;

0 commit comments

Comments
 (0)