summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2013-10-23 15:08:18 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2013-10-23 15:08:18 +0200
commitab46b1d8ebcdc820aefe2c1391d4be73939bce95 (patch)
treef24847504a3aa46be49dbfdab64f6d770914a6d3 /src
parentebbd48f00e87eab699862f03a457571ead3c53b1 (diff)
downloadlibgit2-ab46b1d8ebcdc820aefe2c1391d4be73939bce95.tar.gz
indexer: include the delta stats
The user is unable to derive the number of deltas in the pack, as that would require them to capture the stats exactly in the moment between download and final processing, which is abstracted away in the fetch. Capture these numbers for the user and expose them in the progress struct. The clone and fetch examples now also present this information to the user.
Diffstat (limited to 'src')
-rw-r--r--src/indexer.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/indexer.c b/src/indexer.c
index 93ad116fe..f6e9ad902 100644
--- a/src/indexer.c
+++ b/src/indexer.c
@@ -483,6 +483,8 @@ int git_indexer_stream_add(git_indexer_stream *idx, const void *data, size_t siz
stats->received_objects = 0;
stats->local_objects = 0;
+ stats->total_deltas = 0;
+ stats->indexed_deltas = 0;
processed = stats->indexed_objects = 0;
stats->total_objects = total_objects;
do_progress_callback(idx, stats);
@@ -758,6 +760,7 @@ static int resolve_deltas(git_indexer_stream *idx, git_transfer_progress *stats)
git__free(obj.data);
stats->indexed_objects++;
+ stats->indexed_deltas++;
progressed = 1;
do_progress_callback(idx, stats);
@@ -866,6 +869,9 @@ int git_indexer_stream_finalize(git_indexer_stream *idx, git_transfer_progress *
return -1;
}
+ /* Freeze the number of deltas */
+ stats->total_deltas = stats->total_objects - stats->indexed_objects;
+
if (resolve_deltas(idx, stats) < 0)
return -1;