X-Git-Url: http://git.tremily.us/?a=blobdiff_plain;f=shallow.c;h=6be915f38f1fe8dbe0a22c4cd8ae2569331f483f;hb=260adc87b3d6c00650ba2dd493abd9a6603ca4f1;hp=a0363dea203d2a06e985bb4e140ffc675428cbf8;hpb=d7a0129b3cf40e4f001295a22e2e9f8f6cbc14a4;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));