git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
To: Junio C Hamano <gitster@pobox.com>
Cc: Mark Lodato <lodatom@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH 0/4] grep: add more information to hunk separators
Date: Mon, 26 Mar 2012 18:16:43 +0200	[thread overview]
Message-ID: <4F70966B.4050107@lsrfire.ath.cx> (raw)
In-Reply-To: <7vr4wgq6zm.fsf@alter.siamese.dyndns.org>

Am 26.03.2012 07:14, schrieb Junio C Hamano:
> 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.

Human readers can differentiate between contents and heading by color; 
separators are cyan by default.

A separate frontend would probably have to implement match highlighting 
again.  That's not too hard, but a bit sad.

> In other words, I am not yet convinced this belongs to "git grep" proper.

All in all, I'm not sure either.  But I think the idea to deduplicate 
the meta-information and give found content more screen real estate is a 
good one in general.

René

  reply	other threads:[~2012-03-26 16:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-26  2:41 [PATCH 0/4] grep: add more information to hunk separators Mark Lodato
2012-03-26  2:41 ` [PATCH 1/4] grep doc: add --break / --heading / -W to synopsis Mark Lodato
2012-03-26  2:41 ` [PATCH 2/4] add tests for grep --heading with context Mark Lodato
2012-03-26  2:41 ` [PATCH 3/4] grep: move code to print hunk markers after heading Mark Lodato
2012-03-26  2:41 ` [PATCH 4/4] grep: add --hunk-heading option Mark Lodato
2012-03-26  5:14 ` [PATCH 0/4] grep: add more information to hunk separators Junio C Hamano
2012-03-26 16:16   ` René Scharfe [this message]
2012-03-26 18:05     ` Junio C Hamano
2012-03-26 18:48   ` Bert Wesarg
2012-03-26 16:16 ` René Scharfe
2012-03-26 18:01   ` Junio C Hamano
2012-03-26 21:12     ` René Scharfe
2012-03-26 21:19       ` Junio C Hamano
2012-03-27  5:31 ` [PATCH 5/4] move sane_truncate_line to utf8_truncate_line Mark Lodato
2012-03-27  5:31 ` [PATCH 6/4] add grep.hunkHeadingFunction option Mark Lodato

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F70966B.4050107@lsrfire.ath.cx \
    --to=rene.scharfe@lsrfire.ath.cx \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=lodatom@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).