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

[PATCH] shortlog: do not stall when there is no input

From
Michele Ballabio <barra_cuda@katamail.com>
Date
Feb 24, 2010, 19:20 UTC
Message-ID
<201002242020.27801.barra_cuda@katamail.com>

A simple "git shortlog" outside of a git repository used to stall waiting for an input. Fix this by testing with isatty() before calling read_from_stdin().

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
---
 builtin-shortlog.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/builtin-shortlog.c b/builtin-shortlog.c
index b3b055f..ff5dca6 100644
--- a/builtin-shortlog.c
+++ b/builtin-shortlog.c
@@ -294,9 +294,8 @@ parse_done:
 	/* assume HEAD if from a tty */
 	if (!nongit && !rev.pending.nr && isatty(0))
 		add_head_to_pending(&rev);
-	if (rev.pending.nr == 0) {
+	if (rev.pending.nr == 0 && !isatty(0))
 		read_from_stdin(&log);
-	}
 	else
 		get_from_rev(&rev, &log);
 
-- 
1.7.0
Next: Junio C Hamano
Message 1 of 3 in “shortlog: do not stall when there is no input”
  1. shortlog: do not stall when there is no inputMichele Ballabio, Feb 24, 2010
  2. Junio C HamanoFeb 24, 2010
  3. shortlog: warn the user when there is no inputMichele Ballabio, Feb 24, 2010

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.