diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2016-06-22 17:02:07 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-06-25 00:20:47 +0200 |
commit | 7f7d712bcfde8afe0a007042d5cb4b809617fb96 (patch) | |
tree | aa093f844c6d8750bab041075823c5f052f808db /builtin/shortlog.c | |
parent | format-patch: use stdout directly (diff) | |
download | git-7f7d712bcfde8afe0a007042d5cb4b809617fb96.tar.xz git-7f7d712bcfde8afe0a007042d5cb4b809617fb96.zip |
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.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin/shortlog.c b/builtin/shortlog.c index 39d74fe23b..be8054791e 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; } |