@matheusbsbs / matheus-bagliano / commits / 3731449591
Fork 0

shortlog: warn the user when there is no input

A simple "git shortlog" outside of a git repository stalls waiting for an input. Check if that's the case by testing with isatty() before read_from_stdin(), and warn the user like "git commit" does in a similar case. Signed-off-by: Michele Ballabio <barra_cuda@katamail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michele Ballabio committed Feb 24, 2010 at 21:49 UTC 3731449591130b2f5ca7257c46721785a6340a18
1 file changed +2
builtin-shortlog.c
+2
@@ -295,6 +295,8 @@ parse_done:
295 if (!nongit && !rev.pending.nr && isatty(0))
296 add_head_to_pending(&rev);
297 if (rev.pending.nr == 0) {
298 + if (isatty(0))
299 + fprintf(stderr, "(reading log message from standard input)\n");
300 read_from_stdin(&log);
301 }
302 else