diff options
author | Junio C Hamano <gitster@pobox.com> | 2007-12-11 10:09:04 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-12-11 17:01:31 -0800 |
commit | 3384a2dfc12f0fecd25ecfd6bfa9ee0d82517bf2 (patch) | |
tree | d9a4d8565acee4ff9423178442f87b1efe815c14 /builtin-shortlog.c | |
parent | Invert numbers and names in the git-shortlog summary mode. (diff) | |
download | tgif-3384a2dfc12f0fecd25ecfd6bfa9ee0d82517bf2.tar.xz |
shortlog: default to HEAD when the standard input is a tty
Instead of warning the user that it is expecting git log output from
the standard input (and waiting for the user to type the log from
the keyboard, which is a silly thing to do), default to traverse from
HEAD when there is no rev parameter given and the standard input is
a tty.
This factors out a useful helper "add_head()" from builtin-diff.c to a
more appropriate place revision.c while renaming it to more descriptive
name add_head_to_pending(), as that is what the function is about.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-shortlog.c')
-rw-r--r-- | builtin-shortlog.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin-shortlog.c b/builtin-shortlog.c index 90666cbd78..3d8d7094ab 100644 --- a/builtin-shortlog.c +++ b/builtin-shortlog.c @@ -249,9 +249,10 @@ int cmd_shortlog(int argc, const char **argv, const char *prefix) read_mailmap(&mailmap, ".mailmap", &common_repo_prefix); + /* assume HEAD if from a tty */ + if (!rev.pending.nr && isatty(0)) + add_head_to_pending(&rev); if (rev.pending.nr == 0) { - if (isatty(0)) - fprintf(stderr, "(reading log to summarize from standard input)\n"); read_from_stdin(&list); } else |