summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f69895f)
raw | patch | inline | side by side (parent: f69895f)
author | Linus Torvalds <torvalds@osdl.org> | |
Mon, 18 Sep 2006 17:07:51 +0000 (10:07 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 20 Sep 2006 18:14:39 +0000 (11:14 -0700) |
I know that I'd prefer a rule where
"--author=^Junio"
would result in the grep-pattern being "^author Junio", but without the
initial '^' it would be "^author .*Junio".
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
"--author=^Junio"
would result in the grep-pattern being "^author Junio", but without the
initial '^' it would be "^author .*Junio".
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
revision.c | patch | blob | history |
diff --git a/revision.c b/revision.c
index 26dd41873484fdeed9d2bd4825c1a03e2b2553bc..bca122961e0fded660f34e65659d93f00c91bdfc 100644 (file)
--- a/revision.c
+++ b/revision.c
static void add_header_grep(struct rev_info *revs, const char *field, const char *pattern)
{
char *pat;
+ const char *prefix;
int patlen, fldlen;
if (!revs->header_filter) {
@@ -689,8 +690,13 @@ static void add_header_grep(struct rev_info *revs, const char *field, const char
fldlen = strlen(field);
patlen = strlen(pattern);
- pat = xmalloc(patlen + fldlen + 3);
- sprintf(pat, "^%s %s", field, pattern);
+ pat = xmalloc(patlen + fldlen + 10);
+ prefix = ".*";
+ if (*pattern == '^') {
+ prefix = "";
+ pattern++;
+ }
+ sprintf(pat, "^%s %s%s", field, prefix, pattern);
append_grep_pattern(revs->header_filter, pat,
"command line", 0, GREP_PATTERN);
}