summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/checkout.c2
-rw-r--r--src/index.c17
-rw-r--r--src/reset.c2
3 files changed, 6 insertions, 15 deletions
diff --git a/src/checkout.c b/src/checkout.c
index cbe13aa79..155ac5ac1 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -403,7 +403,7 @@ int git_checkout_tree(
if ((error = git_repository_index(&index, repo)) < 0)
goto cleanup;
- if ((error = git_index_read_tree(index, tree, NULL)) < 0)
+ if ((error = git_index_read_tree(index, tree)) < 0)
goto cleanup;
if ((error = git_index_write(index)) < 0)
diff --git a/src/index.c b/src/index.c
index f9f3b14cc..362c2c690 100644
--- a/src/index.c
+++ b/src/index.c
@@ -1039,12 +1039,10 @@ typedef struct read_tree_data {
static int read_tree_cb(const char *root, const git_tree_entry *tentry, void *data)
{
- read_tree_data *rtd = data;
+ git_index *index = (git_index *)data;
git_index_entry *entry = NULL;
git_buf path = GIT_BUF_INIT;
- rtd->stats->total++;
-
if (git_tree_entry__is_tree(tentry))
return 0;
@@ -1059,7 +1057,7 @@ static int read_tree_cb(const char *root, const git_tree_entry *tentry, void *da
entry->path = git_buf_detach(&path);
git_buf_free(&path);
- if (index_insert(rtd->index, entry, 0) < 0) {
+ if (index_insert(index, entry, 0) < 0) {
index_entry_free(entry);
return -1;
}
@@ -1067,16 +1065,9 @@ static int read_tree_cb(const char *root, const git_tree_entry *tentry, void *da
return 0;
}
-int git_index_read_tree(git_index *index, git_tree *tree, git_indexer_stats *stats)
+int git_index_read_tree(git_index *index, git_tree *tree)
{
- git_indexer_stats dummy_stats;
- read_tree_data rtd = {index, NULL};
-
- if (!stats) stats = &dummy_stats;
- stats->total = 0;
- rtd.stats = stats;
-
git_index_clear(index);
- return git_tree_walk(tree, read_tree_cb, GIT_TREEWALK_POST, &rtd);
+ return git_tree_walk(tree, read_tree_cb, GIT_TREEWALK_POST, index);
}
diff --git a/src/reset.c b/src/reset.c
index 3fcad7f46..642318d90 100644
--- a/src/reset.c
+++ b/src/reset.c
@@ -73,7 +73,7 @@ int git_reset(
goto cleanup;
}
- if (git_index_read_tree(index, tree, NULL) < 0) {
+ if (git_index_read_tree(index, tree) < 0) {
giterr_set(GITERR_INDEX, "%s - Failed to update the index.", ERROR_MSG);
goto cleanup;
}