@matheusbsbs / matheus-bagliano / commits / 27cfe2e2dc
Fork 0

Make time-based commit filtering work with topological ordering.

The trick is to consider the time-based filtering a limiter, the same way we do for release ranges. That means that the time-based filtering runs _before_ the topological sorting, which makes it meaningful again. It also simplifies the code logic. This makes "gitk" useful with time ranges. [ Second version: --merge-order now unaffected by the re-org ] Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Linus Torvalds committed Sep 20, 2005 at 17:55 UTC 27cfe2e2dcbfc4f6c6288ed4eafd077e232c2ab1
1 file changed +7 -1
rev-list.c
+7 -1
@@ -86,7 +86,7 @@ static int filter_commit(struct commit * commit)
86 return CONTINUE;
87 if (max_age != -1 && (commit->date < max_age)) {
88 stop_traversal=1;
89 - return merge_order?CONTINUE:STOP;
89 + return CONTINUE;
90 }
91 if (max_count != -1 && !max_count--)
92 return STOP;
@@ -374,6 +374,8 @@ static struct commit_list *limit_list(struct commit_list *list)
374 struct commit *commit = pop_most_recent_commit(&list, SEEN);
375 struct object *obj = &commit->object;
376
377 + if (max_age != -1 && (commit->date < max_age))
378 + obj->flags |= UNINTERESTING;
379 if (unpacked && has_sha1_pack(obj->sha1))
380 obj->flags |= UNINTERESTING;
381 if (obj->flags & UNINTERESTING) {
@@ -382,6 +384,8 @@ static struct commit_list *limit_list(struct commit_list *list)
384 break;
385 continue;
386 }
387 + if (min_age != -1 && (commit->date > min_age))
388 + continue;
389 p = &commit_list_insert(commit, p)->next;
390 }
391 if (tree_objects)
@@ -494,10 +498,12 @@ int main(int argc, char **argv)
498 }
499 if (!strncmp(arg, "--max-age=", 10)) {
500 max_age = atoi(arg + 10);
501 + limited = 1;
502 continue;
503 }
504 if (!strncmp(arg, "--min-age=", 10)) {
505 min_age = atoi(arg + 10);
506 + limited = 1;
507 continue;
508 }
509 if (!strcmp(arg, "--header")) {