@matheusbsbs / matheus-bagliano / commits / 93d496a560
Fork 0

git-rev-list: Add regexp tuning options

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>

Petr Baudis committed May 19, 2007 at 02:13 UTC 93d496a560cdcd4f72c8dee1b0b2efa324e1c3bb
2 files changed +22
Documentation/git-rev-list.txt
+10
@@ -25,6 +25,7 @@ SYNOPSIS
25 [ \--cherry-pick ]
26 [ \--encoding[=<encoding>] ]
27 [ \--(author|committer|grep)=<pattern> ]
28 + [ \--regexp-ignore-case ] [ \--extended-regexp ]
29 [ \--date={local|relative|default} ]
30 [ [\--objects | \--objects-edge] [ \--unpacked ] ]
31 [ \--pretty | \--header ]
@@ -214,6 +215,15 @@ limiting may be applied.
215 Limit the commits output to ones with log message that
216 matches the specified pattern (regular expression).
217
218 +--regexp-ignore-case::
219 +
220 + Match the regexp limiting patterns without regard to letters case.
221 +
222 +--extended-regexp::
223 +
224 + Consider the limiting patterns to be extended regular expressions
225 + instead of the default basic regular expressions.
226 +
227 --remove-empty::
228
229 Stop when a given path disappears from the tree.
revision.c
+12
@@ -881,6 +881,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
881 const char **unrecognized = argv + 1;
882 int left = 1;
883 int all_match = 0;
884 + int regflags = 0;
885
886 /* First, search for "--" */
887 seen_dashdash = 0;
@@ -1152,6 +1153,14 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
1153 add_message_grep(revs, arg+7);
1154 continue;
1155 }
1156 + if (!prefixcmp(arg, "--extended-regexp")) {
1157 + regflags |= REG_EXTENDED;
1158 + continue;
1159 + }
1160 + if (!prefixcmp(arg, "--regexp-ignore-case")) {
1161 + regflags |= REG_ICASE;
1162 + continue;
1163 + }
1164 if (!strcmp(arg, "--all-match")) {
1165 all_match = 1;
1166 continue;
@@ -1200,6 +1209,9 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
1209 }
1210 }
1211
1212 + if (revs->grep_filter)
1213 + revs->grep_filter->regflags |= regflags;
1214 +
1215 if (show_merge)
1216 prepare_show_merge(revs);
1217 if (def && !revs->pending.nr) {