mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-28 14:02:57 +00:00
Enable stats on git_index_read_tree.
Replace with the contents of git_index_read_tree_with_stats() and improve documentation comments.
This commit is contained in:
parent
84595a30c0
commit
4bf5115642
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user