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
5f83758f
Commit
5f83758f
authored
Jun 16, 2015
by
Edward Thomson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3209 from libgit2/cmn/double-author
commit: ignore multiple author fields
parents
86faea5f
65d69fe8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
src/commit.c
+10
-0
tests/commit/parse.c
+7
-0
No files found.
src/commit.c
View file @
5f83758f
...
@@ -309,6 +309,7 @@ int git_commit__parse(void *_commit, git_odb_object *odb_obj)
...
@@ -309,6 +309,7 @@ int git_commit__parse(void *_commit, git_odb_object *odb_obj)
const
char
*
buffer_end
=
buffer_start
+
git_odb_object_size
(
odb_obj
);
const
char
*
buffer_end
=
buffer_start
+
git_odb_object_size
(
odb_obj
);
git_oid
parent_id
;
git_oid
parent_id
;
size_t
header_len
;
size_t
header_len
;
git_signature
dummy_sig
;
buffer
=
buffer_start
;
buffer
=
buffer_start
;
...
@@ -337,6 +338,15 @@ int git_commit__parse(void *_commit, git_odb_object *odb_obj)
...
@@ -337,6 +338,15 @@ int git_commit__parse(void *_commit, git_odb_object *odb_obj)
if
(
git_signature__parse
(
commit
->
author
,
&
buffer
,
buffer_end
,
"author "
,
'\n'
)
<
0
)
if
(
git_signature__parse
(
commit
->
author
,
&
buffer
,
buffer_end
,
"author "
,
'\n'
)
<
0
)
return
-
1
;
return
-
1
;
/* Some tools create multiple author fields, ignore the extra ones */
while
((
size_t
)(
buffer_end
-
buffer
)
>=
strlen
(
"author "
)
&&
!
git__prefixcmp
(
buffer
,
"author "
))
{
if
(
git_signature__parse
(
&
dummy_sig
,
&
buffer
,
buffer_end
,
"author "
,
'\n'
)
<
0
)
return
-
1
;
git__free
(
dummy_sig
.
name
);
git__free
(
dummy_sig
.
email
);
}
/* Always parse the committer; we need the commit time */
/* Always parse the committer; we need the commit time */
commit
->
committer
=
git__malloc
(
sizeof
(
git_signature
));
commit
->
committer
=
git__malloc
(
sizeof
(
git_signature
));
GITERR_CHECK_ALLOC
(
commit
->
committer
);
GITERR_CHECK_ALLOC
(
commit
->
committer
);
...
...
tests/commit/parse.c
View file @
5f83758f
...
@@ -262,6 +262,13 @@ gpgsig -----BEGIN PGP SIGNATURE-----\n\
...
@@ -262,6 +262,13 @@ gpgsig -----BEGIN PGP SIGNATURE-----\n\
-----END PGP SIGNATURE-----
\n
\
-----END PGP SIGNATURE-----
\n
\
\n
\
\n
\
a simple commit which works
\n
"
,
a simple commit which works
\n
"
,
/* some tools create two author entries */
"tree 1810dff58d8a660512d4832e740f692884338ccd
\n
\
author Vicent Marti <tanoku@gmail.com> 1273848544 +0200
\n
\
author Helpful Coworker <helpful@coworker> 1273848544 +0200
\n
\
committer Vicent Marti <tanoku@gmail.com> 1273848544 +0200
\n
\
\n
\
a simple commit which works"
,
};
};
static
int
parse_commit
(
git_commit
**
out
,
const
char
*
buffer
)
static
int
parse_commit
(
git_commit
**
out
,
const
char
*
buffer
)
...
...
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