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>
This commit is contained in:
parent
c1babb1d65
commit
27cfe2e2dc
@ -86,7 +86,7 @@ static int filter_commit(struct commit * commit)
|
|||||||
return CONTINUE;
|
return CONTINUE;
|
||||||
if (max_age != -1 && (commit->date < max_age)) {
|
if (max_age != -1 && (commit->date < max_age)) {
|
||||||
stop_traversal=1;
|
stop_traversal=1;
|
||||||
return merge_order?CONTINUE:STOP;
|
return CONTINUE;
|
||||||
}
|
}
|
||||||
if (max_count != -1 && !max_count--)
|
if (max_count != -1 && !max_count--)
|
||||||
return STOP;
|
return STOP;
|
||||||
@ -374,6 +374,8 @@ static struct commit_list *limit_list(struct commit_list *list)
|
|||||||
struct commit *commit = pop_most_recent_commit(&list, SEEN);
|
struct commit *commit = pop_most_recent_commit(&list, SEEN);
|
||||||
struct object *obj = &commit->object;
|
struct object *obj = &commit->object;
|
||||||
|
|
||||||
|
if (max_age != -1 && (commit->date < max_age))
|
||||||
|
obj->flags |= UNINTERESTING;
|
||||||
if (unpacked && has_sha1_pack(obj->sha1))
|
if (unpacked && has_sha1_pack(obj->sha1))
|
||||||
obj->flags |= UNINTERESTING;
|
obj->flags |= UNINTERESTING;
|
||||||
if (obj->flags & UNINTERESTING) {
|
if (obj->flags & UNINTERESTING) {
|
||||||
@ -382,6 +384,8 @@ static struct commit_list *limit_list(struct commit_list *list)
|
|||||||
break;
|
break;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (min_age != -1 && (commit->date > min_age))
|
||||||
|
continue;
|
||||||
p = &commit_list_insert(commit, p)->next;
|
p = &commit_list_insert(commit, p)->next;
|
||||||
}
|
}
|
||||||
if (tree_objects)
|
if (tree_objects)
|
||||||
@ -494,10 +498,12 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
if (!strncmp(arg, "--max-age=", 10)) {
|
if (!strncmp(arg, "--max-age=", 10)) {
|
||||||
max_age = atoi(arg + 10);
|
max_age = atoi(arg + 10);
|
||||||
|
limited = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!strncmp(arg, "--min-age=", 10)) {
|
if (!strncmp(arg, "--min-age=", 10)) {
|
||||||
min_age = atoi(arg + 10);
|
min_age = atoi(arg + 10);
|
||||||
|
limited = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!strcmp(arg, "--header")) {
|
if (!strcmp(arg, "--header")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user