summaryrefslogtreecommitdiff
path: root/builtin/shortlog.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2016-06-22 15:02:07 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-06-24 22:20:47 (GMT)
commit7f7d712bcfde8afe0a007042d5cb4b809617fb96 (patch)
treeaa093f844c6d8750bab041075823c5f052f808db /builtin/shortlog.c
parent36a4d905c36a598d17274765b57690ecfb4a23f8 (diff)
downloadgit-7f7d712bcfde8afe0a007042d5cb4b809617fb96.zip
git-7f7d712bcfde8afe0a007042d5cb4b809617fb96.tar.gz
git-7f7d712bcfde8afe0a007042d5cb4b809617fb96.tar.bz2
shortlog: respect the --output=<file> setting
Thanks to the diff option parsing, we already know about this option. We just have to make use of it. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> 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 39d74fe..be80547 100644
--- a/builtin/shortlog.c
+++ b/builtin/shortlog.c
@@ -229,7 +229,6 @@ void shortlog_init(struct shortlog *log)
log->wrap = DEFAULT_WRAPLEN;
log->in1 = DEFAULT_INDENT1;
log->in2 = DEFAULT_INDENT2;
- log->file = stdout;
}
int cmd_shortlog(int argc, const char **argv, const char *prefix)
@@ -277,6 +276,7 @@ parse_done:
log.user_format = rev.commit_format == CMIT_FMT_USERFORMAT;
log.abbrev = rev.abbrev;
+ log.file = rev.diffopt.file;
/* assume HEAD if from a tty */
if (!nongit && !rev.pending.nr && isatty(0))
@@ -290,6 +290,8 @@ parse_done:
get_from_rev(&rev, &log);
shortlog_output(&log);
+ if (log.file != stdout)
+ fclose(log.file);
return 0;
}