X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=revision.c;h=1224a2de624047eebd24969852af6833dbea2874;hb=7b0c996679e975b666fd27c922e1e0837b611c98;hp=2cda7e0edc6c9efcfd9bd52884a87eced2b8b12d;hpb=ce4a706388bd26a3f897bb41a397113f1076ffc6;p=git.git diff --git a/revision.c b/revision.c index 2cda7e0e..1224a2de 100644 --- a/revision.c +++ b/revision.c @@ -420,24 +420,33 @@ static void limit_list(struct rev_info *revs) p = &commit_list_insert(commit, p)->next; } if (revs->boundary) { - list = newlist; - while (list) { + /* mark the ones that are on the result list first */ + for (list = newlist; list; list = list->next) { + struct commit *commit = list->item; + commit->object.flags |= TMP_MARK; + } + for (list = newlist; list; list = list->next) { struct commit *commit = list->item; struct object *obj = &commit->object; - struct commit_list *parent = commit->parents; - if (obj->flags & (UNINTERESTING|BOUNDARY)) { - list = list->next; + struct commit_list *parent; + if (obj->flags & UNINTERESTING) continue; - } - while (parent) { + for (parent = commit->parents; + parent; + parent = parent->next) { struct commit *pcommit = parent->item; - parent = parent->next; if (!(pcommit->object.flags & UNINTERESTING)) continue; pcommit->object.flags |= BOUNDARY; + if (pcommit->object.flags & TMP_MARK) + continue; + pcommit->object.flags |= TMP_MARK; p = &commit_list_insert(pcommit, p)->next; } - list = list->next; + } + for (list = newlist; list; list = list->next) { + struct commit *commit = list->item; + commit->object.flags &= ~TMP_MARK; } } revs->commits = newlist; @@ -596,6 +605,10 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch revs->limited = 1; continue; } + if (!strcmp(arg, "--parents")) { + revs->parents = 1; + continue; + } if (!strcmp(arg, "--dense")) { revs->dense = 1; continue; @@ -641,14 +654,13 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch dotdot = strstr(arg, ".."); if (dotdot) { unsigned char from_sha1[20]; - char *next = dotdot + 2; - char *this = arg; - static const char HEAD[] = "HEAD"; + const char *next = dotdot + 2; + const char *this = arg; *dotdot = 0; if (!*next) - next = HEAD; + next = "HEAD"; if (dotdot == arg) - this = HEAD; + this = "HEAD"; if (!get_sha1(this, from_sha1) && !get_sha1(next, sha1)) { struct commit *exclude;