Re: [PATCH 3/3] revision: make --grep search in notes too if shown

2012-09-28 Thread Junio C Hamano
Nguyễn Thái Ngọc Duy pclo...@gmail.com writes:

 Notes are shown after commit body. From user perspective it looks
 pretty much like commit body and they may assume --grep would search
 in that part too. Make it so.

 Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com
 ---
  On Fri, Sep 28, 2012 at 1:16 AM, Junio C Hamano gits...@pobox.com
  wrote:
   The output from log --show-notes, on the other hand, is even more
   conflated and a casual user would view it as part of the message,
   so
   I would imagine that if we ever do the extention to cover notes
   data, the normal --grep should apply to it.

  Something like this?

Yes, that was what I had in mind.

  revision.c | 6 ++
  1 file changed, 6 insertions(+)

 diff --git a/revision.c b/revision.c
 index cfa0e2e..febb4d7 100644
 --- a/revision.c
 +++ b/revision.c
 @@ -2223,6 +2223,12 @@ static int commit_match(struct commit *commit, struct 
 rev_info *opt)
   strbuf_addch(buf, '\n');
   strbuf_addstr(buf, commit-buffer);
   }
 + if (opt-show_notes) {
 + if (!buf.len)
 + strbuf_addstr(buf, commit-buffer);
 + format_display_notes(commit-object.sha1, buf,
 +  get_log_output_encoding(), 0);
 + }
   if (buf.len)
   retval = grep_buffer(opt-grep_filter, buf.buf, buf.len);
   else
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] revision: make --grep search in notes too if shown

2012-09-28 Thread Nguyễn Thái Ngọc Duy
Notes are shown after commit body. From user perspective it looks
pretty much like commit body and they may assume --grep would search
in that part too. Make it so.

Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com
---
 revision.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/revision.c b/revision.c
index 109bec1..dff6fb7 100644
--- a/revision.c
+++ b/revision.c
@@ -2223,6 +2223,12 @@ static int commit_match(struct commit *commit, struct 
rev_info *opt)
strbuf_addch(buf, '\n');
strbuf_addstr(buf, commit-buffer);
}
+   if (opt-show_notes) {
+   if (!buf.len)
+   strbuf_addstr(buf, commit-buffer);
+   format_display_notes(commit-object.sha1, buf,
+get_log_output_encoding(), 0);
+   }
if (buf.len)
retval = grep_buffer(opt-grep_filter, buf.buf, buf.len);
else
-- 
1.7.12.1.406.g6ab07c4

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html