mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-06 05:01:54 +00:00
Merge pull request #1549 from nulltoken/fix/from_oids
Strict/lax commit API
This commit is contained in:
commit
3e96e3391c
@ -25,8 +25,9 @@ GIT_BEGIN_DECL
|
|||||||
*
|
*
|
||||||
* See documentation for `git_commit_create()` for information about the
|
* See documentation for `git_commit_create()` for information about the
|
||||||
* parameters, as the meaning is identical excepting that `tree` and
|
* parameters, as the meaning is identical excepting that `tree` and
|
||||||
* `parents` now take `git_oid`. This is a dangerous API in that the
|
* `parents` now take `git_oid`. This is a dangerous API in that nor
|
||||||
* `parents` list of `git_oid`s in not checked for validity.
|
* the `tree`, neither the `parents` list of `git_oid`s are checked for
|
||||||
|
* validity.
|
||||||
*/
|
*/
|
||||||
GIT_EXTERN(int) git_commit_create_from_oids(
|
GIT_EXTERN(int) git_commit_create_from_oids(
|
||||||
git_oid *oid,
|
git_oid *oid,
|
||||||
|
@ -96,7 +96,6 @@ int git_commit_create_from_oids(
|
|||||||
git_odb *odb;
|
git_odb *odb;
|
||||||
|
|
||||||
assert(oid && repo && tree && parent_count >= 0);
|
assert(oid && repo && tree && parent_count >= 0);
|
||||||
assert(git_object_owner((const git_object *)tree) == repo);
|
|
||||||
|
|
||||||
git_oid__writebuf(&commit, "tree ", tree);
|
git_oid__writebuf(&commit, "tree ", tree);
|
||||||
|
|
||||||
@ -149,6 +148,7 @@ int git_commit_create(
|
|||||||
const git_oid **parent_oids;
|
const git_oid **parent_oids;
|
||||||
|
|
||||||
assert(parent_count >= 0);
|
assert(parent_count >= 0);
|
||||||
|
assert(git_object_owner((const git_object *)tree) == repo);
|
||||||
|
|
||||||
parent_oids = git__malloc(parent_count * sizeof(git_oid *));
|
parent_oids = git__malloc(parent_count * sizeof(git_oid *));
|
||||||
GITERR_CHECK_ALLOC(parent_oids);
|
GITERR_CHECK_ALLOC(parent_oids);
|
||||||
|
Loading…
Reference in New Issue
Block a user