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

Re: [PATCH 1/2] diff: introduce --stat-lines to limit the stat lines

From
Junio C Hamano <gitster@pobox.com>
Date
May 1, 2011, 18:33 UTC
Message-ID
<7vmxj6s22r.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1304238428.8704.1446945897@webmail.messagingengine.com>
"Michael J Gruber" <git@drmicha.warpmail.net> writes:
Show 5 quoted lines
> On Fri, 29 Apr 2011 09:15 -0700, "Junio C Hamano" <gitster@pobox.com>
> wrote:
>> Also getting (N+1) "lines" output for specifying N feels very unnatural.
>> 
> It's actually 2*(N+1): The first and last N, plus the "..." line.

Yeah, that was what I meant, but I think my mistake itself demonstrates how unintuitive "N lines each from the top and the bottom end" is.

It shouldn't be too difficult to divide the number given by the user by 2 and adjust only one end when the given number is even, but I am not sure if that is worth doing, or if it is even a good idea to have "..." in the middle to begin with; it would make it harder to notice that the list is elided than having the marker at the end.

But what problem are you trying to solve?

If it is just you do not want to see a huge list, shouldn't that option also be controlling how --summary is produced?

> With "count" I would expect to see the first N lines/items. That's even
> simpler to do. Do you think that makes more sense then head+tail?

"Hide noise and show only a few from the top and from the bottom" makes sense when the items near the top and near the bottom are somehow more important than the others. Otherwise, "keep only a few from the top" should work just as well.

Usually, no single path is more important than the others, and even if there were a path that is more important than the others, people tend to arrange so that these more important paths come very early in the natural sort order (think "00_README"), so in that sense, items near the top could be more important than items elsewhere, while items near the bottom are unlikely to have higher nor lower importance than the remainder.

The bottom of a sorted list could become a bit more important than others in a narrow corner case that we would likely not care: when your change is only for paths whose names begin with 'a' through 'm', "show only a few from the top and from the bottom" would let you see that nothing between 'n' and 'z' was touched. I do not think it is an important piece of information to convey, though.

I designed merge.log (back then it was merge.summary) to show commits near the top because the person reading the log would be better served by seeing up to what change the merge integrated the topic branch.

A typical clean history of a topic branch tends to have necessary but uninteresting clean-up commits earier and the commits to complete the feature near the top. In the context of reading the merge itself, you care much more about why the merge was done (what the integration tree wanted out of the topic) than about how the topic progressed. Seeing the bottom (i.e. one commit above the fork point) may only be interesting for the person who is making a merge of his own topic branch, but it is not very useful for the integrator (the fork point itself may be a useful thing to know, though) nor for the reader of the history.

But the same "bottom could be a bit more important than others" argument can apply here, and I wouldn't oppose to a patch to change "merge.log" to show N-2 top entries, "...", and then a single bottom entry, when merging more than N+1 commits to your branch.

That approach would probably apply equally well to your --stat-count and covers the "the bottom is slightly more important than others" issue. It would go like this:

 - Show the first N-2 items unconditionally;
 - If you have shown N-2 items already, keep counting without
   showing, and remember the last two items you saw;
 - At the end of the loop,
   - if you didn't discard any and the last ones you remember comes
     immediately after the first N-2 items, just show them;
   - if you skipped any, show "... (%d items omitted)" and then
     show the last item.
Previous: Michael J GruberNext: Michael J Gruber
Message 6 of 21 in “diff: introduce --stat-lines to limit the stat lines”
  1. 1/2 diff: introduce --stat-lines to limit the stat linesMichael J Gruber, Apr 29, 2011
  2. 2/2 diff-options.txt: describe --stat-{width,name-width,lines}Michael J Gruber, Apr 29, 2011
  3. Michael J GruberApr 29, 2011
  4. Junio C HamanoApr 29, 2011
  5. Michael J GruberMay 1, 2011
  6. Junio C HamanoMay 1, 2011
  7. 1/2 diff: introduce --stat-lines to limit the stat linesMichael J Gruber, May 3, 2011
  8. Junio C HamanoMay 3, 2011
  9. Michael J GruberMay 4, 2011
  10. 0/3 diff.c: --stat-count=<n>Michael J Gruber, May 27, 2011
  11. 1/3 diff.c: omit hidden entries from namelen calculation with --statMichael J Gruber, May 27, 2011
  12. Junio C HamanoMay 27, 2011
  13. Michael J GruberMay 27, 2011
  14. Junio C HamanoMay 27, 2011
  15. 2/3 diff: introduce --stat-lines to limit the stat linesMichael J Gruber, May 27, 2011
  16. Junio C HamanoMay 28, 2011
  17. Michael J GruberMay 30, 2011
  18. Junio C HamanoMay 30, 2011
  19. 3/3 diff-options.txt: describe --stat-{width,name-width,count}Michael J Gruber, May 27, 2011
  20. Junio C HamanoMay 4, 2011
  21. 2/2 diff-options.txt: describe --stat-{width,name-width,count}Michael J Gruber, May 3, 2011

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.