shallow: add repository argument to register_shallow

Add a repository argument to allow callers of register_shallow
to be more specific about which repository to handle. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.

As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Stefan Beller
2018-05-17 15:51:44 -07:00
committed by Junio C Hamano
parent 6a2df51c84
commit 19143f139d
6 changed files with 11 additions and 9 deletions

View File

@ -663,7 +663,7 @@ static void send_shallow(struct commit_list *result)
if (!(object->flags & (CLIENT_SHALLOW|NOT_SHALLOW))) {
packet_write_fmt(1, "shallow %s",
oid_to_hex(&object->oid));
register_shallow(&object->oid);
register_shallow(the_repository, &object->oid);
shallow_nr++;
}
result = result->next;
@ -700,7 +700,7 @@ static void send_unshallow(const struct object_array *shallows)
add_object_array(object, NULL, &extra_edge_obj);
}
/* make sure commit traversal conforms to client */
register_shallow(&object->oid);
register_shallow(the_repository, &object->oid);
}
}
@ -912,7 +912,8 @@ static void receive_needs(void)
if (shallows.nr > 0) {
int i;
for (i = 0; i < shallows.nr; i++)
register_shallow(&shallows.objects[i].item->oid);
register_shallow(the_repository,
&shallows.objects[i].item->oid);
}
shallow_nr += shallows.nr;