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
726c6fd2
Commit
726c6fd2
authored
May 17, 2011
by
Jakob Pfender
Committed by
Vicent Marti
May 23, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit.c: Move to new error handling mechanism
parent
adef9922
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
+18
-7
src/commit.c
+18
-7
No files found.
src/commit.c
View file @
726c6fd2
...
...
@@ -102,6 +102,9 @@ int git_commit_create_v(
tree_oid
,
parent_count
,
oids
);
free
((
void
*
)
oids
);
if
(
error
<
GIT_SUCCESS
)
return
git__rethrow
(
error
,
"Failed to create commit"
);
return
error
;
}
...
...
@@ -133,6 +136,9 @@ int git_commit_create_ov(
parent_count
,
oids
);
free
((
void
*
)
oids
);
if
(
error
<
GIT_SUCCESS
)
return
git__rethrow
(
error
,
"Failed to create commit"
);
return
error
;
}
...
...
@@ -161,6 +167,9 @@ int git_commit_create_o(
parent_count
,
oids
);
free
((
void
*
)
oids
);
if
(
error
<
GIT_SUCCESS
)
return
git__rethrow
(
error
,
"Failed to create commit"
);
return
error
;
}
...
...
@@ -197,7 +206,7 @@ int git_commit_create(
final_size
+=
1
+
message_length
;
if
((
error
=
git_odb_open_wstream
(
&
stream
,
repo
->
db
,
final_size
,
GIT_OBJ_COMMIT
))
<
GIT_SUCCESS
)
return
error
;
return
git__rethrow
(
error
,
"Failed to create commit"
)
;
git__write_oid
(
stream
,
"tree"
,
tree_oid
);
...
...
@@ -222,12 +231,12 @@ int git_commit_create(
error
=
git_reference_lookup
(
&
head
,
repo
,
update_ref
);
if
(
error
<
GIT_SUCCESS
)
return
error
;
return
git__rethrow
(
error
,
"Failed to create commit"
)
;
error
=
git_reference_resolve
(
&
head
,
head
);
if
(
error
<
GIT_SUCCESS
)
{
if
(
error
!=
GIT_ENOTFOUND
)
return
error
;
return
git__rethrow
(
error
,
"Failed to create commit"
)
;
/*
* The target of the reference was not found. This can happen
* just after a repository has been initialized (the master
...
...
@@ -241,6 +250,8 @@ int git_commit_create(
error
=
git_reference_set_oid
(
head
,
oid
);
}
if
(
error
<
GIT_SUCCESS
)
return
git__rethrow
(
error
,
"Failed to create commit"
);
return
error
;
}
...
...
@@ -255,7 +266,7 @@ int commit_parse_buffer(git_commit *commit, const void *data, size_t len)
git_vector_init
(
&
commit
->
parent_oids
,
4
,
NULL
);
if
((
error
=
git__parse_oid
(
&
commit
->
tree_oid
,
&
buffer
,
buffer_end
,
"tree "
))
<
GIT_SUCCESS
)
return
error
;
return
git__rethrow
(
error
,
"Failed to parse buffer"
)
;
/*
* TODO: commit grafts!
...
...
@@ -273,12 +284,12 @@ int commit_parse_buffer(git_commit *commit, const void *data, size_t len)
commit
->
author
=
git__malloc
(
sizeof
(
git_signature
));
if
((
error
=
git_signature__parse
(
commit
->
author
,
&
buffer
,
buffer_end
,
"author "
))
<
GIT_SUCCESS
)
return
error
;
return
git__rethrow
(
error
,
"Failed to parse buffer"
)
;
/* Always parse the committer; we need the commit time */
commit
->
committer
=
git__malloc
(
sizeof
(
git_signature
));
if
((
error
=
git_signature__parse
(
commit
->
committer
,
&
buffer
,
buffer_end
,
"committer "
))
<
GIT_SUCCESS
)
return
error
;
return
git__rethrow
(
error
,
"Failed to parse buffer"
)
;
/* parse commit message */
while
(
buffer
<=
buffer_end
&&
*
buffer
==
'\n'
)
...
...
@@ -343,7 +354,7 @@ int git_commit_parent(git_commit **parent, git_commit *commit, unsigned int n)
parent_oid
=
git_vector_get
(
&
commit
->
parent_oids
,
n
);
if
(
parent_oid
==
NULL
)
return
GIT_ENOTFOUND
;
return
git__throw
(
GIT_ENOTFOUND
,
"Failed to get parent. Parent does not exist"
)
;
return
git_commit_lookup
(
parent
,
commit
->
object
.
repo
,
parent_oid
);
}
...
...
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