summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/git/repository.h14
-rw-r--r--src/git/revwalk.h9
-rw-r--r--src/repository.c6
-rw-r--r--src/revwalk.c6
4 files changed, 32 insertions, 3 deletions
diff --git a/src/git/repository.h b/src/git/repository.h
index 9658989b4..0a50fe1ef 100644
--- a/src/git/repository.h
+++ b/src/git/repository.h
@@ -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.
diff --git a/src/git/revwalk.h b/src/git/revwalk.h
index 87f199e07..42ffbc3e7 100644
--- a/src/git/revwalk.h
+++ b/src/git/revwalk.h
@@ -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
diff --git a/src/repository.c b/src/repository.c
index 202fa04ab..fe7b870fe 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -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;
diff --git a/src/revwalk.c b/src/revwalk.c
index e8d686fe3..8cd444fb2 100644
--- a/src/revwalk.c
+++ b/src/revwalk.c
@@ -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)