1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-28 17:26:12 +02:00

upload-pack: move "shallow" sending code out of deepen()

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Nguyễn Thái Ngọc Duy 2016-06-12 17:53:46 +07:00 committed by Junio C Hamano
parent e8e44de787
commit 5c24cdea1e

View File

@ -538,6 +538,20 @@ static void check_non_tip(void)
}
}
static void send_shallow(struct commit_list *result)
{
while (result) {
struct object *object = &result->item->object;
if (!(object->flags & (CLIENT_SHALLOW|NOT_SHALLOW))) {
packet_write(1, "shallow %s",
oid_to_hex(&object->oid));
register_shallow(object->oid.hash);
shallow_nr++;
}
result = result->next;
}
}
static void deepen(int depth, const struct object_array *shallows)
{
struct commit_list *result = NULL, *backup = NULL;
@ -551,16 +565,7 @@ static void deepen(int depth, const struct object_array *shallows)
backup = result =
get_shallow_commits(&want_obj, depth,
SHALLOW, NOT_SHALLOW);
while (result) {
struct object *object = &result->item->object;
if (!(object->flags & (CLIENT_SHALLOW|NOT_SHALLOW))) {
packet_write(1, "shallow %s",
oid_to_hex(&object->oid));
register_shallow(object->oid.hash);
shallow_nr++;
}
result = result->next;
}
send_shallow(result);
free_commit_list(backup);
for (i = 0; i < shallows->nr; i++) {
struct object *object = shallows->objects[i].item;