Skip to content

Commit af30457

Browse files
authored
Merge pull request #7049 from mathworks/git_indexer_stats_init
indexer: Initialise all members of git_indexer_progress
2 parents 200aace + 56ccb9b commit af30457

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

src/libgit2/indexer.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -921,12 +921,13 @@ int git_indexer_append(git_indexer *idx, const void *data, size_t size, git_inde
921921
if (git_vector_init(&idx->deltas, total_objects / 2, NULL) < 0)
922922
return -1;
923923

924+
stats->total_objects = total_objects;
925+
stats->indexed_objects = 0;
924926
stats->received_objects = 0;
925927
stats->local_objects = 0;
926928
stats->total_deltas = 0;
927929
stats->indexed_deltas = 0;
928-
stats->indexed_objects = 0;
929-
stats->total_objects = total_objects;
930+
stats->received_bytes = 0;
930931

931932
if ((error = do_progress_callback(idx, stats)) != 0)
932933
return error;

tests/libgit2/network/remote/local.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@ static git_strarray push_array = {
1616
1,
1717
};
1818

19+
static int push_transfer_progress_cb(unsigned int current, unsigned int total, size_t bytes, void* payload)
20+
{
21+
GIT_UNUSED(current);
22+
GIT_UNUSED(total);
23+
GIT_UNUSED(payload);
24+
25+
cl_assert(bytes == 0);
26+
27+
return 0;
28+
}
29+
1930
void test_network_remote_local__initialize(void)
2031
{
2132
cl_git_pass(git_repository_init(&repo, "remotelocal/", 0));
@@ -201,6 +212,7 @@ void test_network_remote_local__push_to_bare_remote(void)
201212

202213
/* Should be able to push to a bare remote */
203214
git_remote *localremote;
215+
git_push_options opts = GIT_PUSH_OPTIONS_INIT;
204216

205217
/* Get some commits */
206218
connect_to_local_repository(cl_fixture("testrepo.git"));
@@ -218,7 +230,8 @@ void test_network_remote_local__push_to_bare_remote(void)
218230
cl_git_pass(git_remote_connect(localremote, GIT_DIRECTION_PUSH, NULL, NULL, NULL));
219231

220232
/* Try to push */
221-
cl_git_pass(git_remote_upload(localremote, &push_array, NULL));
233+
opts.callbacks.push_transfer_progress = push_transfer_progress_cb;
234+
cl_git_pass(git_remote_upload(localremote, &push_array, &opts));
222235

223236
/* Clean up */
224237
git_remote_free(localremote);

0 commit comments

Comments
 (0)