Commit b1be9dd0e53d25d0dc4dd4a5296e1cffd7e96bf0

nulltoken 2012-10-03T12:09:17

index: introduce git_index_owner()

diff --git a/include/git2/index.h b/include/git2/index.h
index d8282e8..e8af362 100644
--- a/include/git2/index.h
+++ b/include/git2/index.h
@@ -347,6 +347,14 @@ GIT_EXTERN(int) git_index_entry_stage(const git_index_entry *entry);
  */
 GIT_EXTERN(int) git_index_read_tree(git_index *index, git_tree *tree);
 
+/**
+ * Get the repository this index relates to
+ *
+ * @param index The index
+ * @return A pointer to the repository
+ */
+GIT_EXTERN(git_repository *) git_index_owner(const git_index *index);
+
 /** @} */
 GIT_END_DECL
 #endif
diff --git a/src/index.c b/src/index.c
index f92c48d..38e83d0 100644
--- a/src/index.c
+++ b/src/index.c
@@ -1071,3 +1071,8 @@ int git_index_read_tree(git_index *index, git_tree *tree)
 
 	return git_tree_walk(tree, read_tree_cb, GIT_TREEWALK_POST, index);
 }
+
+git_repository *git_index_owner(const git_index *index)
+{
+	return INDEX_OWNER(index);
+}