Skip to content

Commit

Permalink
promisor-remote: output trace2 statistics for number of objects fetched
Browse files Browse the repository at this point in the history
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
newren authored and gitster committed Jun 16, 2021
1 parent 670b81a commit 78cfdd0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions promisor-remote.c
Expand Up @@ -12,7 +12,8 @@ void set_repository_format_partial_clone(char *partial_clone)
repository_format_partial_clone = xstrdup_or_null(partial_clone);
}

static int fetch_objects(const char *remote_name,
static int fetch_objects(struct repository *repo,
const char *remote_name,
const struct object_id *oids,
int oid_nr)
{
Expand All @@ -30,6 +31,8 @@ static int fetch_objects(const char *remote_name,
die(_("promisor-remote: unable to fork off fetch subprocess"));
child_in = xfdopen(child.in, "w");

trace2_data_intmax("promisor", repo, "fetch_count", oid_nr);

for (i = 0; i < oid_nr; i++) {
if (fputs(oid_to_hex(&oids[i]), child_in) < 0)
die_errno(_("promisor-remote: could not write to fetch subprocess"));
Expand Down Expand Up @@ -238,7 +241,7 @@ int promisor_remote_get_direct(struct repository *repo,
promisor_remote_init();

for (r = promisors; r; r = r->next) {
if (fetch_objects(r->name, remaining_oids, remaining_nr) < 0) {
if (fetch_objects(repo, r->name, remaining_oids, remaining_nr) < 0) {
if (remaining_nr == 1)
continue;
remaining_nr = remove_fetched_oids(repo, &remaining_oids,
Expand Down

0 comments on commit 78cfdd0

Please sign in to comment.