summaryrefslogtreecommitdiff
path: root/builtin/log.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-12-21 22:06:01 -0800
committerJunio C Hamano <gitster@pobox.com>2012-12-21 23:55:40 -0800
commitd28b5d47ab72a91d5090748f8f8baaf6ffa084fc (patch)
treed2b9f6170568471be7d27e0b86c528d1ea388eff /builtin/log.c
parent38ec23ac893e96a9027c1cf8112b3d97a0384d39 (diff)
downloadgit-d28b5d47ab72a91d5090748f8f8baaf6ffa084fc.tar.gz
get_patch_filename(): split into two functions
The function switched between two operating modes depending on the NULL-ness of its two parameters, as a hacky way to share small part of implementation, sacrificing cleanliness of the API. Implement "fmt_output_subject()" function that takes a subject string and gives the name for the output file, and on top of it, implement "fmt_output_commit()" function that takes a commit and gives the name for the output file. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/log.c')
-rw-r--r--builtin/log.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin/log.c b/builtin/log.c
index 3c6f20a235..8cfb4da662 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -686,8 +686,10 @@ static int reopen_stdout(struct commit *commit, const char *subject,
if (rev->numbered_files)
strbuf_addf(&filename, "%d", rev->nr);
+ else if (commit)
+ fmt_output_commit(&filename, commit, rev);
else
- get_patch_filename(&filename, commit, subject, rev);
+ fmt_output_subject(&filename, subject, rev);
if (!quiet)
fprintf(realstdout, "%s\n", filename.buf + outdir_offset);