summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2018-06-18 10:13:11 +0100
committerGitHub <noreply@github.com>2018-06-18 10:13:11 +0100
commit96882f201a21ce2a07678b84cf1df0afa41402f9 (patch)
tree447bd4a4edab034d9c88c8b4e9b93ccb126aa250 /tests
parent0ecf0e3397502d61787b4e45c3d27fb55b6f9d04 (diff)
parentf98131be911df5e4c47e51ac92e6e7de79e30219 (diff)
downloadlibgit2-96882f201a21ce2a07678b84cf1df0afa41402f9.tar.gz
Merge pull request #4586 from emilio/mailmap
Add mailmap support.
Diffstat (limited to 'tests')
-rw-r--r--tests/clar.h1
-rw-r--r--tests/clar/fixtures.h27
-rw-r--r--tests/clar_libgit2.c10
-rw-r--r--tests/mailmap/basic.c101
-rw-r--r--tests/mailmap/blame.c64
-rw-r--r--tests/mailmap/mailmap_testdata.h44
-rw-r--r--tests/mailmap/parsing.c247
-rw-r--r--tests/resources/mailmap/.gitted/HEAD1
-rw-r--r--tests/resources/mailmap/.gitted/config5
-rw-r--r--tests/resources/mailmap/.gitted/description1
-rw-r--r--tests/resources/mailmap/.gitted/indexbin0 -> 289 bytes
-rw-r--r--tests/resources/mailmap/.gitted/info/exclude6
-rw-r--r--tests/resources/mailmap/.gitted/objects/00/1387531bed84262f137837125d4d998a9ba65dbin0 -> 70 bytes
-rw-r--r--tests/resources/mailmap/.gitted/objects/02/7b2816ae0d7a08ba656d0417c09b4eac18cf00bin0 -> 85 bytes
-rw-r--r--tests/resources/mailmap/.gitted/objects/09/20975110511365e56aec2263082d0c3d56d1fabin0 -> 113 bytes
-rw-r--r--tests/resources/mailmap/.gitted/objects/0c/d99501dfbec781a22ff7b84426b7bb308e709abin0 -> 53 bytes
-rw-r--r--tests/resources/mailmap/.gitted/objects/1e/1212e7674820c17f7b8797aee7bf38ece0e8382
-rw-r--r--tests/resources/mailmap/.gitted/objects/36/370b71f5aad1dd46bec5e14145280a843c9f49bin0 -> 53 bytes
-rw-r--r--tests/resources/mailmap/.gitted/objects/3a/1295dbc9234c0c5947c72803618c7112a014472
-rw-r--r--tests/resources/mailmap/.gitted/objects/3f/134546ae8fbe95a39dd20ea8c12b5fb0f48afb3
-rw-r--r--tests/resources/mailmap/.gitted/objects/43/179dc93939196f59b25387b5e44e9e8794f84c2
-rw-r--r--tests/resources/mailmap/.gitted/objects/46/b5bb908c78b575cac9f9e6e42ff9ba3f769a46bin0 -> 53 bytes
-rw-r--r--tests/resources/mailmap/.gitted/objects/4b/4d2010ba256ef339c1d1854d20249da7478f01bin0 -> 54 bytes
-rw-r--r--tests/resources/mailmap/.gitted/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904bin0 -> 15 bytes
-rw-r--r--tests/resources/mailmap/.gitted/objects/4d/61d588546529ad27b2d77a3d6b05460ecb4be0bin0 -> 79 bytes
-rw-r--r--tests/resources/mailmap/.gitted/objects/50/d69f4e64be2cff2cedde8f9b7f970257caf4dd1
-rw-r--r--tests/resources/mailmap/.gitted/objects/61/293f4c3d7500d227a755a7a8258e28e53449b2bin0 -> 52 bytes
-rw-r--r--tests/resources/mailmap/.gitted/objects/62/7f0bd2f4fb5e949b79ba450d84676fa876b1c8bin0 -> 53 bytes
-rw-r--r--tests/resources/mailmap/.gitted/objects/68/dfd5e5cb6138488680246d134f47ce559f4cf1bin0 -> 149 bytes
-rw-r--r--tests/resources/mailmap/.gitted/objects/69/b9768d022706dab26e2af4dd5a13f42039e36fbin0 -> 123 bytes
-rw-r--r--tests/resources/mailmap/.gitted/objects/6a/0fc44893d4867166f9d321f78c269b3e42b08bbin0 -> 67 bytes
-rw-r--r--tests/resources/mailmap/.gitted/objects/6c/dec08ab9bfcd5a3d889f27bbed650317e3ec13bin0 -> 76 bytes
-rw-r--r--tests/resources/mailmap/.gitted/objects/71/00e631fb4d5deba31fdc8acc98f4fb5c1573fdbin0 -> 178 bytes
-rw-r--r--tests/resources/mailmap/.gitted/objects/7e/cbb98d860b304f622b38ce9ab8f08d14d981a8bin0 -> 198 bytes
-rw-r--r--tests/resources/mailmap/.gitted/objects/7e/e7b9a4a2a1eda925f6260338c063d8211d5ad52
-rw-r--r--tests/resources/mailmap/.gitted/objects/83/714a9223f3e072b85f0d4301cd2081fff3acf2bin0 -> 52 bytes
-rw-r--r--tests/resources/mailmap/.gitted/objects/87/ce8d4920a30ddb9547334e7c65806518863ff12
-rw-r--r--tests/resources/mailmap/.gitted/objects/8c/f0547fcb649b44ebaf39b8104982bb0abb4e69bin0 -> 121 bytes
-rw-r--r--tests/resources/mailmap/.gitted/objects/94/7ff75c33ac7941a32fe9900118b6ba85ab2be9bin0 -> 49 bytes
-rw-r--r--tests/resources/mailmap/.gitted/objects/95/d03c49d94de67d5a05553a1bb22e78f7cdf5ca1
-rw-r--r--tests/resources/mailmap/.gitted/objects/96/78a4325710507f7bf598a0fde5ebbd88148614bin0 -> 132 bytes
-rw-r--r--tests/resources/mailmap/.gitted/objects/a1/6db1cbb8817dddcf199c12d3c81221cf8eefc41
-rw-r--r--tests/resources/mailmap/.gitted/objects/a7/054a4b356b3ecdec60cee66e50beaa5b8637553
-rw-r--r--tests/resources/mailmap/.gitted/objects/a7/eb40274887baeb01a958ead80d106b5977312cbin0 -> 52 bytes
-rw-r--r--tests/resources/mailmap/.gitted/objects/c9/e5462de8ec453e94d85f26f64b80ea76fda6d4bin0 -> 53 bytes
-rw-r--r--tests/resources/mailmap/.gitted/objects/d3/e5e624cc7bfb09ac1960ebb6c458021b098f87bin0 -> 97 bytes
-rw-r--r--tests/resources/mailmap/.gitted/objects/f6/3578091d884c3066a003c50eb6c85ae75422692
-rw-r--r--tests/resources/mailmap/.gitted/objects/fe/dd34e8baffdb2acfe9a6860bf339287ca942bcbin0 -> 53 bytes
-rw-r--r--tests/resources/mailmap/.gitted/objects/fe/ef8f2135df4835496e4d576b1f1bd23510e1c51
-rw-r--r--tests/resources/mailmap/.gitted/refs/heads/master1
-rw-r--r--tests/resources/mailmap/.mailmap9
-rw-r--r--tests/resources/mailmap/file.txt10
-rw-r--r--tests/resources/mailmap/file_override2
53 files changed, 534 insertions, 17 deletions
diff --git a/tests/clar.h b/tests/clar.h
index 5c674d70f..dfb88d76d 100644
--- a/tests/clar.h
+++ b/tests/clar.h
@@ -72,6 +72,7 @@ void cl_trace_register(cl_trace_cb *cb, void *payload);
const char *cl_fixture(const char *fixture_name);
void cl_fixture_sandbox(const char *fixture_name);
void cl_fixture_cleanup(const char *fixture_name);
+const char *cl_fixture_basename(const char *fixture_name);
#endif
/**
diff --git a/tests/clar/fixtures.h b/tests/clar/fixtures.h
index f7b8d96af..77033d365 100644
--- a/tests/clar/fixtures.h
+++ b/tests/clar/fixtures.h
@@ -20,19 +20,6 @@ fixture_path(const char *base, const char *fixture_name)
return _path;
}
-static const char *
-fixture_basename(const char *fixture_name)
-{
- const char *p;
-
- for (p = fixture_name; *p; p++) {
- if (p[0] == '/' && p[1] && p[1] != '/')
- fixture_name = p+1;
- }
-
- return fixture_name;
-}
-
#ifdef CLAR_FIXTURE_PATH
const char *cl_fixture(const char *fixture_name)
{
@@ -44,8 +31,20 @@ void cl_fixture_sandbox(const char *fixture_name)
fs_copy(cl_fixture(fixture_name), _clar_path);
}
+const char *cl_fixture_basename(const char *fixture_name)
+{
+ const char *p;
+
+ for (p = fixture_name; *p; p++) {
+ if (p[0] == '/' && p[1] && p[1] != '/')
+ fixture_name = p+1;
+ }
+
+ return fixture_name;
+}
+
void cl_fixture_cleanup(const char *fixture_name)
{
- fs_rm(fixture_path(_clar_path, fixture_basename(fixture_name)));
+ fs_rm(fixture_path(_clar_path, cl_fixture_basename(fixture_name)));
}
#endif
diff --git a/tests/clar_libgit2.c b/tests/clar_libgit2.c
index 92404b5d7..7ffa015a4 100644
--- a/tests/clar_libgit2.c
+++ b/tests/clar_libgit2.c
@@ -171,13 +171,16 @@ static git_repository *_cl_repo = NULL;
git_repository *cl_git_sandbox_init(const char *sandbox)
{
+ /* Get the name of the sandbox folder which will be created */
+ const char *basename = cl_fixture_basename(sandbox);
+
/* Copy the whole sandbox folder from our fixtures to our test sandbox
* area. After this it can be accessed with `./sandbox`
*/
cl_fixture_sandbox(sandbox);
_cl_sandbox = sandbox;
- cl_git_pass(p_chdir(sandbox));
+ cl_git_pass(p_chdir(basename));
/* If this is not a bare repo, then rename `sandbox/.gitted` to
* `sandbox/.git` which must be done since we cannot store a folder
@@ -200,7 +203,7 @@ git_repository *cl_git_sandbox_init(const char *sandbox)
cl_git_pass(p_chdir(".."));
/* Now open the sandbox repository and make it available for tests */
- cl_git_pass(git_repository_open(&_cl_repo, sandbox));
+ cl_git_pass(git_repository_open(&_cl_repo, basename));
/* Adjust configs after copying to new filesystem */
cl_git_pass(git_repository_reinit_filesystem(_cl_repo, 0));
@@ -222,7 +225,8 @@ git_repository *cl_git_sandbox_reopen(void)
git_repository_free(_cl_repo);
_cl_repo = NULL;
- cl_git_pass(git_repository_open(&_cl_repo, _cl_sandbox));
+ cl_git_pass(git_repository_open(
+ &_cl_repo, cl_fixture_basename(_cl_sandbox)));
}
return _cl_repo;
diff --git a/tests/mailmap/basic.c b/tests/mailmap/basic.c
new file mode 100644
index 000000000..1f8ca56c2
--- /dev/null
+++ b/tests/mailmap/basic.c
@@ -0,0 +1,101 @@
+#include "clar.h"
+#include "clar_libgit2.h"
+
+#include "common.h"
+#include "mailmap.h"
+
+static git_mailmap *mailmap = NULL;
+
+const char TEST_MAILMAP[] =
+ "Foo bar <foo@bar.com> <foo@baz.com> \n"
+ "Blatantly invalid line\n"
+ "Foo bar <foo@bar.com> <foo@bal.com>\n"
+ "<email@foo.com> <otheremail@foo.com>\n"
+ "<email@foo.com> Other Name <yetanotheremail@foo.com>\n";
+
+struct {
+ const char *real_name;
+ const char *real_email;
+ const char *replace_name;
+ const char *replace_email;
+} expected[] = {
+ { "Foo bar", "foo@bar.com", NULL, "foo@baz.com" },
+ { "Foo bar", "foo@bar.com", NULL, "foo@bal.com" },
+ { NULL, "email@foo.com", NULL, "otheremail@foo.com" },
+ { NULL, "email@foo.com", "Other Name", "yetanotheremail@foo.com" }
+};
+
+void test_mailmap_basic__initialize(void)
+{
+ cl_git_pass(git_mailmap_from_buffer(
+ &mailmap, TEST_MAILMAP, strlen(TEST_MAILMAP)));
+}
+
+void test_mailmap_basic__cleanup(void)
+{
+ git_mailmap_free(mailmap);
+ mailmap = NULL;
+}
+
+void test_mailmap_basic__entry(void)
+{
+ size_t idx;
+ const git_mailmap_entry *entry;
+
+ /* Check that we have the expected # of entries */
+ cl_assert_equal_sz(ARRAY_SIZE(expected), git_vector_length(&mailmap->entries));
+
+ for (idx = 0; idx < ARRAY_SIZE(expected); ++idx) {
+ /* Try to look up each entry and make sure they match */
+ entry = git_mailmap_entry_lookup(
+ mailmap, expected[idx].replace_name, expected[idx].replace_email);
+
+ cl_assert(entry);
+ cl_assert_equal_s(entry->real_name, expected[idx].real_name);
+ cl_assert_equal_s(entry->real_email, expected[idx].real_email);
+ cl_assert_equal_s(entry->replace_name, expected[idx].replace_name);
+ cl_assert_equal_s(entry->replace_email, expected[idx].replace_email);
+ }
+}
+
+void test_mailmap_basic__lookup_not_found(void)
+{
+ const git_mailmap_entry *entry = git_mailmap_entry_lookup(
+ mailmap, "Whoever", "doesnotexist@fo.com");
+ cl_assert(!entry);
+}
+
+void test_mailmap_basic__lookup(void)
+{
+ const git_mailmap_entry *entry = git_mailmap_entry_lookup(
+ mailmap, "Typoed the name once", "foo@baz.com");
+ cl_assert(entry);
+ cl_assert_equal_s(entry->real_name, "Foo bar");
+}
+
+void test_mailmap_basic__empty_email_query(void)
+{
+ const char *name;
+ const char *email;
+ cl_git_pass(git_mailmap_resolve(
+ &name, &email, mailmap, "Author name", "otheremail@foo.com"));
+ cl_assert_equal_s(name, "Author name");
+ cl_assert_equal_s(email, "email@foo.com");
+}
+
+void test_mailmap_basic__name_matching(void)
+{
+ const char *name;
+ const char *email;
+ cl_git_pass(git_mailmap_resolve(
+ &name, &email, mailmap, "Other Name", "yetanotheremail@foo.com"));
+
+ cl_assert_equal_s(name, "Other Name");
+ cl_assert_equal_s(email, "email@foo.com");
+
+ cl_git_pass(git_mailmap_resolve(
+ &name, &email, mailmap,
+ "Other Name That Doesn't Match", "yetanotheremail@foo.com"));
+ cl_assert_equal_s(name, "Other Name That Doesn't Match");
+ cl_assert_equal_s(email, "yetanotheremail@foo.com");
+}
diff --git a/tests/mailmap/blame.c b/tests/mailmap/blame.c
new file mode 100644
index 000000000..e6bc1a41f
--- /dev/null
+++ b/tests/mailmap/blame.c
@@ -0,0 +1,64 @@
+#include "clar_libgit2.h"
+#include "git2/repository.h"
+#include "git2/blame.h"
+#include "mailmap.h"
+#include "mailmap_testdata.h"
+
+static git_repository *g_repo;
+static git_blame *g_blame;
+
+void test_mailmap_blame__initialize(void)
+{
+ g_repo = NULL;
+ g_blame = NULL;
+}
+
+void test_mailmap_blame__cleanup(void)
+{
+ git_blame_free(g_blame);
+ cl_git_sandbox_cleanup();
+}
+
+void test_mailmap_blame__hunks(void)
+{
+ size_t idx = 0;
+ const git_blame_hunk *hunk = NULL;
+ git_blame_options opts = GIT_BLAME_OPTIONS_INIT;
+
+ g_repo = cl_git_sandbox_init("mailmap");
+
+ opts.flags |= GIT_BLAME_USE_MAILMAP;
+
+ cl_git_pass(git_blame_file(&g_blame, g_repo, "file.txt", &opts));
+ cl_assert(g_blame);
+
+ for (idx = 0; idx < ARRAY_SIZE(resolved); ++idx) {
+ hunk = git_blame_get_hunk_byline(g_blame, idx + 1);
+
+ cl_assert(hunk->final_signature != NULL);
+ cl_assert(hunk->orig_signature != NULL);
+ cl_assert_equal_s(hunk->final_signature->name, resolved[idx].real_name);
+ cl_assert_equal_s(hunk->final_signature->email, resolved[idx].real_email);
+ }
+}
+
+void test_mailmap_blame__hunks_no_mailmap(void)
+{
+ size_t idx = 0;
+ const git_blame_hunk *hunk = NULL;
+ git_blame_options opts = GIT_BLAME_OPTIONS_INIT;
+
+ g_repo = cl_git_sandbox_init("mailmap");
+
+ cl_git_pass(git_blame_file(&g_blame, g_repo, "file.txt", &opts));
+ cl_assert(g_blame);
+
+ for (idx = 0; idx < ARRAY_SIZE(resolved); ++idx) {
+ hunk = git_blame_get_hunk_byline(g_blame, idx + 1);
+
+ cl_assert(hunk->final_signature != NULL);
+ cl_assert(hunk->orig_signature != NULL);
+ cl_assert_equal_s(hunk->final_signature->name, resolved[idx].replace_name);
+ cl_assert_equal_s(hunk->final_signature->email, resolved[idx].replace_email);
+ }
+}
diff --git a/tests/mailmap/mailmap_testdata.h b/tests/mailmap/mailmap_testdata.h
new file mode 100644
index 000000000..173536dd0
--- /dev/null
+++ b/tests/mailmap/mailmap_testdata.h
@@ -0,0 +1,44 @@
+#include "mailmap.h"
+
+typedef struct mailmap_entry {
+ const char *real_name;
+ const char *real_email;
+ const char *replace_name;
+ const char *replace_email;
+} mailmap_entry;
+
+static const char string_mailmap[] =
+ "# Simple Comment line\n"
+ "<cto@company.xx> <cto@coompany.xx>\n"
+ "Some Dude <some@dude.xx> nick1 <bugs@company.xx>\n"
+ "Other Author <other@author.xx> nick2 <bugs@company.xx>\n"
+ "Other Author <other@author.xx> <nick2@company.xx>\n"
+ "Phil Hill <phil@company.xx> # Comment at end of line\n"
+ "<joseph@company.xx> Joseph <bugs@company.xx>\n"
+ "Santa Claus <santa.claus@northpole.xx> <me@company.xx>\n"
+ "Untracked <untracked@company.xx>";
+
+static const mailmap_entry entries[] = {
+ { NULL, "cto@company.xx", NULL, "cto@coompany.xx" },
+ { "Some Dude", "some@dude.xx", "nick1", "bugs@company.xx" },
+ { "Other Author", "other@author.xx", "nick2", "bugs@company.xx" },
+ { "Other Author", "other@author.xx", NULL, "nick2@company.xx" },
+ { "Phil Hill", NULL, NULL, "phil@company.xx" },
+ { NULL, "joseph@company.xx", "Joseph", "bugs@company.xx" },
+ { "Santa Claus", "santa.claus@northpole.xx", NULL, "me@company.xx" },
+ /* This entry isn't in the bare repository */
+ { "Untracked", NULL, NULL, "untracked@company.xx" }
+};
+
+static const mailmap_entry resolved[] = {
+ { "Brad", "cto@company.xx", "Brad", "cto@coompany.xx" },
+ { "Brad L", "cto@company.xx", "Brad L", "cto@coompany.xx" },
+ { "Some Dude", "some@dude.xx", "nick1", "bugs@company.xx" },
+ { "Other Author", "other@author.xx", "nick2", "bugs@company.xx" },
+ { "nick3", "bugs@company.xx", "nick3", "bugs@company.xx" },
+ { "Other Author", "other@author.xx", "Some Garbage", "nick2@company.xx" },
+ { "Phil Hill", "phil@company.xx", "unknown", "phil@company.xx" },
+ { "Joseph", "joseph@company.xx", "Joseph", "bugs@company.xx" },
+ { "Santa Claus", "santa.claus@northpole.xx", "Clause", "me@company.xx" },
+ { "Charles", "charles@charles.xx", "Charles", "charles@charles.xx" }
+};
diff --git a/tests/mailmap/parsing.c b/tests/mailmap/parsing.c
new file mode 100644
index 000000000..4479e4131
--- /dev/null
+++ b/tests/mailmap/parsing.c
@@ -0,0 +1,247 @@
+#include "clar_libgit2.h"
+#include "repository.h"
+#include "git2/sys/repository.h"
+#include "mailmap_testdata.h"
+#include "buf_text.h"
+
+static git_repository *g_repo;
+static git_mailmap *g_mailmap;
+static git_config *g_config;
+
+void test_mailmap_parsing__initialize(void)
+{
+ g_repo = NULL;
+ g_mailmap = NULL;
+ g_config = NULL;
+}
+
+void test_mailmap_parsing__cleanup(void)
+{
+ git_mailmap_free(g_mailmap);
+ git_config_free(g_config);
+ cl_git_sandbox_cleanup();
+}
+
+static void check_mailmap_entries(
+ const git_mailmap *mailmap, const mailmap_entry *entries, size_t entries_size)
+{
+ const git_mailmap_entry *parsed;
+ size_t idx;
+
+ /* Check the correct # of entries were parsed */
+ cl_assert_equal_sz(entries_size, git_vector_length(&mailmap->entries));
+
+ /* Make sure looking up each entry succeeds */
+ for (idx = 0; idx < entries_size; ++idx) {
+ parsed = git_mailmap_entry_lookup(
+ mailmap, entries[idx].replace_name, entries[idx].replace_email);
+
+ cl_assert(parsed);
+ cl_assert_equal_s(parsed->real_name, entries[idx].real_name);
+ cl_assert_equal_s(parsed->real_email, entries[idx].real_email);
+ cl_assert_equal_s(parsed->replace_name, entries[idx].replace_name);
+ cl_assert_equal_s(parsed->replace_email, entries[idx].replace_email);
+ }
+}
+
+static void check_mailmap_resolve(
+ const git_mailmap *mailmap, const mailmap_entry *resolved, size_t resolved_size)
+{
+ const char *resolved_name = NULL;
+ const char *resolved_email = NULL;
+ size_t idx;
+
+ /* Check that the resolver behaves correctly */
+ for (idx = 0; idx < resolved_size; ++idx) {
+ cl_git_pass(git_mailmap_resolve(
+ &resolved_name, &resolved_email, mailmap,
+ resolved[idx].replace_name, resolved[idx].replace_email));
+ cl_assert_equal_s(resolved_name, resolved[idx].real_name);
+ cl_assert_equal_s(resolved_email, resolved[idx].real_email);
+ }
+}
+
+static const mailmap_entry resolved_untracked[] = {
+ { "Untracked", "untracked@company.xx", "xx", "untracked@company.xx" }
+};
+
+void test_mailmap_parsing__string(void)
+{
+ cl_git_pass(git_mailmap_from_buffer(
+ &g_mailmap, string_mailmap, strlen(string_mailmap)));
+
+ /* We should have parsed all of the entries */
+ check_mailmap_entries(g_mailmap, entries, ARRAY_SIZE(entries));
+
+ /* Check that resolving the entries works */
+ check_mailmap_resolve(g_mailmap, resolved, ARRAY_SIZE(resolved));
+ check_mailmap_resolve(
+ g_mailmap, resolved_untracked, ARRAY_SIZE(resolved_untracked));
+}
+
+void test_mailmap_parsing__windows_string(void)
+{
+ git_buf unixbuf = GIT_BUF_INIT;
+ git_buf winbuf = GIT_BUF_INIT;
+
+ /* Parse with windows-style line endings */
+ git_buf_attach_notowned(&unixbuf, string_mailmap, strlen(string_mailmap));
+ git_buf_text_lf_to_crlf(&winbuf, &unixbuf);
+
+ cl_git_pass(git_mailmap_from_buffer(&g_mailmap, winbuf.ptr, winbuf.size));
+ git_buf_dispose(&winbuf);
+
+ /* We should have parsed all of the entries */
+ check_mailmap_entries(g_mailmap, entries, ARRAY_SIZE(entries));
+
+ /* Check that resolving the entries works */
+ check_mailmap_resolve(g_mailmap, resolved, ARRAY_SIZE(resolved));
+ check_mailmap_resolve(
+ g_mailmap, resolved_untracked, ARRAY_SIZE(resolved_untracked));
+}
+
+void test_mailmap_parsing__fromrepo(void)
+{
+ g_repo = cl_git_sandbox_init("mailmap");
+ cl_check(!git_repository_is_bare(g_repo));
+
+ cl_git_pass(git_mailmap_from_repository(&g_mailmap, g_repo));
+
+ /* We should have parsed all of the entries */
+ check_mailmap_entries(g_mailmap, entries, ARRAY_SIZE(entries));
+
+ /* Check that resolving the entries works */
+ check_mailmap_resolve(g_mailmap, resolved, ARRAY_SIZE(resolved));
+ check_mailmap_resolve(
+ g_mailmap, resolved_untracked, ARRAY_SIZE(resolved_untracked));
+}
+
+static const mailmap_entry resolved_bare[] = {
+ { "xx", "untracked@company.xx", "xx", "untracked@company.xx" }
+};
+
+void test_mailmap_parsing__frombare(void)
+{
+ g_repo = cl_git_sandbox_init("mailmap/.gitted");
+ cl_git_pass(git_repository_set_bare(g_repo));
+ cl_check(git_repository_is_bare(g_repo));
+
+ cl_git_pass(git_mailmap_from_repository(&g_mailmap, g_repo));
+
+ /* We should have parsed all of the entries, except for the untracked one */
+ check_mailmap_entries(g_mailmap, entries, ARRAY_SIZE(entries) - 1);
+
+ /* Check that resolving the entries works */
+ check_mailmap_resolve(g_mailmap, resolved, ARRAY_SIZE(resolved));
+ check_mailmap_resolve(
+ g_mailmap, resolved_bare, ARRAY_SIZE(resolved_bare));
+}
+
+static const mailmap_entry resolved_with_file_override[] = {
+ { "Brad", "cto@company.xx", "Brad", "cto@coompany.xx" },
+ { "Brad L", "cto@company.xx", "Brad L", "cto@coompany.xx" },
+ { "Some Dude", "some@dude.xx", "nick1", "bugs@company.xx" },
+ { "Other Author", "other@author.xx", "nick2", "bugs@company.xx" },
+ { "nick3", "bugs@company.xx", "nick3", "bugs@company.xx" },
+ { "Other Author", "other@author.xx", "Some Garbage", "nick2@company.xx" },
+ { "Joseph", "joseph@company.xx", "Joseph", "bugs@company.xx" },
+ { "Santa Claus", "santa.claus@northpole.xx", "Clause", "me@company.xx" },
+ { "Charles", "charles@charles.xx", "Charles", "charles@charles.xx" },
+
+ /* This name is overridden by file_override */
+ { "File Override", "phil@company.xx", "unknown", "phil@company.xx" },
+ { "Other Name", "fileoverridename@company.xx", "override", "fileoverridename@company.xx" }
+};
+
+void test_mailmap_parsing__file_config(void)
+{
+ g_repo = cl_git_sandbox_init("mailmap");
+ cl_git_pass(git_repository_config(&g_config, g_repo));
+
+ cl_git_pass(git_config_set_string(
+ g_config, "mailmap.file", cl_fixture("mailmap/file_override")));
+
+ cl_git_pass(git_mailmap_from_repository(&g_mailmap, g_repo));
+
+ /* Check we don't have duplicate entries */
+ cl_assert_equal_sz(git_vector_length(&g_mailmap->entries), 9);
+
+ /* Check that resolving the entries works */
+ check_mailmap_resolve(
+ g_mailmap, resolved_with_file_override,
+ ARRAY_SIZE(resolved_with_file_override));
+}
+
+static const mailmap_entry resolved_with_blob_override[] = {
+ { "Brad", "cto@company.xx", "Brad", "cto@coompany.xx" },
+ { "Brad L", "cto@company.xx", "Brad L", "cto@coompany.xx" },
+ { "Some Dude", "some@dude.xx", "nick1", "bugs@company.xx" },
+ { "Other Author", "other@author.xx", "nick2", "bugs@company.xx" },
+ { "nick3", "bugs@company.xx", "nick3", "bugs@company.xx" },
+ { "Other Author", "other@author.xx", "Some Garbage", "nick2@company.xx" },
+ { "Joseph", "joseph@company.xx", "Joseph", "bugs@company.xx" },
+ { "Santa Claus", "santa.claus@northpole.xx", "Clause", "me@company.xx" },
+ { "Charles", "charles@charles.xx", "Charles", "charles@charles.xx" },
+
+ /* This name is overridden by blob_override */
+ { "Blob Override", "phil@company.xx", "unknown", "phil@company.xx" },
+ { "Other Name", "bloboverridename@company.xx", "override", "bloboverridename@company.xx" }
+};
+
+void test_mailmap_parsing__blob_config(void)
+{
+ g_repo = cl_git_sandbox_init("mailmap");
+ cl_git_pass(git_repository_config(&g_config, g_repo));
+
+ cl_git_pass(git_config_set_string(
+ g_config, "mailmap.blob", "HEAD:blob_override"));
+
+ cl_git_pass(git_mailmap_from_repository(&g_mailmap, g_repo));
+
+ /* Check we don't have duplicate entries */
+ cl_assert_equal_sz(git_vector_length(&g_mailmap->entries), 9);
+
+ /* Check that resolving the entries works */
+ check_mailmap_resolve(
+ g_mailmap, resolved_with_blob_override,
+ ARRAY_SIZE(resolved_with_blob_override));
+}
+
+static const mailmap_entry bare_resolved_with_blob_override[] = {
+ /* As mailmap.blob is set, we won't load HEAD:.mailmap */
+ { "Brad", "cto@coompany.xx", "Brad", "cto@coompany.xx" },
+ { "Brad L", "cto@coompany.xx", "Brad L", "cto@coompany.xx" },
+ { "nick1", "bugs@company.xx", "nick1", "bugs@company.xx" },
+ { "nick2", "bugs@company.xx", "nick2", "bugs@company.xx" },
+ { "nick3", "bugs@company.xx", "nick3", "bugs@company.xx" },
+ { "Some Garbage", "nick2@company.xx", "Some Garbage", "nick2@company.xx" },
+ { "Joseph", "bugs@company.xx", "Joseph", "bugs@company.xx" },
+ { "Clause", "me@company.xx", "Clause", "me@company.xx" },
+ { "Charles", "charles@charles.xx", "Charles", "charles@charles.xx" },
+
+ /* This name is overridden by blob_override */
+ { "Blob Override", "phil@company.xx", "unknown", "phil@company.xx" },
+ { "Other Name", "bloboverridename@company.xx", "override", "bloboverridename@company.xx" }
+};
+
+void test_mailmap_parsing__bare_blob_config(void)
+{
+ g_repo = cl_git_sandbox_init("mailmap/.gitted");
+ cl_git_pass(git_repository_set_bare(g_repo));
+ cl_check(git_repository_is_bare(g_repo));
+
+ cl_git_pass(git_repository_config(&g_config, g_repo));
+
+ cl_git_pass(git_config_set_string(
+ g_config, "mailmap.blob", "HEAD:blob_override"));
+
+ cl_git_pass(git_mailmap_from_repository(&g_mailmap, g_repo));
+
+ /* Check that we only have the 2 entries */
+ cl_assert_equal_sz(git_vector_length(&g_mailmap->entries), 2);
+
+ /* Check that resolving the entries works */
+ check_mailmap_resolve(
+ g_mailmap, bare_resolved_with_blob_override,
+ ARRAY_SIZE(bare_resolved_with_blob_override));
+}
diff --git a/tests/resources/mailmap/.gitted/HEAD b/tests/resources/mailmap/.gitted/HEAD
new file mode 100644
index 000000000..cb089cd89
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/HEAD
@@ -0,0 +1 @@
+ref: refs/heads/master
diff --git a/tests/resources/mailmap/.gitted/config b/tests/resources/mailmap/.gitted/config
new file mode 100644
index 000000000..515f48362
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/config
@@ -0,0 +1,5 @@
+[core]
+ repositoryformatversion = 0
+ filemode = true
+ bare = false
+ logallrefupdates = true
diff --git a/tests/resources/mailmap/.gitted/description b/tests/resources/mailmap/.gitted/description
new file mode 100644
index 000000000..498b267a8
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/description
@@ -0,0 +1 @@
+Unnamed repository; edit this file 'description' to name the repository.
diff --git a/tests/resources/mailmap/.gitted/index b/tests/resources/mailmap/.gitted/index
new file mode 100644
index 000000000..af175ca30
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/index
Binary files differ
diff --git a/tests/resources/mailmap/.gitted/info/exclude b/tests/resources/mailmap/.gitted/info/exclude
new file mode 100644
index 000000000..a5196d1be
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/info/exclude
@@ -0,0 +1,6 @@
+# git ls-files --others --exclude-from=.git/info/exclude
+# Lines that start with '#' are comments.
+# For a project mostly in C, the following would be a good set of
+# exclude patterns (uncomment them if you want to use them):
+# *.[oa]
+# *~
diff --git a/tests/resources/mailmap/.gitted/objects/00/1387531bed84262f137837125d4d998a9ba65d b/tests/resources/mailmap/.gitted/objects/00/1387531bed84262f137837125d4d998a9ba65d
new file mode 100644
index 000000000..1c564909a
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/00/1387531bed84262f137837125d4d998a9ba65d
Binary files differ
diff --git a/tests/resources/mailmap/.gitted/objects/02/7b2816ae0d7a08ba656d0417c09b4eac18cf00 b/tests/resources/mailmap/.gitted/objects/02/7b2816ae0d7a08ba656d0417c09b4eac18cf00
new file mode 100644
index 000000000..a4e8249af
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/02/7b2816ae0d7a08ba656d0417c09b4eac18cf00
Binary files differ
diff --git a/tests/resources/mailmap/.gitted/objects/09/20975110511365e56aec2263082d0c3d56d1fa b/tests/resources/mailmap/.gitted/objects/09/20975110511365e56aec2263082d0c3d56d1fa
new file mode 100644
index 000000000..49bceea46
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/09/20975110511365e56aec2263082d0c3d56d1fa
Binary files differ
diff --git a/tests/resources/mailmap/.gitted/objects/0c/d99501dfbec781a22ff7b84426b7bb308e709a b/tests/resources/mailmap/.gitted/objects/0c/d99501dfbec781a22ff7b84426b7bb308e709a
new file mode 100644
index 000000000..23149a4ee
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/0c/d99501dfbec781a22ff7b84426b7bb308e709a
Binary files differ
diff --git a/tests/resources/mailmap/.gitted/objects/1e/1212e7674820c17f7b8797aee7bf38ece0e838 b/tests/resources/mailmap/.gitted/objects/1e/1212e7674820c17f7b8797aee7bf38ece0e838
new file mode 100644
index 000000000..89a859807
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/1e/1212e7674820c17f7b8797aee7bf38ece0e838
@@ -0,0 +1,2 @@
+xu]
+0})f7iZ(;l#5zz |LDZ/@B:i8bc163,:h|BIKZ,49Ĕ}#rxeh~x{>`=YƊ*-:D뱢 Q^ohUEq߭3d>I \ No newline at end of file
diff --git a/tests/resources/mailmap/.gitted/objects/36/370b71f5aad1dd46bec5e14145280a843c9f49 b/tests/resources/mailmap/.gitted/objects/36/370b71f5aad1dd46bec5e14145280a843c9f49
new file mode 100644
index 000000000..5e8e3e596
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/36/370b71f5aad1dd46bec5e14145280a843c9f49
Binary files differ
diff --git a/tests/resources/mailmap/.gitted/objects/3a/1295dbc9234c0c5947c72803618c7112a01447 b/tests/resources/mailmap/.gitted/objects/3a/1295dbc9234c0c5947c72803618c7112a01447
new file mode 100644
index 000000000..347828cb6
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/3a/1295dbc9234c0c5947c72803618c7112a01447
@@ -0,0 +1,2 @@
+xmA
+0D]$m(";$??(-dV34*(V0.>H #TQEeNd+"t]j]P}hvl{g5$s]0P[yVRY?<0̋#,?s!5_ԏ$^H \ No newline at end of file
diff --git a/tests/resources/mailmap/.gitted/objects/3f/134546ae8fbe95a39dd20ea8c12b5fb0f48afb b/tests/resources/mailmap/.gitted/objects/3f/134546ae8fbe95a39dd20ea8c12b5fb0f48afb
new file mode 100644
index 000000000..489c6104d
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/3f/134546ae8fbe95a39dd20ea8c12b5fb0f48afb
@@ -0,0 +1,3 @@
+xmMn0) {lbGB(Teqcd\ zze^H<@s("6<{5G[t6PkqK
+mq(zg[K̶"Kv -; ʞ~FBﴼ 6
+vH)jX5iZёri3Zp֏iUeoO \ No newline at end of file
diff --git a/tests/resources/mailmap/.gitted/objects/43/179dc93939196f59b25387b5e44e9e8794f84c b/tests/resources/mailmap/.gitted/objects/43/179dc93939196f59b25387b5e44e9e8794f84c
new file mode 100644
index 000000000..2f3693aa6
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/43/179dc93939196f59b25387b5e44e9e8794f84c
@@ -0,0 +1,2 @@
+xmA
+0P9\4"ŵx1bHzzp?l aP6.'f-+ԕcU-:|ƋLCA<D:coc 7bYP5^¾ D듧 yK}xb_ˈA: \ No newline at end of file
diff --git a/tests/resources/mailmap/.gitted/objects/46/b5bb908c78b575cac9f9e6e42ff9ba3f769a46 b/tests/resources/mailmap/.gitted/objects/46/b5bb908c78b575cac9f9e6e42ff9ba3f769a46
new file mode 100644
index 000000000..62c9db041
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/46/b5bb908c78b575cac9f9e6e42ff9ba3f769a46
Binary files differ
diff --git a/tests/resources/mailmap/.gitted/objects/4b/4d2010ba256ef339c1d1854d20249da7478f01 b/tests/resources/mailmap/.gitted/objects/4b/4d2010ba256ef339c1d1854d20249da7478f01
new file mode 100644
index 000000000..169c7e7b4
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/4b/4d2010ba256ef339c1d1854d20249da7478f01
Binary files differ
diff --git a/tests/resources/mailmap/.gitted/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 b/tests/resources/mailmap/.gitted/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904
new file mode 100644
index 000000000..adf64119a
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904
Binary files differ
diff --git a/tests/resources/mailmap/.gitted/objects/4d/61d588546529ad27b2d77a3d6b05460ecb4be0 b/tests/resources/mailmap/.gitted/objects/4d/61d588546529ad27b2d77a3d6b05460ecb4be0
new file mode 100644
index 000000000..dabbf4ef3
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/4d/61d588546529ad27b2d77a3d6b05460ecb4be0
Binary files differ
diff --git a/tests/resources/mailmap/.gitted/objects/50/d69f4e64be2cff2cedde8f9b7f970257caf4dd b/tests/resources/mailmap/.gitted/objects/50/d69f4e64be2cff2cedde8f9b7f970257caf4dd
new file mode 100644
index 000000000..e6b337e1e
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/50/d69f4e64be2cff2cedde8f9b7f970257caf4dd
@@ -0,0 +1 @@
+xmMj0) HcBY+6e(Qt~>y m>&&ޓ=gOĞR Bֹ6Zy\&c%(-mp FJQ'8Eŷ2,%/ uS+8!4V7xiaVdϗLrU2k\z`KN \ No newline at end of file
diff --git a/tests/resources/mailmap/.gitted/objects/61/293f4c3d7500d227a755a7a8258e28e53449b2 b/tests/resources/mailmap/.gitted/objects/61/293f4c3d7500d227a755a7a8258e28e53449b2
new file mode 100644
index 000000000..409e6fd74
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/61/293f4c3d7500d227a755a7a8258e28e53449b2
Binary files differ
diff --git a/tests/resources/mailmap/.gitted/objects/62/7f0bd2f4fb5e949b79ba450d84676fa876b1c8 b/tests/resources/mailmap/.gitted/objects/62/7f0bd2f4fb5e949b79ba450d84676fa876b1c8
new file mode 100644
index 000000000..6009c30cd
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/62/7f0bd2f4fb5e949b79ba450d84676fa876b1c8
Binary files differ
diff --git a/tests/resources/mailmap/.gitted/objects/68/dfd5e5cb6138488680246d134f47ce559f4cf1 b/tests/resources/mailmap/.gitted/objects/68/dfd5e5cb6138488680246d134f47ce559f4cf1
new file mode 100644
index 000000000..ac5229f73
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/68/dfd5e5cb6138488680246d134f47ce559f4cf1
Binary files differ
diff --git a/tests/resources/mailmap/.gitted/objects/69/b9768d022706dab26e2af4dd5a13f42039e36f b/tests/resources/mailmap/.gitted/objects/69/b9768d022706dab26e2af4dd5a13f42039e36f
new file mode 100644
index 000000000..bda7a5d46
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/69/b9768d022706dab26e2af4dd5a13f42039e36f
Binary files differ
diff --git a/tests/resources/mailmap/.gitted/objects/6a/0fc44893d4867166f9d321f78c269b3e42b08b b/tests/resources/mailmap/.gitted/objects/6a/0fc44893d4867166f9d321f78c269b3e42b08b
new file mode 100644
index 000000000..9c7003111
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/6a/0fc44893d4867166f9d321f78c269b3e42b08b
Binary files differ
diff --git a/tests/resources/mailmap/.gitted/objects/6c/dec08ab9bfcd5a3d889f27bbed650317e3ec13 b/tests/resources/mailmap/.gitted/objects/6c/dec08ab9bfcd5a3d889f27bbed650317e3ec13
new file mode 100644
index 000000000..856ba31f0
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/6c/dec08ab9bfcd5a3d889f27bbed650317e3ec13
Binary files differ
diff --git a/tests/resources/mailmap/.gitted/objects/71/00e631fb4d5deba31fdc8acc98f4fb5c1573fd b/tests/resources/mailmap/.gitted/objects/71/00e631fb4d5deba31fdc8acc98f4fb5c1573fd
new file mode 100644
index 000000000..3b20e6df2
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/71/00e631fb4d5deba31fdc8acc98f4fb5c1573fd
Binary files differ
diff --git a/tests/resources/mailmap/.gitted/objects/7e/cbb98d860b304f622b38ce9ab8f08d14d981a8 b/tests/resources/mailmap/.gitted/objects/7e/cbb98d860b304f622b38ce9ab8f08d14d981a8
new file mode 100644
index 000000000..53e775ee4
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/7e/cbb98d860b304f622b38ce9ab8f08d14d981a8
Binary files differ
diff --git a/tests/resources/mailmap/.gitted/objects/7e/e7b9a4a2a1eda925f6260338c063d8211d5ad5 b/tests/resources/mailmap/.gitted/objects/7e/e7b9a4a2a1eda925f6260338c063d8211d5ad5
new file mode 100644
index 000000000..0d4e94b29
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/7e/e7b9a4a2a1eda925f6260338c063d8211d5ad5
@@ -0,0 +1,2 @@
+x
+0D=+z* =~AFMMA޴m'sag+ XgEB[o$dtF;0(d=wb\R8k̫('8-Xޚk: 9ʋGm r</ ]hHS?9.p o3KљQ'" \ No newline at end of file
diff --git a/tests/resources/mailmap/.gitted/objects/83/714a9223f3e072b85f0d4301cd2081fff3acf2 b/tests/resources/mailmap/.gitted/objects/83/714a9223f3e072b85f0d4301cd2081fff3acf2
new file mode 100644
index 000000000..a50f87e48
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/83/714a9223f3e072b85f0d4301cd2081fff3acf2
Binary files differ
diff --git a/tests/resources/mailmap/.gitted/objects/87/ce8d4920a30ddb9547334e7c65806518863ff1 b/tests/resources/mailmap/.gitted/objects/87/ce8d4920a30ddb9547334e7c65806518863ff1
new file mode 100644
index 000000000..b8c480805
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/87/ce8d4920a30ddb9547334e7c65806518863ff1
@@ -0,0 +1,2 @@
+x}NKjC1 ڧd?=[PݖAe^KRt5f)0 >n1ZCeʚ
+XbM8E݇t; HVT3WR!Ų(7fN>rH_ _^'3e !nXûܾl]awXl}=GW=MV \ No newline at end of file
diff --git a/tests/resources/mailmap/.gitted/objects/8c/f0547fcb649b44ebaf39b8104982bb0abb4e69 b/tests/resources/mailmap/.gitted/objects/8c/f0547fcb649b44ebaf39b8104982bb0abb4e69
new file mode 100644
index 000000000..402a48e79
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/8c/f0547fcb649b44ebaf39b8104982bb0abb4e69
Binary files differ
diff --git a/tests/resources/mailmap/.gitted/objects/94/7ff75c33ac7941a32fe9900118b6ba85ab2be9 b/tests/resources/mailmap/.gitted/objects/94/7ff75c33ac7941a32fe9900118b6ba85ab2be9
new file mode 100644
index 000000000..8b23320fd
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/94/7ff75c33ac7941a32fe9900118b6ba85ab2be9
Binary files differ
diff --git a/tests/resources/mailmap/.gitted/objects/95/d03c49d94de67d5a05553a1bb22e78f7cdf5ca b/tests/resources/mailmap/.gitted/objects/95/d03c49d94de67d5a05553a1bb22e78f7cdf5ca
new file mode 100644
index 000000000..cd91a3f8c
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/95/d03c49d94de67d5a05553a1bb22e78f7cdf5ca
@@ -0,0 +1 @@
+xmKn0 D)x$R`h@tcğ@Qo7۲L/B Ad;s7I؏2.Vh1p$^fYHъ2t#[=m)ry[.>%`ia;Vtfǯ3kSC=CxWs|L \ No newline at end of file
diff --git a/tests/resources/mailmap/.gitted/objects/96/78a4325710507f7bf598a0fde5ebbd88148614 b/tests/resources/mailmap/.gitted/objects/96/78a4325710507f7bf598a0fde5ebbd88148614
new file mode 100644
index 000000000..887436602
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/96/78a4325710507f7bf598a0fde5ebbd88148614
Binary files differ
diff --git a/tests/resources/mailmap/.gitted/objects/a1/6db1cbb8817dddcf199c12d3c81221cf8eefc4 b/tests/resources/mailmap/.gitted/objects/a1/6db1cbb8817dddcf199c12d3c81221cf8eefc4
new file mode 100644
index 000000000..d23d8cc5f
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/a1/6db1cbb8817dddcf199c12d3c81221cf8eefc4
@@ -0,0 +1 @@
+x+)JMU06c040031QHI+(aUإV_+ \ No newline at end of file
diff --git a/tests/resources/mailmap/.gitted/objects/a7/054a4b356b3ecdec60cee66e50beaa5b863755 b/tests/resources/mailmap/.gitted/objects/a7/054a4b356b3ecdec60cee66e50beaa5b863755
new file mode 100644
index 000000000..06a3abc4f
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/a7/054a4b356b3ecdec60cee66e50beaa5b863755
@@ -0,0 +1,3 @@
+xmNKj0Z 4I`]lz44&[Jٽ/e
+G]E$|bIH]. 1!ՍW+&]I9jc3f^4G
+iF+eYaKe8' `|ETlǪp qnn_vh7uL_{zPG \ No newline at end of file
diff --git a/tests/resources/mailmap/.gitted/objects/a7/eb40274887baeb01a958ead80d106b5977312c b/tests/resources/mailmap/.gitted/objects/a7/eb40274887baeb01a958ead80d106b5977312c
new file mode 100644
index 000000000..39f70c203
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/a7/eb40274887baeb01a958ead80d106b5977312c
Binary files differ
diff --git a/tests/resources/mailmap/.gitted/objects/c9/e5462de8ec453e94d85f26f64b80ea76fda6d4 b/tests/resources/mailmap/.gitted/objects/c9/e5462de8ec453e94d85f26f64b80ea76fda6d4
new file mode 100644
index 000000000..dbf952372
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/c9/e5462de8ec453e94d85f26f64b80ea76fda6d4
Binary files differ
diff --git a/tests/resources/mailmap/.gitted/objects/d3/e5e624cc7bfb09ac1960ebb6c458021b098f87 b/tests/resources/mailmap/.gitted/objects/d3/e5e624cc7bfb09ac1960ebb6c458021b098f87
new file mode 100644
index 000000000..c69ebe842
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/d3/e5e624cc7bfb09ac1960ebb6c458021b098f87
Binary files differ
diff --git a/tests/resources/mailmap/.gitted/objects/f6/3578091d884c3066a003c50eb6c85ae7542269 b/tests/resources/mailmap/.gitted/objects/f6/3578091d884c3066a003c50eb6c85ae7542269
new file mode 100644
index 000000000..16fd91867
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/f6/3578091d884c3066a003c50eb6c85ae7542269
@@ -0,0 +1,2 @@
+x[j0EUB_2ҌmE-$;߹.\u`z8`dm)YK32x(S`t$ρ%ю#<K
+لVӧk|%m_>/\3`!‡Z]޼+3+,}ZL{ \ No newline at end of file
diff --git a/tests/resources/mailmap/.gitted/objects/fe/dd34e8baffdb2acfe9a6860bf339287ca942bc b/tests/resources/mailmap/.gitted/objects/fe/dd34e8baffdb2acfe9a6860bf339287ca942bc
new file mode 100644
index 000000000..a13b83df8
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/fe/dd34e8baffdb2acfe9a6860bf339287ca942bc
Binary files differ
diff --git a/tests/resources/mailmap/.gitted/objects/fe/ef8f2135df4835496e4d576b1f1bd23510e1c5 b/tests/resources/mailmap/.gitted/objects/fe/ef8f2135df4835496e4d576b1f1bd23510e1c5
new file mode 100644
index 000000000..31f979bc1
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/objects/fe/ef8f2135df4835496e4d576b1f1bd23510e1c5
@@ -0,0 +1 @@
+xmK1]u%J 22/#7(4 ,`2x-QR) -+Thu#Aیi᱀U똳7 >^j#eLIЭti幃}}8 3jeCVYΗ=:j%]Ŀ,pK \ No newline at end of file
diff --git a/tests/resources/mailmap/.gitted/refs/heads/master b/tests/resources/mailmap/.gitted/refs/heads/master
new file mode 100644
index 000000000..b6dd3087a
--- /dev/null
+++ b/tests/resources/mailmap/.gitted/refs/heads/master
@@ -0,0 +1 @@
+f63578091d884c3066a003c50eb6c85ae7542269
diff --git a/tests/resources/mailmap/.mailmap b/tests/resources/mailmap/.mailmap
new file mode 100644
index 000000000..7da2ed605
--- /dev/null
+++ b/tests/resources/mailmap/.mailmap
@@ -0,0 +1,9 @@
+# Simple Comment line
+<cto@company.xx> <cto@coompany.xx>
+Some Dude <some@dude.xx> nick1 <bugs@company.xx>
+Other Author <other@author.xx> nick2 <bugs@company.xx>
+Other Author <other@author.xx> <nick2@company.xx>
+Phil Hill <phil@company.xx> # Comment at end of line
+<joseph@company.xx> Joseph <bugs@company.xx>
+Santa Claus <santa.claus@northpole.xx> <me@company.xx>
+Untracked <untracked@company.xx>
diff --git a/tests/resources/mailmap/file.txt b/tests/resources/mailmap/file.txt
new file mode 100644
index 000000000..68dfd5e5c
--- /dev/null
+++ b/tests/resources/mailmap/file.txt
@@ -0,0 +1,10 @@
+Added by Brad <cto@coompany.xx>
+Added by Brad L. <cto@coompany.xx>
+Added by nick1 <bugs@company.xx>
+Added by nick2 <bugs@company.xx>
+Added by nick3 <bugs@company.xx>
+Added by Some Garbage <nick2@company.xx>
+Added by unknown <phil@company.xx>
+Added by Joseph <bugs@company.xx>
+Added by Clause <me@company.xx>
+Added by Charles <charles@charles.xx>
diff --git a/tests/resources/mailmap/file_override b/tests/resources/mailmap/file_override
new file mode 100644
index 000000000..94293a971
--- /dev/null
+++ b/tests/resources/mailmap/file_override
@@ -0,0 +1,2 @@
+File Override <phil@company.xx>
+Other Name <fileoverridename@company.xx>