mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-06 17:20:22 +00:00
Add getter methods for object owners
You can know access the owning repository of any existing object, or the repository on which a revision walker is working on. Signed-off-by: Vicent Marti <tanoku@gmail.com>
This commit is contained in:
parent
aaf68dc443
commit
a13bc8e74f
@ -96,7 +96,7 @@ GIT_EXTERN(git_object *) git_object_new(git_repository *repo, git_otype type);
|
||||
* @param object Git object to write back
|
||||
* @return 0 on success; otherwise an error code
|
||||
*/
|
||||
int git_object_write(git_object *object);
|
||||
GIT_EXTERN(int) git_object_write(git_object *object);
|
||||
|
||||
/**
|
||||
* Get the id (SHA1) of a repository object
|
||||
@ -107,7 +107,7 @@ int git_object_write(git_object *object);
|
||||
* @param obj the repository object
|
||||
* @return the SHA1 id
|
||||
*/
|
||||
const git_oid *git_object_id(git_object *obj);
|
||||
GIT_EXTERN(const git_oid *) git_object_id(git_object *obj);
|
||||
|
||||
/**
|
||||
* Get the object type of an object
|
||||
@ -115,7 +115,15 @@ const git_oid *git_object_id(git_object *obj);
|
||||
* @param obj the repository object
|
||||
* @return the object's type
|
||||
*/
|
||||
git_otype git_object_type(git_object *obj);
|
||||
GIT_EXTERN(git_otype) git_object_type(git_object *obj);
|
||||
|
||||
/**
|
||||
* Get the repository that owns this object
|
||||
*
|
||||
* @param obj the object
|
||||
* @return the repository who owns this object
|
||||
*/
|
||||
GIT_EXTERN(git_repository *) git_object_owner(git_object *obj);
|
||||
|
||||
/**
|
||||
* Free a reference to one of the objects in the repository.
|
||||
|
@ -97,6 +97,15 @@ GIT_EXTERN(void) git_revwalk_sorting(git_revwalk *walk, unsigned int sort_mode);
|
||||
*/
|
||||
GIT_EXTERN(void) git_revwalk_free(git_revwalk *walk);
|
||||
|
||||
/**
|
||||
* Return the repository on which this walker
|
||||
* is operating.
|
||||
*
|
||||
* @param walk the revision walker
|
||||
* @return the repository being walked
|
||||
*/
|
||||
GIT_EXTERN(git_repository *) git_revwalk_repository(git_revwalk *walk);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
|
@ -333,6 +333,12 @@ git_otype git_object_type(git_object *obj)
|
||||
return obj->source.raw.type;
|
||||
}
|
||||
|
||||
git_repository *git_object_owner(git_object *obj)
|
||||
{
|
||||
assert(obj);
|
||||
return obj->repo;
|
||||
}
|
||||
|
||||
git_object *git_object_new(git_repository *repo, git_otype type)
|
||||
{
|
||||
git_object *object = NULL;
|
||||
|
@ -80,6 +80,12 @@ void git_revwalk_free(git_revwalk *walk)
|
||||
free(walk);
|
||||
}
|
||||
|
||||
git_repository *git_revwalk_repository(git_revwalk *walk)
|
||||
{
|
||||
assert(walk);
|
||||
return walk->repo;
|
||||
}
|
||||
|
||||
void git_revwalk_sorting(git_revwalk *walk, unsigned int sort_mode)
|
||||
{
|
||||
if (walk->walking)
|
||||
|
Loading…
Reference in New Issue
Block a user