From 6bf139440c192e157b9c0dab701fa2100fbb1e1e Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 26 May 2011 18:27:49 -0400 Subject: clean up calling conventions for pretty.c functions We have a pretty_print_context representing the parameters for a pretty-print session, but we did not use it uniformly. As a result, functions kept growing more and more arguments. Let's clean this up in a few ways: 1. All pretty-print pp_* functions now take a context. This lets us reduce the number of arguments to these functions, since we were just passing around the context values separately. 2. The context argument now has a cmit_fmt field, which was passed around separately. That's one less argument per function. 3. The context argument always comes first, which makes calling a little more uniform. This drops lines from some callers, and adds lines in a few places (because we need an extra line to set the context's fmt field). Overall, we don't save many lines, but the lines that are there are a lot simpler and more readable. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- builtin/merge.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'builtin/merge.c') diff --git a/builtin/merge.c b/builtin/merge.c index 42fff387e6..c902e81cf1 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -333,13 +333,14 @@ static void squash_message(void) ctx.abbrev = rev.abbrev; ctx.date_mode = rev.date_mode; + ctx.fmt = rev.commit_format; strbuf_addstr(&out, "Squashed commit of the following:\n"); while ((commit = get_revision(&rev)) != NULL) { strbuf_addch(&out, '\n'); strbuf_addf(&out, "commit %s\n", sha1_to_hex(commit->object.sha1)); - pretty_print_commit(rev.commit_format, commit, &out, &ctx); + pretty_print_commit(&ctx, commit, &out); } if (write(fd, out.buf, out.len) < 0) die_errno("Writing SQUASH_MSG"); -- cgit v1.2.1