X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-shortlog.c;h=e6a2865019cceadfcbfc8575a2bd1f97b7159dcb;hb=dc0f70541503e9006ac2fe812591b080c169c572;hp=af31abaaf862bb85a72e8052cf28a874d34c714a;hpb=eadbcd498a18d60467883aeb6c0726048e7382a2;p=git.git diff --git a/builtin-shortlog.c b/builtin-shortlog.c index af31abaaf..e6a286501 100644 --- a/builtin-shortlog.c +++ b/builtin-shortlog.c @@ -9,7 +9,7 @@ #include "shortlog.h" static const char shortlog_usage[] = -"git-shortlog [-n] [-s] [-e] [... ]"; +"git-shortlog [-n] [-s] [-e] [-w] [... ]"; static int compare_by_number(const void *a1, const void *a2) { @@ -70,11 +70,12 @@ static void insert_one_record(struct shortlog *log, else free(buffer); + /* Skip any leading whitespace, including any blank lines. */ + while (*oneline && isspace(*oneline)) + oneline++; eol = strchr(oneline, '\n'); if (!eol) eol = oneline + strlen(oneline); - while (*oneline && isspace(*oneline) && *oneline != '\n') - oneline++; if (!prefixcmp(oneline, "[PATCH")) { char *eob = strchr(oneline, ']'); if (eob && (!eol || eob < eol)) @@ -228,7 +229,9 @@ int cmd_shortlog(int argc, const char **argv, const char *prefix) { struct shortlog log; struct rev_info rev; + int nongit; + prefix = setup_git_directory_gently(&nongit); shortlog_init(&log); /* since -n is a shadowed rev argument, parse our args first */ @@ -258,7 +261,7 @@ int cmd_shortlog(int argc, const char **argv, const char *prefix) die ("unrecognized argument: %s", argv[1]); /* assume HEAD if from a tty */ - if (!rev.pending.nr && isatty(0)) + if (!nongit && !rev.pending.nr && isatty(0)) add_head_to_pending(&rev); if (rev.pending.nr == 0) { read_from_stdin(&log);