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-
13-
"Some Dude <[email protected]> nick1 <[email protected]>\n"
14-
"Other Author <[email protected]> nick2 <[email protected]>\n"
15-
16-
"Phil Hill <[email protected]> # Comment at end of line\n"
17-
18-
19-
"Untracked <[email protected]>";
20-
21-
static const mailmap_entry entries[] = {
22-
{ NULL, "[email protected]", NULL, "[email protected]" },
23-
{ "Some Dude", "[email protected]", "nick1", "[email protected]" },
24-
{ "Other Author", "[email protected]", "nick2", "[email protected]" },
25-
{ "Other Author", "[email protected]", NULL, "[email protected]" },
26-
{ "Phil Hill", NULL, NULL, "[email protected]" },
27-
{ NULL, "[email protected]", "Joseph", "[email protected]" },
28-
{ "Santa Claus", "[email protected]", NULL, "[email protected]" },
29-
/* This entry isn't in the bare repository */
30-
{ "Untracked", NULL, NULL, "[email protected]" }
31-
};
32-
3310
static const mailmap_entry resolved[] = {
3411
{ "Brad", "[email protected]", "Brad", "[email protected]" },
3512
{ "Brad L", "[email protected]", "Brad L", "[email protected]" },

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+
14+
"Some Dude <[email protected]> nick1 <[email protected]>\n"
15+
"Other Author <[email protected]> nick2 <[email protected]>\n"
16+
17+
"Phil Hill <[email protected]> # Comment at end of line\n"
18+
19+
20+
"Untracked <[email protected]>";
21+
22+
static const mailmap_entry entries[] = {
23+
{ NULL, "[email protected]", NULL, "[email protected]" },
24+
{ "Some Dude", "[email protected]", "nick1", "[email protected]" },
25+
{ "Other Author", "[email protected]", "nick2", "[email protected]" },
26+
{ "Other Author", "[email protected]", NULL, "[email protected]" },
27+
{ "Phil Hill", NULL, NULL, "[email protected]" },
28+
{ NULL, "[email protected]", "Joseph", "[email protected]" },
29+
{ "Santa Claus", "[email protected]", NULL, "[email protected]" },
30+
/* This entry isn't in the bare repository */
31+
{ "Untracked", NULL, NULL, "[email protected]" }
32+
};
33+
1134
void test_mailmap_parsing__initialize(void)
1235
{
1336
g_repo = NULL;

0 commit comments

Comments
 (0)