Skip to content

Commit 70f19c7

Browse files
newrengitster
authored andcommitted
merge-ort: implement format_commit()
This implementation is based on a mixture of print_commit() and output_commit_title() from merge-recursive.c so that it can be used to take over both functions. Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c73cda7 commit 70f19c7

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

merge-ort.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,19 @@ static void format_commit(struct strbuf *sb,
328328
int indent,
329329
struct commit *commit)
330330
{
331-
die("Not yet implemented.");
331+
struct merge_remote_desc *desc;
332+
struct pretty_print_context ctx = {0};
333+
ctx.abbrev = DEFAULT_ABBREV;
334+
335+
strbuf_addchars(sb, ' ', indent);
336+
desc = merge_remote_util(commit);
337+
if (desc) {
338+
strbuf_addf(sb, "virtual %s\n", desc->name);
339+
return;
340+
}
341+
342+
format_commit_message(commit, "%h %s", sb, &ctx);
343+
strbuf_addch(sb, '\n');
332344
}
333345

334346
__attribute__((format (printf, 4, 5)))

0 commit comments

Comments
 (0)