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
23e38fd3
Commit
23e38fd3
authored
Apr 05, 2020
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mailmap: use GIT_ASSERT
parent
79b0c8c8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
10 deletions
+19
-10
src/mailmap.c
+19
-10
No files found.
src/mailmap.c
View file @
23e38fd3
...
...
@@ -43,7 +43,8 @@ static int mailmap_entry_cmp(const void *a_raw, const void *b_raw)
const
git_mailmap_entry
*
b
=
(
const
git_mailmap_entry
*
)
b_raw
;
int
cmp
;
assert
(
a
&&
b
&&
a
->
replace_email
&&
b
->
replace_email
);
GIT_ASSERT_ARG
(
a
&&
a
->
replace_email
);
GIT_ASSERT_ARG
(
b
&&
b
->
replace_email
);
cmp
=
git__strcmp
(
a
->
replace_email
,
b
->
replace_email
);
if
(
cmp
)
...
...
@@ -185,7 +186,8 @@ static int mailmap_add_entry_unterminated(
git_mailmap_entry
*
entry
=
git__calloc
(
1
,
sizeof
(
git_mailmap_entry
));
GIT_ERROR_CHECK_ALLOC
(
entry
);
assert
(
mm
&&
replace_email
&&
*
replace_email
);
GIT_ASSERT_ARG
(
mm
);
GIT_ASSERT_ARG
(
replace_email
&&
*
replace_email
);
if
(
real_name_size
>
0
)
{
entry
->
real_name
=
git__substrdup
(
real_name
,
real_name_size
);
...
...
@@ -290,7 +292,8 @@ static int mailmap_add_blob(
git_buf
content
=
GIT_BUF_INIT
;
int
error
;
assert
(
mm
&&
repo
);
GIT_ASSERT_ARG
(
mm
);
GIT_ASSERT_ARG
(
repo
);
error
=
git_revparse_single
(
&
object
,
repo
,
rev
);
if
(
error
<
0
)
...
...
@@ -350,8 +353,6 @@ static void mailmap_add_from_repository(git_mailmap *mm, git_repository *repo)
const
char
*
rev
=
NULL
;
const
char
*
path
=
NULL
;
assert
(
mm
&&
repo
);
/* If we're in a bare repo, default blob to 'HEAD:.mailmap' */
if
(
repo
->
is_bare
)
rev
=
MM_BLOB_DEFAULT
;
...
...
@@ -389,9 +390,14 @@ static void mailmap_add_from_repository(git_mailmap *mm, git_repository *repo)
int
git_mailmap_from_repository
(
git_mailmap
**
out
,
git_repository
*
repo
)
{
int
error
=
git_mailmap_new
(
out
);
if
(
error
<
0
)
int
error
;
GIT_ASSERT_ARG
(
out
);
GIT_ASSERT_ARG
(
repo
);
if
((
error
=
git_mailmap_new
(
out
))
<
0
)
return
error
;
mailmap_add_from_repository
(
*
out
,
repo
);
return
0
;
}
...
...
@@ -408,7 +414,7 @@ const git_mailmap_entry *git_mailmap_entry_lookup(
git_mailmap_entry
needle
=
{
NULL
};
needle
.
replace_email
=
(
char
*
)
email
;
assert
(
email
);
GIT_ASSERT_ARG_WITH_RETVAL
(
email
,
NULL
);
if
(
!
mm
)
return
NULL
;
...
...
@@ -431,7 +437,8 @@ const git_mailmap_entry *git_mailmap_entry_lookup(
if
(
git__strcmp
(
entry
->
replace_email
,
email
))
break
;
/* it's a different email, so we're done looking */
assert
(
entry
->
replace_name
);
/* should be specific */
/* should be specific */
GIT_ASSERT_WITH_RETVAL
(
entry
->
replace_name
,
NULL
);
if
(
!
name
||
!
git__strcmp
(
entry
->
replace_name
,
name
))
return
entry
;
}
...
...
@@ -447,7 +454,9 @@ int git_mailmap_resolve(
const
char
*
name
,
const
char
*
email
)
{
const
git_mailmap_entry
*
entry
=
NULL
;
assert
(
name
&&
email
);
GIT_ASSERT
(
name
);
GIT_ASSERT
(
email
);
*
real_name
=
name
;
*
real_email
=
email
;
...
...
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