Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
49620359
Commit
49620359
authored
Mar 17, 2018
by
Nika Layzell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mailmap: Clean up mailmap parser, and finish API
parent
7a169390
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
103 additions
and
16 deletions
+103
-16
include/git2/mailmap.h
+103
-16
src/mailmap.c
+0
-0
No files found.
include/git2/mailmap.h
View file @
49620359
...
...
@@ -4,16 +4,16 @@
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#ifndef INCLUDE_mailmap_h__
#define INCLUDE_mailmap_h__
#ifndef INCLUDE_
git_
mailmap_h__
#define INCLUDE_
git_
mailmap_h__
#include "common.h"
#include "
repository
.h"
#include "
tree
.h"
/**
* @file git2/mailmap.h
* @brief Mailmap
access subroutines.
* @defgroup git_
rebase Git merge
routines
* @brief Mailmap
parsing routines
* @defgroup git_
mailmap Git mailmap
routines
* @ingroup Git
* @{
*/
...
...
@@ -21,19 +21,106 @@ GIT_BEGIN_DECL
typedef
struct
git_mailmap
git_mailmap
;
struct
git_mailmap_entry
{
const
char
*
name
;
const
char
*
email
;
};
/**
* A single entry parsed from a mailmap.
*/
typedef
struct
git_mailmap_entry
{
const
char
*
real_name
;
/**< the real name (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_email
;
/**< the email to replace */
}
git_mailmap_entry
;
/**
* Create a mailmap object by parsing a mailmap file.
*
* The mailmap must be freed with 'git_mailmap_free'.
*
* @param out Pointer to store the mailmap
* @param data raw data buffer to parse
* @param size size of the raw data buffer
* @return 0 on success
*/
GIT_EXTERN
(
int
)
git_mailmap_parse
(
git_mailmap
**
out
,
const
char
*
data
,
size_t
size
);
/**
* Create a mailmap object by parsing the ".mailmap" file in the tree root.
*
* The mailmap must be freed with 'git_mailmap_free'.
*
* @param out pointer to store the mailmap
* @param treeish root object that can be peeled to a tree
* @return 0 on success; GIT_ENOTFOUND if .mailmap does not exist.
*/
GIT_EXTERN
(
int
)
git_mailmap_from_tree
(
git_mailmap
**
out
,
const
git_object
*
treeish
);
GIT_EXTERN
(
int
)
git_mailmap_create
(
git_mailmap
**
,
git_repository
*
);
GIT_EXTERN
(
void
)
git_mailmap_free
(
git_mailmap
*
);
GIT_EXTERN
(
struct
git_mailmap_entry
)
git_mailmap_lookup
(
git_mailmap
*
map
,
const
char
*
name
,
const
char
*
email
);
/**
* Create a mailmap object by parsing the ".mailmap" file in the repository's
* HEAD's tree root.
*
* The mailmap must be freed with 'git_mailmap_free'.
*
* @param out pointer to store the mailmap
* @param repo repository to find the .mailmap in
* @return 0 on success; GIT_ENOTFOUND if .mailmap does not exist.
*/
GIT_EXTERN
(
int
)
git_mailmap_from_repo
(
git_mailmap
**
out
,
git_repository
*
repo
);
/**
* Free a mailmap created by 'git_mailmap_parse', 'git_mailmap_from_tree' or
* 'git_mailmap_from_repo'.
*/
GIT_EXTERN
(
void
)
git_mailmap_free
(
git_mailmap
*
mailmap
);
/**
* Resolve a name and email to the corresponding real name and email.
*
* @param name_out either 'name', or the real name to use.
* You should NOT free this value.
* @param email_out either 'email' or the real email to use,
* You should NOT free this value.
* @param mailmap the mailmap to perform the lookup in.
* @param name the name to resolve.
* @param email the email to resolve.
*/
GIT_EXTERN
(
void
)
git_mailmap_resolve
(
const
char
**
name_out
,
const
char
**
email_out
,
git_mailmap
*
mailmap
,
const
char
*
name
,
const
char
*
email
);
/**
* Get the number of mailmap entries.
*/
GIT_EXTERN
(
size_t
)
git_mailmap_entry_count
(
git_mailmap
*
mailmap
);
/**
* Lookup a mailmap entry by index.
*
* Do not free the mailmap entry, it is owned by the mailmap.
*/
GIT_EXTERN
(
git_mailmap_entry
*
)
git_mailmap_entry_byindex
(
git_mailmap
*
mailmap
,
size_t
idx
);
/**
* Lookup a mailmap entry by name/email pair.
*
* Do not free the mailmap entry, it is owned by the mailmap.
*/
GIT_EXTERN
(
git_mailmap_entry
*
)
git_mailmap_entry_lookup
(
git_mailmap
*
mailmap
,
const
char
*
name
,
const
char
*
email
);
/** @} */
GIT_END_DECL
#endif
src/mailmap.c
View file @
49620359
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment