8000 indexer: Initialise all members of git_indexer_progress by lrm29 · Pull Request #7049 · libgit2/libgit2 · GitHub
[go: up one dir, main page]

Skip to content

indexer: Initialise all members of git_indexer_progress #7049

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/libgit2/indexer.c
Original file line number Diff line number Diff line change
Expand Up @@ -921,12 +921,13 @@ int git_indexer_append(git_indexer *idx, const void *data, size_t size, git_inde
if (git_vector_init(&idx->deltas, total_objects / 2, NULL) < 0)
return -1;

stats->total_objects = total_objects;
stats->indexed_objects = 0;
stats->received_objects = 0;
stats->local_objects = 0;
stats->total_deltas = 0;
stats->indexed_deltas = 0;
stats->indexed_objects = 0;
stats->total_objects = total_objects;
< 8000 span class='blob-code-inner blob-code-marker ' data-code-marker="+"> stats->received_bytes = 0;

if ((error = do_progress_callback(idx, stats)) != 0)
return error;
Expand Down
15 changes: 14 additions & 1 deletion tests/libgit2/network/remote/local.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ static git_strarray push_array = {
1,
};

static int push_transfer_progress_cb(unsigned int current, unsigned int total, size_t bytes, void* payload)
{
GIT_UNUSED(current);
GIT_UNUSED(total);
GIT_UNUSED(payload);

cl_assert(bytes == 0);

return 0;
}

void test_network_remote_local__initialize(void)
{
cl_git_pass(git_repository_init(&repo, "remotelocal/", 0));
Expand Down Expand Up @@ -201,6 +212 7A3D ,7 @@ void test_network_remote_local__push_to_bare_remote(void)

/* Should be able to push to a bare remote */
git_remote *localremote;
git_push_options opts = GIT_PUSH_OPTIONS_INIT;

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

/* Try to push */
cl_git_pass(git_remote_upload(localremote, &push_array, NULL));
opts.callbacks.push_transfer_progress = push_transfer_progress_cb;
cl_git_pass(git_remote_upload(localremote, &push_array, &opts));

/* Clean up */
git_remote_free(localremote);
Expand Down
Loading
0