path: root/builtin-rev-list.c
diff options
authorThomas Rast <>2009-10-19 15:48:08 (GMT)
committerJunio C Hamano <>2009-10-20 05:28:20 (GMT)
commitdd2e794a214350711db46c4e08d9b19188a7d63a (patch)
treed9566af4d6b5eac1ba0fa0f1e6e3a3b08d56b858 /builtin-rev-list.c
parent9ecb2a7f496413b9a6404e4a19f7edee029819b8 (diff)
Refactor pretty_print_commit arguments into a struct
pretty_print_commit() has a bunch of rarely-used arguments, and introducing more of them requires yet another update of all the call sites. Refactor most of them into a struct to make future extensions easier. The ones that stay "plain" arguments were chosen on the grounds that all callers put real arguments there, whereas some callers have 0/NULL for all arguments that were factored into the struct. We declare the struct 'const' to ensure none of the callers are bitten by the changed (no longer call-by-value) semantics. Signed-off-by: Thomas Rast <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'builtin-rev-list.c')
1 files changed, 4 insertions, 3 deletions
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index 4ba1c12..42cc8d8 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -96,9 +96,10 @@ static void show_commit(struct commit *commit, void *data)
if (revs->verbose_header && commit->buffer) {
struct strbuf buf = STRBUF_INIT;
- pretty_print_commit(revs->commit_format, commit,
- &buf, revs->abbrev, NULL, NULL,
- revs->date_mode, 0);
+ struct pretty_print_context ctx = {0};
+ ctx.abbrev = revs->abbrev;
+ ctx.date_mode = revs->date_mode;
+ pretty_print_commit(revs->commit_format, commit, &buf, &ctx);
if (revs->graph) {
if (buf.len) {
if (revs->commit_format != CMIT_FMT_ONELINE)