git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 0/4] grep: add more information to hunk separators

From
Bert Wesarg <bert.wesarg@googlemail.com>
Date
Mar 26, 2012, 18:48 UTC
Message-ID
<CAKPyHN25miyA6A0p3GMX9XrxnqLu0C9H6VjjCy_HvKfqXo4B2g@mail.gmail.com>
In-Reply-To
<7vr4wgq6zm.fsf@alter.siamese.dyndns.org>
On Mon, Mar 26, 2012 at 07:14, Junio C Hamano <gitster@pobox.com> wrote:
Show 25 quoted lines
> Mark Lodato <lodatom@gmail.com> writes:
>
>> Originally, I had envisioned also moving the function name (`-p') to the hunk
>> header, similar to the diff context line.  For example:
>>
>>     -- git.c:570 -- int main(int argc, char argv)
>>                     printf("usage: %s\n\n", git_usage_string);
>>                     list_common_cmds_help();
>>                     printf("\n%s\n", git_more_info_string);
>>
>> After implementing this feature, I was not happy with the result and
>> subsequently removed it.  To me, the output was too cluttered and the line
>> number was ambigous.  For example, in the above, it is not obvious to me that
>> line 570 is the "printf" line and not the "int main" line.  Still, if you
>> would like to see the patch to implement this feature, please let me know.
>
> The worst part of all of the above is that the output becomes utterly
> ambiguous and the reader cannot tell if "-- git.c..." came because the
> file had such a line that begin with two dashes in it and grep found it,
> or it is your output format embellishment. It is obvious that these are
> not meant to be machine parseable, but if the goal is to make the output
> more useful to the humans, then it may be a better approach to come up
> with a front end that reads our machine readable output and shows output
> with its own embellishments. You could even make it an interactive front
> end.
FYI, I once posted a git-gui grep prototype:
<1289770869-11665-1-git-send-email-bert.wesarg@googlemail.com>

I have since added it to git-gui, see bw/master~2 'git-gui: add grep tab' in http://repo.or.cz/w/git-gui/bertw.git.

Bert
>
> In other words, I am not yet convinced this belongs to "git grep" proper.
>
>
Previous: Junio C HamanoNext: René Scharfe
Message 9 of 15 in “grep: add more information to hunk separators”
  1. 0/4 grep: add more information to hunk separatorsMark Lodato, Mar 26, 2012
  2. 1/4 grep doc: add --break / --heading / -W to synopsisMark Lodato, Mar 26, 2012
  3. 2/4 add tests for grep --heading with contextMark Lodato, Mar 26, 2012
  4. 3/4 grep: move code to print hunk markers after headingMark Lodato, Mar 26, 2012
  5. 4/4 grep: add --hunk-heading optionMark Lodato, Mar 26, 2012
  6. Junio C HamanoMar 26, 2012
  7. René ScharfeMar 26, 2012
  8. Junio C HamanoMar 26, 2012
  9. Bert WesargMar 26, 2012
  10. René ScharfeMar 26, 2012
  11. Junio C HamanoMar 26, 2012
  12. René ScharfeMar 26, 2012
  13. Junio C HamanoMar 26, 2012
  14. 5/4 move sane_truncate_line to utf8_truncate_lineMark Lodato, Mar 27, 2012
  15. 6/4 add grep.hunkHeadingFunction optionMark Lodato, Mar 27, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.