{"thread":{"id":"12295","subject":"[PATCH] Add '--fixed-strings' option to \"git log --grep\" and friends","startedAt":"2008-02-24T15:47:08Z","lastAt":"2008-02-24T15:47:08Z","messageCount":1,"participants":["Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"69799","messageId":"200802241647.08871.jnareb@gmail.com","threadId":"12295","inReplyTo":null,"subject":"[PATCH] Add '--fixed-strings' option to \"git log --grep\" and friends","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-02-24T15:47:08Z","receivedAt":"2008-02-24T15:47:08Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Add support for -F | --fixed-strings option to \"git log --grep\"\nand friends: \"git log --author\", \"git log --committer=<pattern>\".\nCode is based on implementation of this option in \"git grep\".\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nThis would simplify ignore-case searching for a fixed string from\nwithin gitweb, as gitweb wouldn't then have to deal with differences\nin quoting and unquoting (if you quote character which doesn't need\nquoting, would git unquote it?) between searched phrase,\nbasic/extended regular expression as understood by git/by grep,\nand regular expressions in Perl (when showing matched info).\n\n[I am not sure if the above paragtaph should be added to commit\nmessage, so it is in patch comments. Feel free to add it.] \n\n\nP.S. I see that neither git-log, nor git-grep are converted to\nparseopt interface. What are plans for it, if any?\n\n Documentation/git-rev-list.txt     |    1 +\n Documentation/rev-list-options.txt |    5 +++++\n revision.c                         |   10 +++++++++-\n 3 files changed, 15 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt\nindex 5b96eab..a8d489f 100644\n--- a/Documentation/git-rev-list.txt\n+++ b/Documentation/git-rev-list.txt\n@@ -31,6 +31,7 @@ SYNOPSIS\n \t     [ \\--(author|committer|grep)=<pattern> ]\n \t     [ \\--regexp-ignore-case | \\-i ]\n \t     [ \\--extended-regexp | \\-E ]\n+\t     [ \\--fixed-strings | \\-F ]\n \t     [ \\--date={local|relative|default|iso|rfc|short} ]\n \t     [ [\\--objects | \\--objects-edge] [ \\--unpacked ] ]\n \t     [ \\--pretty | \\--header ]\ndiff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt\nindex a8138e2..259072c 100644\n--- a/Documentation/rev-list-options.txt\n+++ b/Documentation/rev-list-options.txt\n@@ -153,6 +153,11 @@ limiting may be applied.\n \tConsider the limiting patterns to be extended regular expressions\n \tinstead of the default basic regular expressions.\n \n+-F, --fixed-strings::\n+\n+\tConsider the limiting patterns to be fixed strings (don't interpret\n+\tpattern as a regular expression).\n+\n --remove-empty::\n \n \tStop when a given path disappears from the tree.\ndiff --git a/revision.c b/revision.c\nindex d3e8658..5df7961 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -942,6 +942,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch\n \tint left = 1;\n \tint all_match = 0;\n \tint regflags = 0;\n+\tint fixed = 0;\n \n \t/* First, search for \"--\" */\n \tseen_dashdash = 0;\n@@ -1238,6 +1239,11 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch\n \t\t\t\tregflags |= REG_ICASE;\n \t\t\t\tcontinue;\n \t\t\t}\n+\t\t\tif (!strcmp(arg, \"--fixed-strings\") ||\n+\t\t\t    !strcmp(arg, \"-F\")) {\n+\t\t\t\tfixed = 1;\n+\t\t\t\tcontinue;\n+\t\t\t}\n \t\t\tif (!strcmp(arg, \"--all-match\")) {\n \t\t\t\tall_match = 1;\n \t\t\t\tcontinue;\n@@ -1293,8 +1299,10 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch\n \t\t}\n \t}\n \n-\tif (revs->grep_filter)\n+\tif (revs->grep_filter) {\n \t\trevs->grep_filter->regflags |= regflags;\n+\t\trevs->grep_filter->fixed = fixed;\n+\t}\n \n \tif (show_merge)\n \t\tprepare_show_merge(revs);\n-- \n1.5.4.2\n"}]}