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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
---
 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]