1 /*
2  * Copyright (C) the libgit2 contributors. All rights reserved.
3  *
4  * This file is part of libgit2, distributed under the GNU GPL v2 with
5  * a Linking Exception. For full terms see the included COPYING file.
6  */
7 #ifndef INCLUDE_mailmap_h__
8 #define INCLUDE_mailmap_h__
9 
10 #include "git2/mailmap.h"
11 #include "vector.h"
12 
13 /*
14  * A mailmap is stored as a sorted vector of 'git_mailmap_entry's. These entries
15  * are sorted first by 'replace_email', and then by 'replace_name'. NULL
16  * replace_names are ordered first.
17  *
18  * Looking up a name and email in the mailmap is done with a binary search.
19  */
20 struct git_mailmap {
21 	git_vector entries;
22 };
23 
24 /* Single entry parsed from a mailmap */
25 typedef struct git_mailmap_entry {
26 	char *real_name; /**< the real name (may be NULL) */
27 	char *real_email; /**< the real email (may be NULL) */
28 	char *replace_name; /**< the name to replace (may be NULL) */
29 	char *replace_email; /**< the email to replace */
30 } git_mailmap_entry;
31 
32 const git_mailmap_entry *git_mailmap_entry_lookup(
33 	const git_mailmap *mm, const char *name, const char *email);
34 
35 #endif
36