From: Nguyễn Thái Ngọc Duy Date: Sun, 12 Jun 2016 10:53:46 +0000 (+0700) Subject: upload-pack: move "shallow" sending code out of deepen() X-Git-Tag: v2.11.0-rc0~68^2~23 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/5c24cdea1e33c72bfed4af25a363eb5ceae11199?ds=inline upload-pack: move "shallow" sending code out of deepen() Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff --git a/upload-pack.c b/upload-pack.c index 97ed62002e..0eb9a0b8fa 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -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;