{"thread":{"id":"1891","subject":"Make time-based commit filtering work with topological ordering","startedAt":"2005-09-20T21:00:59Z","lastAt":"2005-09-21T00:55:46Z","messageCount":4,"participants":["Linus Torvalds","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"9014","messageId":"Pine.LNX.4.58.0509201358200.2553@g5.osdl.org","threadId":"1891","inReplyTo":null,"subject":"Make time-based commit filtering work with topological ordering","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-09-20T21:00:59Z","receivedAt":"2005-09-20T21:00:59Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\nThe trick is to consider the time-based filtering a limiter, the same way \nwe do for release ranges.\n\nThat means that the time-based filtering runs _before_ the topological \nsorting, which makes it meaningful again. It also simplifies the code \nlogic.\n\nThis makes \"gitk\" useful with time ranges.\n\nSigned-off-by: Linus Torvalds <torvalds@osdl.org>\n---\ndiff --git a/rev-list.c b/rev-list.c\n--- a/rev-list.c\n+++ b/rev-list.c\n@@ -82,12 +82,6 @@ static int filter_commit(struct commit *\n \t\treturn STOP;\n \tif (commit->object.flags & (UNINTERESTING|SHOWN))\n \t\treturn CONTINUE;\n-\tif (min_age != -1 && (commit->date > min_age))\n-\t\treturn CONTINUE;\n-\tif (max_age != -1 && (commit->date < max_age)) {\n-\t\tstop_traversal=1;\n-\t\treturn merge_order?CONTINUE:STOP;\n-\t}\n \tif (max_count != -1 && !max_count--)\n \t\treturn STOP;\n \tif (no_merges && (commit->parents && commit->parents->next))\n@@ -374,6 +368,8 @@ static struct commit_list *limit_list(st\n \t\tstruct commit *commit = pop_most_recent_commit(&list, SEEN);\n \t\tstruct object *obj = &commit->object;\n \n+\t\tif (max_age != -1 && (commit->date < max_age))\n+\t\t\tobj->flags |= UNINTERESTING;\n \t\tif (unpacked && has_sha1_pack(obj->sha1))\n \t\t\tobj->flags |= UNINTERESTING;\n \t\tif (obj->flags & UNINTERESTING) {\n@@ -382,6 +378,8 @@ static struct commit_list *limit_list(st\n \t\t\t\tbreak;\n \t\t\tcontinue;\n \t\t}\n+\t\tif (min_age != -1 && (commit->date > min_age))\n+\t\t\tcontinue;\n \t\tp = &commit_list_insert(commit, p)->next;\n \t}\n \tif (tree_objects)\n@@ -494,10 +492,12 @@ int main(int argc, char **argv)\n \t\t}\n \t\tif (!strncmp(arg, \"--max-age=\", 10)) {\n \t\t\tmax_age = atoi(arg + 10);\n+\t\t\tlimited = 1;\n \t\t\tcontinue;\n \t\t}\n \t\tif (!strncmp(arg, \"--min-age=\", 10)) {\n \t\t\tmin_age = atoi(arg + 10);\n+\t\t\tlimited = 1;\n \t\t\tcontinue;\n \t\t}\n \t\tif (!strcmp(arg, \"--header\")) {\n"},{"id":"9017","messageId":"7vpsr31ii7.fsf@assigned-by-dhcp.cox.net","threadId":"1891","inReplyTo":"Pine.LNX.4.58.0509201358200.2553@g5.osdl.org","subject":"Re: Make time-based commit filtering work with topological ordering","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-09-20T22:28:32Z","receivedAt":"2005-09-20T22:28:32Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This seems to break t6001 merge-order with max-age test.\n\n* FAIL 23: --max-age=c3, --merge-order\n"},{"id":"9018","messageId":"Pine.LNX.4.58.0509201543140.2553@g5.osdl.org","threadId":"1891","inReplyTo":"7vpsr31ii7.fsf@assigned-by-dhcp.cox.net","subject":"Re: Make time-based commit filtering work with topological ordering","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-09-20T22:50:03Z","receivedAt":"2005-09-20T22:50:03Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 20 Sep 2005, Junio C Hamano wrote:\n>\n> This seems to break t6001 merge-order with max-age test.\n\nYes. \n\nMerge-order with ages doesn't make sense. I'd seriously suggest removing\n--merge-order entirely, but in the meantime I think you should remove \nanything that tests dates and merge-order.\n\nMerge-order doesn't use the normal limit rules, but does its own home-brew\nlimiting.  It could do the date-limiting on its own, if it wanted to, but \nI doubt it would make sense.\n\nTry the example I had without my patches:\n\n        [torvalds@g5 git]$ git-rev-list $(git-rev-parse --since=\"8 days ago\" HEAD) | wc\n             80      80    3280\n        [torvalds@g5 git]$ git-rev-list --topo-order $(git-rev-parse --since=\"8 days ago\" HEAD) | wc\n             10      10     410\n\nand I bet the same thing was true for --merge-order. And that's just not \n_sensible_. It doesn't make sense that a time limiter would depend on the \norder, but the way it used to be done it always did so for very \nfundamental reasons.\n\nSo the old code was broken. Any test for it was broken too.\n\n\t\tLinus\n"},{"id":"9019","messageId":"Pine.LNX.4.58.0509201745050.2553@g5.osdl.org","threadId":"1891","inReplyTo":"Pine.LNX.4.58.0509201543140.2553@g5.osdl.org","subject":"Re: Make time-based commit filtering work with topological ordering","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-09-21T00:55:46Z","receivedAt":"2005-09-21T00:55:46Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 20 Sep 2005, Linus Torvalds wrote:\n> \n> Merge-order doesn't use the normal limit rules, but does its own home-brew\n> limiting.  It could do the date-limiting on its own, if it wanted to, but \n> I doubt it would make sense.\n\nActually, looking closely, merge-order actually had it's own hack in the \nold filter_commit() code to make it work sanely. \n\nThis is an updated patch that allows merge-order to continue to work. \n\n\t\tLinus\n\n---\nSubject: Make time-based commit filtering work with topological ordering\n\nThe trick is to consider the time-based filtering a limiter, the same way\nwe do for release ranges.\n\nThat means that the time-based filtering runs _before_ the topological\nsorting, which makes it meaningful again. It also simplifies the code\nlogic.\n\nThis makes \"gitk\" useful with time ranges.\n\n[ Second version: --merge-order now unaffected by the re-org ]\n\nSigned-off-by: Linus Torvalds <torvalds@osdl.org>\n---\ndiff --git a/rev-list.c b/rev-list.c\n--- a/rev-list.c\n+++ b/rev-list.c\n@@ -86,7 +86,7 @@ static int filter_commit(struct commit *\n \t\treturn CONTINUE;\n \tif (max_age != -1 && (commit->date < max_age)) {\n \t\tstop_traversal=1;\n-\t\treturn merge_order?CONTINUE:STOP;\n+\t\treturn CONTINUE;\n \t}\n \tif (max_count != -1 && !max_count--)\n \t\treturn STOP;\n@@ -374,6 +374,8 @@ static struct commit_list *limit_list(st\n \t\tstruct commit *commit = pop_most_recent_commit(&list, SEEN);\n \t\tstruct object *obj = &commit->object;\n \n+\t\tif (max_age != -1 && (commit->date < max_age))\n+\t\t\tobj->flags |= UNINTERESTING;\n \t\tif (unpacked && has_sha1_pack(obj->sha1))\n \t\t\tobj->flags |= UNINTERESTING;\n \t\tif (obj->flags & UNINTERESTING) {\n@@ -382,6 +384,8 @@ static struct commit_list *limit_list(st\n \t\t\t\tbreak;\n \t\t\tcontinue;\n \t\t}\n+\t\tif (min_age != -1 && (commit->date > min_age))\n+\t\t\tcontinue;\n \t\tp = &commit_list_insert(commit, p)->next;\n \t}\n \tif (tree_objects)\n@@ -494,10 +498,12 @@ int main(int argc, char **argv)\n \t\t}\n \t\tif (!strncmp(arg, \"--max-age=\", 10)) {\n \t\t\tmax_age = atoi(arg + 10);\n+\t\t\tlimited = 1;\n \t\t\tcontinue;\n \t\t}\n \t\tif (!strncmp(arg, \"--min-age=\", 10)) {\n \t\t\tmin_age = atoi(arg + 10);\n+\t\t\tlimited = 1;\n \t\t\tcontinue;\n \t\t}\n \t\tif (!strcmp(arg, \"--header\")) {\n"}]}