diff --git a/include/git2/index.h b/include/git2/index.h index 85f8cfc39..c88a1701c 100644 --- a/include/git2/index.h +++ b/include/git2/index.h @@ -335,18 +335,6 @@ GIT_EXTERN(const git_index_entry_unmerged *) git_index_get_unmerged_byindex(git_ */ GIT_EXTERN(int) git_index_entry_stage(const git_index_entry *entry); -/** - * Read a tree into the index file - * - * The current index contents will be replaced by the specified tree. - * - * @param index an existing index object - * @param tree tree to read - * @return 0 or an error code - */ -GIT_EXTERN(int) git_index_read_tree(git_index *index, git_tree *tree); - - /** * Read a tree into the index file with stats * @@ -355,10 +343,10 @@ GIT_EXTERN(int) git_index_read_tree(git_index *index, git_tree *tree); * * @param index an existing index object * @param tree tree to read - * @param stats structure that receives the total node count + * @param stats structure that receives the total node count (may be NULL) * @return 0 or an error code */ -GIT_EXTERN(int) git_index_read_tree_with_stats(git_index *index, git_tree *tree, git_indexer_stats *stats); +GIT_EXTERN(int) git_index_read_tree(git_index *index, git_tree *tree, git_indexer_stats *stats); /** @} */ GIT_END_DECL diff --git a/src/checkout.c b/src/checkout.c index 3eed002ec..87116ba19 100644 --- a/src/checkout.c +++ b/src/checkout.c @@ -191,7 +191,7 @@ int git_checkout_head(git_repository *repo, git_checkout_opts *opts, git_indexer if (!git_repository_head_tree(&tree, repo)) { git_index *idx; if (!(retcode = git_repository_index(&idx, repo))) { - if (!(retcode = git_index_read_tree_with_stats(idx, tree, stats))) { + if (!(retcode = git_index_read_tree(idx, tree, stats))) { retcode = git_tree_walk(tree, checkout_walker, GIT_TREEWALK_POST, &payload); } git_index_free(idx); diff --git a/src/index.c b/src/index.c index 434c1f102..5f6206554 100644 --- a/src/index.c +++ b/src/index.c @@ -1020,7 +1020,7 @@ static int read_tree_cb(const char *root, const git_tree_entry *tentry, void *da return 0; } -int git_index_read_tree_with_stats(git_index *index, git_tree *tree, git_indexer_stats *stats) +int git_index_read_tree(git_index *index, git_tree *tree, git_indexer_stats *stats) { git_indexer_stats dummy_stats; read_tree_data rtd = {index, NULL}; @@ -1033,8 +1033,3 @@ int git_index_read_tree_with_stats(git_index *index, git_tree *tree, git_indexer return git_tree_walk(tree, read_tree_cb, GIT_TREEWALK_POST, &rtd); } - -int git_index_read_tree(git_index *index, git_tree *tree) -{ - return git_index_read_tree_with_stats(index, tree, NULL); -} diff --git a/src/reset.c b/src/reset.c index 14f7a236a..1379f6442 100644 --- a/src/reset.c +++ b/src/reset.c @@ -80,7 +80,7 @@ int git_reset( goto cleanup; } - if (git_index_read_tree(index, tree) < 0) { + if (git_index_read_tree(index, tree, NULL) < 0) { giterr_set(GITERR_INDEX, "%s - Failed to update the index.", ERROR_MSG); goto cleanup; } diff --git a/tests-clar/index/read_tree.c b/tests-clar/index/read_tree.c index c657d4f71..0479332dc 100644 --- a/tests-clar/index/read_tree.c +++ b/tests-clar/index/read_tree.c @@ -33,7 +33,7 @@ void test_index_read_tree__read_write_involution(void) /* read-tree */ git_tree_lookup(&tree, repo, &expected); - cl_git_pass(git_index_read_tree(index, tree)); + cl_git_pass(git_index_read_tree(index, tree, NULL)); git_tree_free(tree); cl_git_pass(git_tree_create_fromindex(&tree_oid, index)); diff --git a/tests-clar/status/worktree.c b/tests-clar/status/worktree.c index d84cb77ed..6e21e44bf 100644 --- a/tests-clar/status/worktree.c +++ b/tests-clar/status/worktree.c @@ -484,7 +484,7 @@ static void fill_index_wth_head_entries(git_repository *repo, git_index *index) cl_git_pass(git_commit_lookup(&commit, repo, &oid)); cl_git_pass(git_commit_tree(&tree, commit)); - cl_git_pass(git_index_read_tree(index, tree)); + cl_git_pass(git_index_read_tree(index, tree, NULL)); cl_git_pass(git_index_write(index)); git_tree_free(tree);