X-Git-Url: http://git.tremily.us/?a=blobdiff_plain;f=shallow.c;h=6be915f38f1fe8dbe0a22c4cd8ae2569331f483f;hb=081fd8d093887b0cc5055d8a191ae2c26274846b;hp=a0363dea203d2a06e985bb4e140ffc675428cbf8;hpb=c9de921848061db9316fe8dc2ebff4bcadf8117f;p=git.git diff --git a/shallow.c b/shallow.c index a0363dea2..6be915f38 100644 --- a/shallow.c +++ b/shallow.c @@ -72,8 +72,14 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth, } if (parse_commit(commit)) die("invalid commit"); - commit->object.flags |= not_shallow_flag; cur_depth++; + if (cur_depth >= depth) { + commit_list_insert(commit, &result); + commit->object.flags |= shallow_flag; + commit = NULL; + continue; + } + commit->object.flags |= not_shallow_flag; for (p = commit->parents, commit = NULL; p; p = p->next) { if (!p->item->util) { int *pointer = xmalloc(sizeof(int));