{"thread":{"id":"5593","subject":"[PATCH 2/3] revision traversal: prepare for commit log match.","startedAt":"2006-09-18T00:42:25Z","lastAt":"2006-09-18T00:42:25Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"27100","messageId":"7vac4yyphq.fsf@assigned-by-dhcp.cox.net","threadId":"5593","inReplyTo":null,"subject":"[PATCH 2/3] revision traversal: prepare for commit log match.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-09-18T00:42:25Z","receivedAt":"2006-09-18T00:42:25Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This is from a suggestion by Linus, just to mark the locations where we\nneed to modify to actually implement the filtering.\n\nWe do not have any actual filtering code yet.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n revision.c |   13 +++++++++++++\n revision.h |    4 ++++\n 2 files changed, 17 insertions(+), 0 deletions(-)\n\ndiff --git a/revision.c b/revision.c\nindex db01682..8fda20d 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -6,6 +6,8 @@ #include \"commit.h\"\n #include \"diff.h\"\n #include \"refs.h\"\n #include \"revision.h\"\n+#include <regex.h>\n+#include \"grep.h\"\n \n static char *path_name(struct name_path *path, const char *name)\n {\n@@ -1026,6 +1028,15 @@ static void mark_boundary_to_show(struct\n \t}\n }\n \n+static int commit_match(struct commit *commit, struct rev_info *opt)\n+{\n+\tif (!opt->header_filter && !opt->message_filter)\n+\t\treturn 1;\n+\n+\t/* match it here */\n+\treturn 1;\n+}\n+\n struct commit *get_revision(struct rev_info *revs)\n {\n \tstruct commit_list *list = revs->commits;\n@@ -1085,6 +1096,8 @@ struct commit *get_revision(struct rev_i\n \t\tif (revs->no_merges &&\n \t\t    commit->parents && commit->parents->next)\n \t\t\tcontinue;\n+\t\tif (!commit_match(commit, revs))\n+\t\t\tcontinue;\n \t\tif (revs->prune_fn && revs->dense) {\n \t\t\t/* Commit without changes? */\n \t\t\tif (!(commit->object.flags & TREECHANGE)) {\ndiff --git a/revision.h b/revision.h\nindex c1f71af..35a1db4 100644\n--- a/revision.h\n+++ b/revision.h\n@@ -67,6 +67,10 @@ struct rev_info {\n \tconst char\t*add_signoff;\n \tconst char\t*extra_headers;\n \n+\t/* Filter by commit log message */\n+\tstruct grep_opt\t*header_filter;\n+\tstruct grep_opt\t*message_filter;\n+\n \t/* special limits */\n \tint max_count;\n \tunsigned long max_age;\n-- \n1.4.2.1.g414e5\n"}]}