Code

builtin-fetch.c (store_updated_refs): Honor update_local_ref() return value
[git.git] / builtin-shortlog.c
index b22b0edd65eefacabb648962b9c20c695609a3f5..e6a2865019cceadfcbfc8575a2bd1f97b7159dcb 100644 (file)
@@ -9,7 +9,7 @@
 #include "shortlog.h"
 
 static const char shortlog_usage[] =
-"git-shortlog [-n] [-s] [-e] [<commit-id>... ]";
+"git-shortlog [-n] [-s] [-e] [-w] [<commit-id>... ]";
 
 static int compare_by_number(const void *a1, const void *a2)
 {
@@ -229,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 */
@@ -259,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);