summaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-09-04 22:30:44 -0700
committerJunio C Hamano <gitster@pobox.com>2008-09-04 22:30:44 -0700
commit80d12c23de4fbddfaee2f9bf7fe809f57d02e171 (patch)
tree572105c1fe83cbe98645ea37ca7b6f6b7163e1ad /revision.c
parent1b23adadf3adcf0074f61a498479a471964ab8c3 (diff)
parenta4d7d2c6dbc9e1294034171c31d87b24cf3b492e (diff)
downloadgit-80d12c23de4fbddfaee2f9bf7fe809f57d02e171.tar.gz
Merge branch 'jc/maint-log-grep'
* jc/maint-log-grep: log --author/--committer: really match only with name part diff --cumulative is a sub-option of --dirstat bash completion: Hide more plumbing commands
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/revision.c b/revision.c
index bcbc7bd7e4..499f0e0225 100644
--- a/revision.c
+++ b/revision.c
@@ -953,22 +953,9 @@ static void add_grep(struct rev_info *revs, const char *ptn, enum grep_pat_token
append_grep_pattern(&revs->grep_filter, ptn, "command line", 0, what);
}
-static void add_header_grep(struct rev_info *revs, const char *field, const char *pattern)
+static void add_header_grep(struct rev_info *revs, enum grep_header_field field, const char *pattern)
{
- char *pat;
- const char *prefix;
- int patlen, fldlen;
-
- fldlen = strlen(field);
- patlen = strlen(pattern);
- pat = xmalloc(patlen + fldlen + 10);
- prefix = ".*";
- if (*pattern == '^') {
- prefix = "";
- pattern++;
- }
- sprintf(pat, "^%s %s%s", field, prefix, pattern);
- add_grep(revs, pat, GREP_PATTERN_HEAD);
+ append_header_grep_pattern(&revs->grep_filter, field, pattern);
}
static void add_message_grep(struct rev_info *revs, const char *pattern)
@@ -1159,9 +1146,9 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
* Grepping the commit log
*/
else if (!prefixcmp(arg, "--author=")) {
- add_header_grep(revs, "author", arg+9);
+ add_header_grep(revs, GREP_HEADER_AUTHOR, arg+9);
} else if (!prefixcmp(arg, "--committer=")) {
- add_header_grep(revs, "committer", arg+12);
+ add_header_grep(revs, GREP_HEADER_COMMITTER, arg+12);
} else if (!prefixcmp(arg, "--grep=")) {
add_message_grep(revs, arg+7);
} else if (!strcmp(arg, "--extended-regexp") || !strcmp(arg, "-E")) {