Re: [PATCH 06/27] upload-pack: move "unshallow" sending code out of deepen()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 10, 2016, 20:09 UTC
- Message-ID
- <xmqq1t44g61j.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20160610122714.3341-7-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
Show 17 quoted lines
> +static void deepen(int depth, const struct object_array *shallows)
> +{
> + struct commit_list *result = NULL;
> + int i;
> + if (depth == INFINITE_DEPTH && !is_repository_shallow())
> + for (i = 0; i < shallows->nr; i++) {
> + struct object *object = shallows->objects[i].item;
> + object->flags |= NOT_SHALLOW;
> + }
> + else
> + result = get_shallow_commits(&want_obj, depth,
> + SHALLOW, NOT_SHALLOW);
> + send_shallow(result);
> + free_commit_list(result);
> + send_unshallow(shallows);
> packet_flush(1);
> }Starting from the original up to this point, the code structure of this function have bothered me quite a bit because I would expect
if (depth == INFINITE_DEPTH && !is_repository_shallow()) {
for (i = 0; i < shallows->nr; i++) {
struct object *object = shallows->objects[i].item;
object->flags |= NOT_SHALLOW;
}
} else {
struct commit_list *result;
result = get_shallow_commits(&want_obj, depth,
SHALLOW, NOT_SHALLOW);
send_shallow(result);
free_commit_list(result);
}
send_unshallow(shallows);
packet_flush(1);would be easier to understand. The function seems to be reshaped further in the series, so let's keep reading...