Signed-off-by: Nguyễn Thái Ngọc Duy <pclo...@gmail.com>
---
 upload-pack.c | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/upload-pack.c b/upload-pack.c
index 79f5525..69a3828 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -545,21 +545,10 @@ static void send_shallow(struct commit_list *result)
        }
 }
 
-static void deepen(int depth, const struct object_array *shallows)
+static void send_unshallow(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);
+
        for (i = 0; i < shallows->nr; i++) {
                struct object *object = shallows->objects[i].item;
                if (object->flags & NOT_SHALLOW) {
@@ -582,6 +571,24 @@ static void deepen(int depth, const struct object_array 
*shallows)
                /* make sure commit traversal conforms to client */
                register_shallow(object->sha1);
        }
+}
+
+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);
 }
 
-- 
2.3.0.rc1.137.g477eb31

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to