diff --git a/merge-recursive.c b/merge-recursive.c index b972a83b38..99c963558b 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -191,25 +191,26 @@ static void output(struct merge_options *o, int v, const char *fmt, ...) static void output_commit_title(struct merge_options *o, struct commit *commit) { - int i; - flush_output(o); - for (i = o->call_depth; i--;) - fputs(" ", stdout); + strbuf_addchars(&o->obuf, ' ', o->call_depth * 2); if (commit->util) - printf("virtual %s\n", merge_remote_util(commit)->name); + strbuf_addf(&o->obuf, "virtual %s\n", + merge_remote_util(commit)->name); else { - printf("%s ", find_unique_abbrev(commit->object.oid.hash, DEFAULT_ABBREV)); + strbuf_addf(&o->obuf, "%s ", + find_unique_abbrev(commit->object.oid.hash, + DEFAULT_ABBREV)); if (parse_commit(commit) != 0) - printf(_("(bad commit)\n")); + strbuf_addf(&o->obuf, _("(bad commit)\n")); else { const char *title; const char *msg = get_commit_buffer(commit, NULL); int len = find_commit_subject(msg, &title); if (len) - printf("%.*s\n", len, title); + strbuf_addf(&o->obuf, "%.*s\n", len, title); unuse_commit_buffer(commit, msg); } } + flush_output(o); } static int add_cacheinfo(struct merge_options *o,