summaryrefslogtreecommitdiff
path: root/builtin-shortlog.c
diff options
context:
space:
mode:
authorJonas Fonseca <fonseca@diku.dk>2008-03-14 22:35:24 +0100
committerJunio C Hamano <gitster@pobox.com>2008-03-15 00:49:15 -0700
commitabe549e1791822b3105648452b1f8907f8fdb26a (patch)
tree3686f073dfc5e8073a41925d371c085507c327cc /builtin-shortlog.c
parent267123b4299ea2c2f090ef169f9fc5039897cd72 (diff)
downloadgit-abe549e1791822b3105648452b1f8907f8fdb26a.tar.gz
shortlog: do not require to run from inside a git repository
Once upon a time shortlog could be run from a non-git directory and still do its job. Fix this regression and add a small test for it. Signed-off-by: Jonas Fonseca <fonseca@diku.dk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-shortlog.c')
-rw-r--r--builtin-shortlog.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin-shortlog.c b/builtin-shortlog.c
index b22b0edd65..bd795b1db7 100644
--- a/builtin-shortlog.c
+++ b/builtin-shortlog.c
@@ -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);