aboutsummaryrefslogtreecommitdiff
path: root/upload-pack.c
diff options
context:
space:
mode:
Diffstat (limited to 'upload-pack.c')
-rw-r--r--upload-pack.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/upload-pack.c b/upload-pack.c
index 8dd6121da..ebe1e5ae4 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -488,7 +488,7 @@ static void receive_needs(void)
{
struct object_array shallows = {0, 0, NULL};
static char line[1000];
- int len;
+ int len, depth = 0;
for (;;) {
struct object *o;
@@ -509,6 +509,13 @@ static void receive_needs(void)
add_object_array(object, NULL, &shallows);
continue;
}
+ if (!strncmp("deepen ", line, 7)) {
+ char *end;
+ depth = strtol(line + 7, &end, 0);
+ if (end == line + 7 || depth <= 0)
+ die("Invalid deepen: %s", line);
+ continue;
+ }
if (strncmp("want ", line, 5) ||
get_sha1_hex(line+5, sha1_buf))
die("git-upload-pack: protocol error, "
@@ -540,6 +547,18 @@ static void receive_needs(void)
add_object_array(o, NULL, &want_obj);
}
}
+ if (depth > 0) {
+ struct commit_list *result, *backup;
+ if (shallows.nr > 0)
+ die("Deepening a shallow repository not yet supported");
+ backup = result = get_shallow_commits(&want_obj, depth);
+ while (result) {
+ packet_write(1, "shallow %s",
+ sha1_to_hex(result->item->object.sha1));
+ result = result->next;
+ }
+ free_commit_list(backup);
+ }
if (shallows.nr > 0) {
int i;
for (i = 0; i < shallows.nr; i++)