aboutsummaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@osdl.org>2006-09-18 10:07:51 -0700
committerJunio C Hamano <junkio@cox.net>2006-09-20 11:14:39 -0700
commita2ed6ae402582a3ee76e9b4639848eba261a12de (patch)
tree8cac99a9d0a1520ca790208d953306084d6e0d46 /revision.c
parentf69895fb0c5921f5b399f35a71caa9a023776ddf (diff)
downloadgit-a2ed6ae402582a3ee76e9b4639848eba261a12de.tar.gz
git-a2ed6ae402582a3ee76e9b4639848eba261a12de.tar.xz
git-log --author and --committer are not left-anchored by default
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>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/revision.c b/revision.c
index 26dd41873..bca122961 100644
--- a/revision.c
+++ b/revision.c
@@ -677,6 +677,7 @@ int handle_revision_arg(const char *arg, struct rev_info *revs,
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);
}