Skip to content

Commit

Permalink
git-log --author and --committer are not left-anchored by default
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Linus Torvalds authored and Junio C Hamano committed Sep 20, 2006
1 parent f69895f commit a2ed6ae
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions revision.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
}
Expand Down

0 comments on commit a2ed6ae

Please sign in to comment.