X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=revision.c;h=4231ea2cce57c74a4110c9c69459a4caf67dc15c;hb=36c79d2bf893b9957688a6c8c13cc0bf0589e596;hp=0eb6faa5378ebafe2c4939cb4ec7fd2e6aaadb02;hpb=df4a824341f34b1d2d890ce3e9dd7f6df6475953;p=git.git diff --git a/revision.c b/revision.c index 0eb6faa53..4231ea2cc 100644 --- a/revision.c +++ b/revision.c @@ -564,14 +564,39 @@ static void cherry_pick_list(struct commit_list *list, struct rev_info *revs) free_patch_ids(&ids); } -static void add_to_list(struct commit_list **p, struct commit *commit, struct commit_list *n) +/* How many extra uninteresting commits we want to see.. */ +#define SLOP 5 + +static int still_interesting(struct commit_list *src, unsigned long date, int slop) { - p = &commit_list_insert(commit, p)->next; - *p = n; + /* + * No source list at all? We're definitely done.. + */ + if (!src) + return 0; + + /* + * Does the destination list contain entries with a date + * before the source list? Definitely _not_ done. + */ + if (date < src->item->date) + return SLOP; + + /* + * Does the source list still have interesting commits in + * it? Definitely not done.. + */ + if (!everybody_uninteresting(src)) + return SLOP; + + /* Ok, we're closing in.. */ + return slop-1; } static int limit_list(struct rev_info *revs) { + int slop = SLOP; + unsigned long date = ~0ul; struct commit_list *list = revs->commits; struct commit_list *newlist = NULL; struct commit_list **p = &newlist; @@ -591,16 +616,19 @@ static int limit_list(struct rev_info *revs) return -1; if (obj->flags & UNINTERESTING) { mark_parents_uninteresting(commit); - if (everybody_uninteresting(list)) { - if (revs->show_all) - add_to_list(p, commit, list); - break; - } - if (!revs->show_all) - continue; + if (revs->show_all) + p = &commit_list_insert(commit, p)->next; + slop = still_interesting(list, date, slop); + if (slop) + continue; + /* If showing all, add the whole pending list to the end */ + if (revs->show_all) + *p = list; + break; } if (revs->min_age != -1 && (commit->date > revs->min_age)) continue; + date = commit->date; p = &commit_list_insert(commit, p)->next; show = show_early_output; @@ -772,14 +800,9 @@ static void prepare_show_merge(struct rev_info *revs) add_pending_object(revs, &head->object, "HEAD"); add_pending_object(revs, &other->object, "MERGE_HEAD"); bases = get_merge_bases(head, other, 1); - while (bases) { - struct commit *it = bases->item; - struct commit_list *n = bases->next; - free(bases); - bases = n; - it->object.flags |= UNINTERESTING; - add_pending_object(revs, &it->object, "(merge-base)"); - } + add_pending_commit_list(revs, bases, UNINTERESTING); + free_commit_list(bases); + head->object.flags |= SYMMETRIC_LEFT; if (!active_nr) read_cache(); @@ -798,6 +821,7 @@ static void prepare_show_merge(struct rev_info *revs) i++; } revs->prune_data = prune; + revs->limited = 1; } int handle_revision_arg(const char *arg, struct rev_info *revs, @@ -1059,6 +1083,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch continue; } if (!strcmp(arg, "--topo-order")) { + revs->lifo = 1; revs->topo_order = 1; continue; } @@ -1174,7 +1199,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch } if (!prefixcmp(arg, "--pretty")) { revs->verbose_header = 1; - revs->commit_format = get_commit_format(arg+8); + get_commit_format(arg+8, revs); continue; } if (!strcmp(arg, "--root")) {