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>
This commit is contained in:

committed by
Junio C Hamano

parent
e923eaeb90
commit
3731449591
@ -295,6 +295,8 @@ parse_done:
|
|||||||
if (!nongit && !rev.pending.nr && isatty(0))
|
if (!nongit && !rev.pending.nr && isatty(0))
|
||||||
add_head_to_pending(&rev);
|
add_head_to_pending(&rev);
|
||||||
if (rev.pending.nr == 0) {
|
if (rev.pending.nr == 0) {
|
||||||
|
if (isatty(0))
|
||||||
|
fprintf(stderr, "(reading log message from standard input)\n");
|
||||||
read_from_stdin(&log);
|
read_from_stdin(&log);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user