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
a35cc402
Commit
a35cc402
authored
Aug 02, 2018
by
Etienne Samson
Committed by
Patrick Steinhardt
Jun 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit: apply grafts when parsing
parent
a8b1d515
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
5 deletions
+23
-5
src/commit.c
+23
-5
No files found.
src/commit.c
View file @
a35cc402
...
@@ -412,10 +412,6 @@ static int commit_parse(git_commit *commit, const char *data, size_t size, unsig
...
@@ -412,10 +412,6 @@ static int commit_parse(git_commit *commit, const char *data, size_t size, unsig
buffer
+=
tree_len
;
buffer
+=
tree_len
;
}
}
/*
* TODO: commit grafts!
*/
while
(
git_oid__parse
(
&
parent_id
,
&
buffer
,
buffer_end
,
"parent "
)
==
0
)
{
while
(
git_oid__parse
(
&
parent_id
,
&
buffer
,
buffer_end
,
"parent "
)
==
0
)
{
git_oid
*
new_id
=
git_array_alloc
(
commit
->
parent_ids
);
git_oid
*
new_id
=
git_array_alloc
(
commit
->
parent_ids
);
GIT_ERROR_CHECK_ALLOC
(
new_id
);
GIT_ERROR_CHECK_ALLOC
(
new_id
);
...
@@ -499,7 +495,29 @@ int git_commit__parse_raw(void *commit, const char *data, size_t size)
...
@@ -499,7 +495,29 @@ int git_commit__parse_raw(void *commit, const char *data, size_t size)
int
git_commit__parse_ext
(
git_commit
*
commit
,
git_odb_object
*
odb_obj
,
unsigned
int
flags
)
int
git_commit__parse_ext
(
git_commit
*
commit
,
git_odb_object
*
odb_obj
,
unsigned
int
flags
)
{
{
return
commit_parse
(
commit
,
git_odb_object_data
(
odb_obj
),
git_odb_object_size
(
odb_obj
),
flags
);
git_repository
*
repo
=
git_object_owner
((
git_object
*
)
commit
);
git_commit_graft
*
graft
;
int
error
;
if
((
error
=
commit_parse
(
commit
,
git_odb_object_data
(
odb_obj
),
git_odb_object_size
(
odb_obj
),
flags
))
<
0
)
return
error
;
/* Perform necessary grafts */
if
(
git__graft_for_oid
(
&
graft
,
repo
->
grafts
,
git_odb_object_id
(
odb_obj
))
!=
GIT_ENOTFOUND
)
{
size_t
idx
;
git_oid
*
oid
;
git_array_clear
(
commit
->
parent_ids
);
git_array_init_to_size
(
commit
->
parent_ids
,
git_array_size
(
graft
->
parents
));
git_array_foreach
(
graft
->
parents
,
idx
,
oid
)
{
git_oid
*
id
=
git_array_alloc
(
commit
->
parent_ids
);
GIT_ERROR_CHECK_ALLOC
(
id
);
git_oid_cpy
(
id
,
oid
);
}
}
return
0
;
}
}
int
git_commit__parse
(
void
*
_commit
,
git_odb_object
*
odb_obj
)
int
git_commit__parse
(
void
*
_commit
,
git_odb_object
*
odb_obj
)
...
...
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