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
4e1543ff
Commit
4e1543ff
authored
Jun 08, 2011
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #250 from pegonma/commit_short_message
Commit short message should be the same as git's
parents
ae496955
858ef372
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
src/commit.c
+11
-4
No files found.
src/commit.c
View file @
4e1543ff
...
...
@@ -292,6 +292,7 @@ int commit_parse_buffer(git_commit *commit, const void *data, size_t len)
if
(
buffer
<
buffer_end
)
{
const
char
*
line_end
;
unsigned
int
i
;
size_t
message_len
;
/* Long message */
...
...
@@ -301,12 +302,18 @@ int commit_parse_buffer(git_commit *commit, const void *data, size_t len)
commit
->
message
[
message_len
]
=
0
;
/* Short message */
if
((
line_end
=
memchr
(
buffer
,
'\n'
,
buffer_end
-
buffer
))
==
NULL
)
line_end
=
buffer_end
;
if
((
line_end
=
strstr
(
buffer
,
"
\n\n
"
))
==
NULL
)
{
/* Cut the last '\n' if there is one */
if
(
message_len
&&
buffer
[
message_len
-
1
]
==
'\n'
)
line_end
=
buffer_end
-
1
;
else
line_end
=
buffer_end
;
}
message_len
=
line_end
-
buffer
;
commit
->
message_short
=
git__malloc
(
message_len
+
1
);
memcpy
(
commit
->
message_short
,
buffer
,
message_len
);
for
(
i
=
0
;
i
<
message_len
;
++
i
)
{
commit
->
message_short
[
i
]
=
(
buffer
[
i
]
==
'\n'
)
?
' '
:
buffer
[
i
];
}
commit
->
message_short
[
message_len
]
=
0
;
}
...
...
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