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

Re: [PATCH] shortlog: prompt when reading from terminal by mistake

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Mar 8, 2007, 16:37 UTC
Message-ID
<Pine.LNX.4.64.0703080827170.10832@woody.linux-foundation.org>
In-Reply-To
<7vhcsw9h8p.fsf@assigned-by-dhcp.cox.net>
On Thu, 8 Mar 2007, Junio C Hamano wrote:
> 
> Not so.  "git shortlog" acts as a filter when no revs are given,
> unlike "git log" which defaults to HEAD.  It was reading from
> its standard input.
Could we just change that?

There aren't *that* many users of "git shortlog", I bet, and I'm not sure the "filter mode" is really worth it, especially since it ends up being confusing once you get used to using it as just another "git log" variant.

It was a filter not really because people wanted a filter, but for historical reasons, and because it wasn't really able to do things on its own, and it was just an external script...

Yeah, as a filter it *can* stil lbe useful, of course, but I suspect the usefullness is limited.

> +	if (rev.pending.nr == 0) {
> +		if (isatty(0))
> +			fprintf(stderr, "(reading log to summarize from standard input)\n");

Sure, this probably gets some cases (and the one you tried in particular), but if you pipe the output to a pager, I doubt it's actually all that useful.

To simulate a "wait a long time without output" case, try this:
	( echo "Important warning" >&2 ; sleep 10) | less -S

and at least for me, I don't see squat _in_case_I'm_at_the_top_ of the window, simply because "less" will clear the screen for me.

In other words, putting warnings on stderr usually isn't all that useful when you have something like a pager that will do tty stuff - it will easily overwrite the warning so quickly that you'll never see it at all.

So I think your patch is an improvement, but I suspect it would be a bigger improvement to just make "git shortlog" work as "git log". If we want to support the filtering mode, we could just make it be a separate command ("git shortlog-filter") instead?

			Linus
Previous: Shawn O. PearceNext: Johannes Schindelin
Message 10 of 17 in “shortlog: prompt when reading from terminal by mistake”
  1. shortlog: prompt when reading from terminal by mistakeJunio C Hamano, Mar 8, 2007
  2. Johannes SchindelinMar 8, 2007
  3. Shawn O. PearceMar 8, 2007
  4. Alex RiesenMar 8, 2007
  5. Shawn O. PearceMar 9, 2007
  6. Alex RiesenMar 9, 2007
  7. Shawn O. PearceMar 9, 2007
  8. Johannes SchindelinMar 8, 2007
  9. Shawn O. PearceMar 9, 2007
  10. Linus TorvaldsMar 8, 2007
  11. Johannes SchindelinMar 8, 2007
  12. Matthieu MoyMar 8, 2007
  13. Johannes SchindelinMar 8, 2007
  14. Linus TorvaldsMar 8, 2007
  15. Johannes SchindelinMar 8, 2007
  16. Jakub NarebskiMar 9, 2007
  17. Junio C HamanoMar 10, 2007

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.