Skip to content

Commit 4ff44be

Browse files
committed
mailmap: Fix more bugs which snuck in when I rebased
1 parent 983b8c2 commit 4ff44be

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

include/git2/mailmap.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ GIT_BEGIN_DECL
2222
/**
2323
* A single entry parsed from a mailmap.
2424
*/
25-
struct git_mailmap_entry {
25+
typedef struct git_mailmap_entry {
2626
unsigned int version;
2727

2828
const char *real_name; /**< the real name (may be NULL) */
2929
const char *real_email; /**< the real email (may be NULL) */
3030
const char *replace_name; /**< the name to replace (may be NULL) */
3131
const char *replace_email; /**< the email to replace */
32-
};
32+
} git_mailmap_entry;
3333

3434
#define GIT_MAILMAP_ENTRY_VERSION 1
3535
#define GIT_MAILMAP_ENTRY_INIT {GIT_MAILMAP_ENTRY_VERSION}

src/blame.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "git2/diff.h"
1515
#include "git2/blob.h"
1616
#include "git2/signature.h"
17+
#include "git2/mailmap.h"
1718
#include "util.h"
1819
#include "repository.h"
1920
#include "blame_git.h"

src/mailmap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ int git_mailmap_parse(
215215

216216
cleanup:
217217
git__free(entry);
218-
if (error < 0)
218+
if (error < 0) {
219219
git_mailmap_free(*mailmap);
220220
*mailmap = NULL;
221221
}
@@ -317,7 +317,7 @@ static int git_mailmap_from_bare_repo(
317317

318318
error = git_object_lookup_bypath(
319319
(git_object **) &blob,
320-
treeish,
320+
tree,
321321
".mailmap",
322322
GIT_OBJ_BLOB);
323323
if (error < 0)

tests/mailmap/basic.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const char TEST_MAILMAP[] =
1515

1616
void test_mailmap_basic__initialize(void)
1717
{
18-
cl_git_pass(git_mailmap_parse(&mailmap, TEST_MAILMAP, sizeof(TEST_MAILMAP)));
18+
cl_git_pass(git_mailmap_parse(&mailmap, TEST_MAILMAP, sizeof(TEST_MAILMAP) - 1));
1919
}
2020

2121
void test_mailmap_basic__cleanup(void)
@@ -28,7 +28,7 @@ void test_mailmap_basic__cleanup(void)
2828

2929
void test_mailmap_basic__entry(void)
3030
{
31-
git_mailmap_entry* entry;
31+
const git_mailmap_entry* entry;
3232

3333
cl_assert(git_mailmap_entry_count(mailmap) == 4);
3434

@@ -43,7 +43,7 @@ void test_mailmap_basic__entry(void)
4343

4444
void test_mailmap_basic__lookup_not_found(void)
4545
{
46-
git_mailmap_entry* entry = git_mailmap_entry_lookup(
46+
const git_mailmap_entry* entry = git_mailmap_entry_lookup(
4747
mailmap,
4848
"Whoever",
4949
"doesnotexist@fo.com");
@@ -52,7 +52,7 @@ void test_mailmap_basic__lookup_not_found(void)
5252

5353
void test_mailmap_basic__lookup(void)
5454
{
55-
git_mailmap_entry* entry = git_mailmap_entry_lookup(
55+
const git_mailmap_entry* entry = git_mailmap_entry_lookup(
5656
mailmap,
5757
"Typoed the name once",
5858
"foo@baz.com");

tests/mailmap/blame.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
static git_repository *g_repo;
88
static git_blame *g_blame;
9-
static git_mailmap *g_mailmap;
109

1110
void test_mailmap_blame__initialize(void)
1211
{

tests/mailmap/parsing.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void test_mailmap_parsing__cleanup(void)
2424
static void check_mailmap_entries(
2525
const git_mailmap *mailmap, const mailmap_entry *entries, size_t entries_size)
2626
{
27-
const mailmap_entry *parsed = NULL;
27+
const git_mailmap_entry *parsed = NULL;
2828
size_t idx = 0;
2929

3030
/* Check that the parsed entries match */

0 commit comments

Comments
 (0)