Commit 4ff44be8 by Nika Layzell

mailmap: Fix more bugs which snuck in when I rebased

parent 983b8c2d
...@@ -22,14 +22,14 @@ GIT_BEGIN_DECL ...@@ -22,14 +22,14 @@ GIT_BEGIN_DECL
/** /**
* A single entry parsed from a mailmap. * A single entry parsed from a mailmap.
*/ */
struct git_mailmap_entry { typedef struct git_mailmap_entry {
unsigned int version; unsigned int version;
const char *real_name; /**< the real name (may be NULL) */ const char *real_name; /**< the real name (may be NULL) */
const char *real_email; /**< the real email (may be NULL) */ const char *real_email; /**< the real email (may be NULL) */
const char *replace_name; /**< the name to replace (may be NULL) */ const char *replace_name; /**< the name to replace (may be NULL) */
const char *replace_email; /**< the email to replace */ const char *replace_email; /**< the email to replace */
}; } git_mailmap_entry;
#define GIT_MAILMAP_ENTRY_VERSION 1 #define GIT_MAILMAP_ENTRY_VERSION 1
#define GIT_MAILMAP_ENTRY_INIT {GIT_MAILMAP_ENTRY_VERSION} #define GIT_MAILMAP_ENTRY_INIT {GIT_MAILMAP_ENTRY_VERSION}
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "git2/diff.h" #include "git2/diff.h"
#include "git2/blob.h" #include "git2/blob.h"
#include "git2/signature.h" #include "git2/signature.h"
#include "git2/mailmap.h"
#include "util.h" #include "util.h"
#include "repository.h" #include "repository.h"
#include "blame_git.h" #include "blame_git.h"
......
...@@ -215,7 +215,7 @@ int git_mailmap_parse( ...@@ -215,7 +215,7 @@ int git_mailmap_parse(
cleanup: cleanup:
git__free(entry); git__free(entry);
if (error < 0) if (error < 0) {
git_mailmap_free(*mailmap); git_mailmap_free(*mailmap);
*mailmap = NULL; *mailmap = NULL;
} }
...@@ -317,7 +317,7 @@ static int git_mailmap_from_bare_repo( ...@@ -317,7 +317,7 @@ static int git_mailmap_from_bare_repo(
error = git_object_lookup_bypath( error = git_object_lookup_bypath(
(git_object **) &blob, (git_object **) &blob,
treeish, tree,
".mailmap", ".mailmap",
GIT_OBJ_BLOB); GIT_OBJ_BLOB);
if (error < 0) if (error < 0)
......
...@@ -15,7 +15,7 @@ const char TEST_MAILMAP[] = ...@@ -15,7 +15,7 @@ const char TEST_MAILMAP[] =
void test_mailmap_basic__initialize(void) void test_mailmap_basic__initialize(void)
{ {
cl_git_pass(git_mailmap_parse(&mailmap, TEST_MAILMAP, sizeof(TEST_MAILMAP))); cl_git_pass(git_mailmap_parse(&mailmap, TEST_MAILMAP, sizeof(TEST_MAILMAP) - 1));
} }
void test_mailmap_basic__cleanup(void) void test_mailmap_basic__cleanup(void)
...@@ -28,7 +28,7 @@ void test_mailmap_basic__cleanup(void) ...@@ -28,7 +28,7 @@ void test_mailmap_basic__cleanup(void)
void test_mailmap_basic__entry(void) void test_mailmap_basic__entry(void)
{ {
git_mailmap_entry* entry; const git_mailmap_entry* entry;
cl_assert(git_mailmap_entry_count(mailmap) == 4); cl_assert(git_mailmap_entry_count(mailmap) == 4);
...@@ -43,7 +43,7 @@ void test_mailmap_basic__entry(void) ...@@ -43,7 +43,7 @@ void test_mailmap_basic__entry(void)
void test_mailmap_basic__lookup_not_found(void) void test_mailmap_basic__lookup_not_found(void)
{ {
git_mailmap_entry* entry = git_mailmap_entry_lookup( const git_mailmap_entry* entry = git_mailmap_entry_lookup(
mailmap, mailmap,
"Whoever", "Whoever",
"doesnotexist@fo.com"); "doesnotexist@fo.com");
...@@ -52,7 +52,7 @@ void test_mailmap_basic__lookup_not_found(void) ...@@ -52,7 +52,7 @@ void test_mailmap_basic__lookup_not_found(void)
void test_mailmap_basic__lookup(void) void test_mailmap_basic__lookup(void)
{ {
git_mailmap_entry* entry = git_mailmap_entry_lookup( const git_mailmap_entry* entry = git_mailmap_entry_lookup(
mailmap, mailmap,
"Typoed the name once", "Typoed the name once",
"foo@baz.com"); "foo@baz.com");
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
static git_repository *g_repo; static git_repository *g_repo;
static git_blame *g_blame; static git_blame *g_blame;
static git_mailmap *g_mailmap;
void test_mailmap_blame__initialize(void) void test_mailmap_blame__initialize(void)
{ {
......
...@@ -24,7 +24,7 @@ void test_mailmap_parsing__cleanup(void) ...@@ -24,7 +24,7 @@ void test_mailmap_parsing__cleanup(void)
static void check_mailmap_entries( static void check_mailmap_entries(
const git_mailmap *mailmap, const mailmap_entry *entries, size_t entries_size) const git_mailmap *mailmap, const mailmap_entry *entries, size_t entries_size)
{ {
const mailmap_entry *parsed = NULL; const git_mailmap_entry *parsed = NULL;
size_t idx = 0; size_t idx = 0;
/* Check that the parsed entries match */ /* Check that the parsed entries match */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment