Skip to content

Commit

Permalink
revision traversal: prepare for commit log match.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Sep 20, 2006
1 parent 83b5d2f commit 8ecae9b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
13 changes: 13 additions & 0 deletions revision.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include "diff.h"
#include "refs.h"
#include "revision.h"
#include <regex.h>
#include "grep.h"

static char *path_name(struct name_path *path, const char *name)
{
Expand Down Expand Up @@ -1045,6 +1047,15 @@ static void mark_boundary_to_show(struct commit *commit)
}
}

static int commit_match(struct commit *commit, struct rev_info *opt)
{
if (!opt->header_filter && !opt->message_filter)
return 1;

/* match it here */
return 1;
}

struct commit *get_revision(struct rev_info *revs)
{
struct commit_list *list = revs->commits;
Expand Down Expand Up @@ -1105,6 +1116,8 @@ struct commit *get_revision(struct rev_info *revs)
if (revs->no_merges &&
commit->parents && commit->parents->next)
continue;
if (!commit_match(commit, revs))
continue;
if (revs->prune_fn && revs->dense) {
/* Commit without changes? */
if (!(commit->object.flags & TREECHANGE)) {
Expand Down
4 changes: 4 additions & 0 deletions revision.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ struct rev_info {
const char *add_signoff;
const char *extra_headers;

/* Filter by commit log message */
struct grep_opt *header_filter;
struct grep_opt *message_filter;

/* special limits */
int max_count;
unsigned long max_age;
Expand Down

0 comments on commit 8ecae9b

Please sign in to comment.