Skip to content

Commit

Permalink
tests: mailmap: avoid definition of unused static variables
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pks-t committed Nov 28, 2018
1 parent f2f5ec8 commit 2521e11
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
23 changes: 0 additions & 23 deletions tests/mailmap/mailmap_testdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,6 @@ typedef struct mailmap_entry {
const char *replace_email;
} mailmap_entry;

static const char string_mailmap[] =
"# Simple Comment line\n"
"<[email protected]> <[email protected]>\n"
"Some Dude <[email protected]> nick1 <[email protected]>\n"
"Other Author <[email protected]> nick2 <[email protected]>\n"
"Other Author <[email protected]> <[email protected]>\n"
"Phil Hill <[email protected]> # Comment at end of line\n"
"<[email protected]> Joseph <[email protected]>\n"
"Santa Claus <[email protected]> <[email protected]>\n"
"Untracked <[email protected]>";

static const mailmap_entry entries[] = {
{ NULL, "[email protected]", NULL, "[email protected]" },
{ "Some Dude", "[email protected]", "nick1", "[email protected]" },
{ "Other Author", "[email protected]", "nick2", "[email protected]" },
{ "Other Author", "[email protected]", NULL, "[email protected]" },
{ "Phil Hill", NULL, NULL, "[email protected]" },
{ NULL, "[email protected]", "Joseph", "[email protected]" },
{ "Santa Claus", "[email protected]", NULL, "[email protected]" },
/* This entry isn't in the bare repository */
{ "Untracked", NULL, NULL, "[email protected]" }
};

static const mailmap_entry resolved[] = {
{ "Brad", "[email protected]", "Brad", "[email protected]" },
{ "Brad L", "[email protected]", "Brad L", "[email protected]" },
Expand Down
23 changes: 23 additions & 0 deletions tests/mailmap/parsing.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,29 @@ static git_repository *g_repo;
static git_mailmap *g_mailmap;
static git_config *g_config;

static const char string_mailmap[] =
"# Simple Comment line\n"
"<[email protected]> <[email protected]>\n"
"Some Dude <[email protected]> nick1 <[email protected]>\n"
"Other Author <[email protected]> nick2 <[email protected]>\n"
"Other Author <[email protected]> <[email protected]>\n"
"Phil Hill <[email protected]> # Comment at end of line\n"
"<[email protected]> Joseph <[email protected]>\n"
"Santa Claus <[email protected]> <[email protected]>\n"
"Untracked <[email protected]>";

static const mailmap_entry entries[] = {
{ NULL, "[email protected]", NULL, "[email protected]" },
{ "Some Dude", "[email protected]", "nick1", "[email protected]" },
{ "Other Author", "[email protected]", "nick2", "[email protected]" },
{ "Other Author", "[email protected]", NULL, "[email protected]" },
{ "Phil Hill", NULL, NULL, "[email protected]" },
{ NULL, "[email protected]", "Joseph", "[email protected]" },
{ "Santa Claus", "[email protected]", NULL, "[email protected]" },
/* This entry isn't in the bare repository */
{ "Untracked", NULL, NULL, "[email protected]" }
};

void test_mailmap_parsing__initialize(void)
{
g_repo = NULL;
Expand Down

0 comments on commit 2521e11

Please sign in to comment.