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
d27a441d
Commit
d27a441d
authored
Sep 30, 2013
by
nulltoken
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit: Trim message leading newlines
Fix libgit2/libgit2sharp#522
parent
27c8eb2a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
4 deletions
+19
-4
src/commit.c
+1
-1
tests-clar/commit/parse.c
+18
-3
No files found.
src/commit.c
View file @
d27a441d
...
...
@@ -240,7 +240,7 @@ int git_commit__parse(void *_commit, git_odb_object *odb_obj)
buffer_end
=
buffer
+
git_odb_object_size
(
odb_obj
);
buffer
+=
header_len
;
if
(
*
buffer
==
'\n'
)
while
(
buffer
<
buffer_end
&&
*
buffer
==
'\n'
)
++
buffer
;
/* extract commit message */
...
...
tests-clar/commit/parse.c
View file @
d27a441d
...
...
@@ -349,7 +349,6 @@ void test_commit_parse__details0(void) {
cl_assert_equal_s
(
"Scott Chacon"
,
committer
->
name
);
cl_assert_equal_s
(
"schacon@gmail.com"
,
committer
->
email
);
cl_assert
(
message
!=
NULL
);
cl_assert
(
strchr
(
message
,
'\n'
)
!=
NULL
);
cl_assert
(
commit_time
>
0
);
cl_assert
(
parents
<=
2
);
for
(
p
=
0
;
p
<
parents
;
p
++
)
{
...
...
@@ -382,9 +381,25 @@ committer Vicent Marti <tanoku@gmail.com> 1273848544 +0200\n\
\n
\
This commit has a few LF at the start of the commit message"
;
const
char
*
message
=
"
\n
\
"This commit has a few LF at the start of the commit message"
;
cl_git_pass
(
parse_commit
(
&
commit
,
buffer
));
cl_assert_equal_s
(
message
,
git_commit_message
(
commit
));
git_commit__free
(
commit
);
}
void
test_commit_parse__only_lf
(
void
)
{
git_commit
*
commit
;
const
char
*
buffer
=
"tree 1810dff58d8a660512d4832e740f692884338ccd
\n
\
parent e90810b8df3e80c413d903f631643c716887138d
\n
\
author Vicent Marti <tanoku@gmail.com> 1273848544 +0200
\n
\
committer Vicent Marti <tanoku@gmail.com> 1273848544 +0200
\n
\
\n
\
This commit has a few LF at the start of the commit message"
;
\n
\
\n
"
;
const
char
*
message
=
""
;
cl_git_pass
(
parse_commit
(
&
commit
,
buffer
));
cl_assert_equal_s
(
message
,
git_commit_message
(
commit
));
...
...
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