summaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-09-29 18:59:52 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-09-29 19:07:04 (GMT)
commitbaa6378ff2106738c74213280904507d0ed8129c (patch)
treef658d6228f0bf0b4ad34c03d79de46427243b1d1 /revision.c
parent72fd13f71c18b438ca3e482c126bcbcaa2dac650 (diff)
downloadgit-baa6378ff2106738c74213280904507d0ed8129c.zip
git-baa6378ff2106738c74213280904507d0ed8129c.tar.gz
git-baa6378ff2106738c74213280904507d0ed8129c.tar.bz2
log --grep-reflog: reject the option without -g
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/revision.c b/revision.c
index 109bec1..9f5e9df 100644
--- a/revision.c
+++ b/revision.c
@@ -1908,6 +1908,8 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
if (revs->reflog_info && revs->graph)
die("cannot combine --walk-reflogs with --graph");
+ if (!revs->reflog_info && revs->grep_filter.use_reflog_filter)
+ die("cannot use --grep-reflog without --walk-reflogs");
return left;
}
@@ -2217,12 +2219,19 @@ static int commit_match(struct commit *commit, struct rev_info *opt)
struct strbuf buf = STRBUF_INIT;
if (!opt->grep_filter.pattern_list && !opt->grep_filter.header_list)
return 1;
- if (opt->reflog_info) {
+
+ /* Prepend "fake" headers as needed */
+ if (opt->grep_filter.use_reflog_filter) {
strbuf_addstr(&buf, "reflog ");
get_reflog_message(&buf, opt->reflog_info);
strbuf_addch(&buf, '\n');
- strbuf_addstr(&buf, commit->buffer);
}
+
+ /* Copy the commit to temporary if we are using "fake" headers */
+ if (buf.len)
+ strbuf_addstr(&buf, commit->buffer);
+
+ /* Find either in the commit object, or in the temporary */
if (buf.len)
retval = grep_buffer(&opt->grep_filter, buf.buf, buf.len);
else