summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Straub <bstraub@github.com>2012-07-09 20:32:26 -0700
committerBen Straub <bstraub@github.com>2012-07-09 20:32:26 -0700
commitaed794d0421f7538dc8518bab89975e8c44d27cf (patch)
tree02e9cd192af1a4b732d234b35eb81ff58a023f50
parentf2d42eea34b0b080877d3bfd5cd3dd3242459d32 (diff)
downloadlibgit2-aed794d0421f7538dc8518bab89975e8c44d27cf.tar.gz
Checkout: only walk tree once while checking out.
-rw-r--r--src/checkout.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/checkout.c b/src/checkout.c
index 8d3a89e21..67c9a5262 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -53,15 +53,6 @@ typedef struct tree_walk_data
} tree_walk_data;
-/* TODO: murder this */
-static int count_walker(const char *path, git_tree_entry *entry, void *payload)
-{
- GIT_UNUSED(path);
- GIT_UNUSED(entry);
- ((tree_walk_data*)payload)->stats->total++;
- return 0;
-}
-
static int apply_filters(git_buf *out,
git_vector *filters,
const void *data,
@@ -166,13 +157,12 @@ int git_checkout_force(git_repository *repo, git_indexer_stats *stats)
payload.stats = stats;
payload.repo = repo;
+ /* TODO: stats->total is never calculated. */
+
if (!get_head_tree(&tree, repo)) {
- /* Count all the tree nodes for progress information */
- if (!git_tree_walk(tree, count_walker, GIT_TREEWALK_POST, &payload)) {
- /* Checkout the files */
- if (!git_tree_walk(tree, checkout_walker, GIT_TREEWALK_POST, &payload)) {
- retcode = 0;
- }
+ /* Checkout the files */
+ if (!git_tree_walk(tree, checkout_walker, GIT_TREEWALK_POST, &payload)) {
+ retcode = 0;
}
git_tree_free(tree);
}