Commit 81eecc34 by Ben Straub

Fetch: don't clobber received count

This memset was being reached after the entire packfile under
WinHttp, so the byte count was being lost for small repos.
parent 63e44d5e
......@@ -338,7 +338,8 @@ int git_indexer_stream_add(git_indexer_stream *idx, const void *data, size_t siz
if (git_vector_init(&idx->deltas, (unsigned int)(idx->nr_objects / 2), NULL) < 0)
return -1;
memset(stats, 0, sizeof(git_transfer_progress));
stats->received_objects = 0;
stats->indexed_objects = 0;
stats->total_objects = (unsigned int)idx->nr_objects;
do_progress_callback(idx, stats);
}
......
......@@ -30,16 +30,15 @@ static int update_tips(const char *refname, const git_oid *a, const git_oid *b,
static void progress(const git_transfer_progress *stats, void *payload)
{
bool *was_called = (bool*)payload;
GIT_UNUSED(stats);
*was_called = true;
int *bytes_received = (int*)payload;
*bytes_received = stats->received_bytes;
}
static void do_fetch(const char *url, int flag, int n)
{
git_remote *remote;
git_remote_callbacks callbacks;
bool progress_was_called = false;
int bytes_received = 0;
memset(&callbacks, 0, sizeof(git_remote_callbacks));
callbacks.update_tips = update_tips;
......@@ -49,11 +48,11 @@ static void do_fetch(const char *url, int flag, int n)
git_remote_set_callbacks(remote, &callbacks);
git_remote_set_autotag(remote, flag);
cl_git_pass(git_remote_connect(remote, GIT_DIR_FETCH));
cl_git_pass(git_remote_download(remote, progress, &progress_was_called));
cl_git_pass(git_remote_download(remote, progress, &bytes_received));
git_remote_disconnect(remote);
cl_git_pass(git_remote_update_tips(remote));
cl_assert_equal_i(counter, n);
cl_assert_equal_i(progress_was_called, true);
cl_assert(bytes_received > 0);
git_remote_free(remote);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment