Skip to content

Commit

Permalink
git-rev-list: Add regexp tuning options
Browse files Browse the repository at this point in the history
This patch introduces --extended-regexp and --regexp-ignore-case options to
tune what kind of patterns the pattern-limiting options (--grep, --author,
...) accept.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Petr Baudis authored and Junio C Hamano committed May 21, 2007
1 parent 77e4e8b commit 93d496a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Documentation/git-rev-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ SYNOPSIS
[ \--cherry-pick ]
[ \--encoding[=<encoding>] ]
[ \--(author|committer|grep)=<pattern> ]
[ \--regexp-ignore-case ] [ \--extended-regexp ]
[ \--date={local|relative|default} ]
[ [\--objects | \--objects-edge] [ \--unpacked ] ]
[ \--pretty | \--header ]
Expand Down Expand Up @@ -214,6 +215,15 @@ limiting may be applied.
Limit the commits output to ones with log message that
matches the specified pattern (regular expression).

--regexp-ignore-case::

Match the regexp limiting patterns without regard to letters case.

--extended-regexp::

Consider the limiting patterns to be extended regular expressions
instead of the default basic regular expressions.

--remove-empty::

Stop when a given path disappears from the tree.
Expand Down
12 changes: 12 additions & 0 deletions revision.c
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
const char **unrecognized = argv + 1;
int left = 1;
int all_match = 0;
int regflags = 0;

/* First, search for "--" */
seen_dashdash = 0;
Expand Down Expand Up @@ -1152,6 +1153,14 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
add_message_grep(revs, arg+7);
continue;
}
if (!prefixcmp(arg, "--extended-regexp")) {
regflags |= REG_EXTENDED;
continue;
}
if (!prefixcmp(arg, "--regexp-ignore-case")) {
regflags |= REG_ICASE;
continue;
}
if (!strcmp(arg, "--all-match")) {
all_match = 1;
continue;
Expand Down Expand Up @@ -1200,6 +1209,9 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
}
}

if (revs->grep_filter)
revs->grep_filter->regflags |= regflags;

if (show_merge)
prepare_show_merge(revs);
if (def && !revs->pending.nr) {
Expand Down

0 comments on commit 93d496a

Please sign in to comment.