@matheusbsbs / matheus-bagliano / commits / dc1c0fffd3
Fork 0

Add '--fixed-strings' option to "git log --grep" and friends

Add support for -F | --fixed-strings option to "git log --grep" and friends: "git log --author", "git log --committer=<pattern>". Code is based on implementation of this option in "git grep". Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jakub Narebski committed Feb 26, 2008 at 13:22 UTC dc1c0fffd3723ceebff51053938db5baf26a47f5
3 files changed +15 -1
Documentation/git-rev-list.txt
+1
@@ -31,6 +31,7 @@ SYNOPSIS
31 [ \--(author|committer|grep)=<pattern> ]
32 [ \--regexp-ignore-case | \-i ]
33 [ \--extended-regexp | \-E ]
34 + [ \--fixed-strings | \-F ]
35 [ \--date={local|relative|default|iso|rfc|short} ]
36 [ [\--objects | \--objects-edge] [ \--unpacked ] ]
37 [ \--pretty | \--header ]
Documentation/rev-list-options.txt
+5
@@ -153,6 +153,11 @@ limiting may be applied.
153 Consider the limiting patterns to be extended regular expressions
154 instead of the default basic regular expressions.
155
156 +-F, --fixed-strings::
157 +
158 + Consider the limiting patterns to be fixed strings (don't interpret
159 + pattern as a regular expression).
160 +
161 --remove-empty::
162
163 Stop when a given path disappears from the tree.
revision.c
+9 -1
@@ -942,6 +942,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
942 int left = 1;
943 int all_match = 0;
944 int regflags = 0;
945 + int fixed = 0;
946
947 /* First, search for "--" */
948 seen_dashdash = 0;
@@ -1238,6 +1239,11 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
1239 regflags |= REG_ICASE;
1240 continue;
1241 }
1242 + if (!strcmp(arg, "--fixed-strings") ||
1243 + !strcmp(arg, "-F")) {
1244 + fixed = 1;
1245 + continue;
1246 + }
1247 if (!strcmp(arg, "--all-match")) {
1248 all_match = 1;
1249 continue;
@@ -1293,8 +1299,10 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
1299 }
1300 }
1301
1296 - if (revs->grep_filter)
1302 + if (revs->grep_filter) {
1303 revs->grep_filter->regflags |= regflags;
1304 + revs->grep_filter->fixed = fixed;
1305 + }
1306
1307 if (show_merge)
1308 prepare_show_merge(revs);