revision traversal: prepare for commit log match.
This is from a suggestion by Linus, just to mark the locations where we need to modify to actually implement the filtering. We do not have any actual filtering code yet. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Sep 17, 2006 at 15:43 UTC
8ecae9b032cd0427079d557a3bb6c39116420d4b
2 files changed
+17
revision.c
+13
@@ -6,6 +6,8 @@
6
#include "diff.h"
7
#include "refs.h"
8
#include "revision.h"
9
+#include <regex.h>
10
+#include "grep.h"
11
12
static char *path_name(struct name_path *path, const char *name)
13
{
@@ -1045,6 +1047,15 @@ static void mark_boundary_to_show(struct commit *commit)
1047
}
1048
}
1049
1050
+static int commit_match(struct commit *commit, struct rev_info *opt)
1051
+{
1052
+ if (!opt->header_filter && !opt->message_filter)
1053
+ return 1;
1054
+
1055
+ /* match it here */
1056
+ return 1;
1057
+}
1058
+
1059
struct commit *get_revision(struct rev_info *revs)
1060
{
1061
struct commit_list *list = revs->commits;
@@ -1105,6 +1116,8 @@ struct commit *get_revision(struct rev_info *revs)
1116
if (revs->no_merges &&
1117
commit->parents && commit->parents->next)
1118
continue;
1119
+ if (!commit_match(commit, revs))
1120
+ continue;
1121
if (revs->prune_fn && revs->dense) {
1122
/* Commit without changes? */
1123
if (!(commit->object.flags & TREECHANGE)) {
revision.h
+4
@@ -71,6 +71,10 @@ struct rev_info {
71
const char *add_signoff;
72
const char *extra_headers;
73
74
+ /* Filter by commit log message */
75
+ struct grep_opt *header_filter;
76
+ struct grep_opt *message_filter;
77
+
78
/* special limits */
79
int max_count;
80
unsigned long max_age;