diff options
author | Vicent Marti <tanoku@gmail.com> | 2012-11-01 20:15:53 +0100 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2012-11-01 20:17:10 +0100 |
commit | 276ea401b3a45c85e49182f39db00ca5447aa340 (patch) | |
tree | d13f81a763fb4be23044aa2210fcc81aadb095ff /include/git2/index.h | |
parent | 8ff0f3250a62a128fb68ce3fae1719549a3fe47a (diff) | |
download | libgit2-276ea401b3a45c85e49182f39db00ca5447aa340.tar.gz |
index: Add git_index_write_tree
Diffstat (limited to 'include/git2/index.h')
-rw-r--r-- | include/git2/index.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/include/git2/index.h b/include/git2/index.h index 1d91663d8..2a0b001ff 100644 --- a/include/git2/index.h +++ b/include/git2/index.h @@ -190,6 +190,38 @@ GIT_EXTERN(int) git_index_write(git_index *index); */ GIT_EXTERN(int) git_index_read_tree(git_index *index, git_tree *tree); +/** + * Write the index as a tree + * + * This method will scan the index and write a representation + * of its current state back to disk; it recursively creates + * tree objects for each of the subtrees stored in the index, + * but only returns the OID of the root tree. This is the OID + * that can be used e.g. to create a commit. + * + * The index instance cannot be bare, and needs to be associated + * to an existing repository. + * + * @param oid Pointer where to store the OID of the written tree + * @param index Index to write + * @return 0 or an error code + */ +GIT_EXTERN(int) git_index_write_tree(git_oid *oid, git_index *index); + +/** + * Write the index as a tree to the given repository + * + * This method will do the same as `git_index_write_tree`, but + * letting the user choose the repository where the tree will + * be written. + * + * @param oid Pointer where to store OID of the the written tree + * @param index Index to write + * @param repo Repository where to write the tree + * @return 0 or an error code + */ +GIT_EXTERN(int) git_index_write_tree_to(git_oid *oid, git_index *index, git_repository *repo); + /**@}*/ /** @name Raw Index Entry Functions |