Skip to content

Commit 5c24cde

Browse files
pcloudsgitster
authored andcommitted
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>
1 parent e8e44de commit 5c24cde

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

upload-pack.c

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,20 @@ static void check_non_tip(void)
538538
}
539539
}
540540

541+
static void send_shallow(struct commit_list *result)
542+
{
543+
while (result) {
544+
struct object *object = &result->item->object;
545+
if (!(object->flags & (CLIENT_SHALLOW|NOT_SHALLOW))) {
546+
packet_write(1, "shallow %s",
547+
oid_to_hex(&object->oid));
548+
register_shallow(object->oid.hash);
549+
shallow_nr++;
550+
}
551+
result = result->next;
552+
}
553+
}
554+
541555
static void deepen(int depth, const struct object_array *shallows)
542556
{
543557
struct commit_list *result = NULL, *backup = NULL;
@@ -551,16 +565,7 @@ static void deepen(int depth, const struct object_array *shallows)
551565
backup = result =
552566
get_shallow_commits(&want_obj, depth,
553567
SHALLOW, NOT_SHALLOW);
554-
while (result) {
555-
struct object *object = &result->item->object;
556-
if (!(object->flags & (CLIENT_SHALLOW|NOT_SHALLOW))) {
557-
packet_write(1, "shallow %s",
558-
oid_to_hex(&object->oid));
559-
register_shallow(object->oid.hash);
560-
shallow_nr++;
561-
}
562-
result = result->next;
563-
}
568+
send_shallow(result);
564569
free_commit_list(backup);
565570
for (i = 0; i < shallows->nr; i++) {
566571
struct object *object = shallows->objects[i].item;

0 commit comments

Comments
 (0)