From bc82123e839832d4a5bde4f66e141b7c2ce7c7ab Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 13:13:07 -0700 Subject: Label the age column of a followed log --- source/ui-log.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'source/ui-log.c') diff --git a/source/ui-log.c b/source/ui-log.c index 870ff06..2c1d802 100644 --- a/source/ui-log.c +++ b/source/ui-log.c @@ -220,20 +220,16 @@ static void print_filler(int columns) html(""); } -static void print_commit(struct commit *commit, struct rev_info *revs, int filler) +/* + * columns counts the filler too, because the rows that span the table reach + * across it as well. + */ +static void print_commit(struct commit *commit, struct rev_info *revs, int columns, int filler) { struct commitinfo *info; - int columns = revs->graph ? 4 : 3; struct strbuf graphbuf = STRBUF_INIT; struct strbuf msgbuf = STRBUF_INIT; - if (ctx.repo->enable_log_filecount) - columns++; - if (ctx.repo->enable_log_linecount) - columns++; - // The rows that span the table reach across the filler as well. - columns += filler; - if (revs->graph) print_graph_above(revs, &graphbuf, columns); @@ -472,7 +468,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern struct rev_info rev; struct commit *commit; struct strvec rev_argv = STRVEC_INIT; - int i, columns = commit_graph ? 4 : 3, filler = 0; + int i, columns, filler = 0; int must_free_tip = 0; // setup_revisions skips the first entry the way a command skips its @@ -565,6 +561,16 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern load_ref_decorations(NULL, DECORATE_FULL_REFS); rev.show_decorations = 1; + // A followed log is walked without the graph even when commit_graph + // asks for one, so the walk decides the columns. + columns = rev.graph ? 4 : 3; + if (ctx.repo->enable_log_filecount) + columns++; + if (ctx.repo->enable_log_linecount) + columns++; + if (table_columns > columns) + filler = table_columns - columns; + rev.diffopt.detect_rename = 1; rev.diffopt.rename_limit = ctx.cfg.renamelimit; if (ctx.qry.ignorews) @@ -584,7 +590,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern } html("\n"); - if (commit_graph) + if (rev.graph) html(""); else html("Age"); @@ -601,16 +607,10 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern html("Author"); if (rev.graph) html("Age"); - if (ctx.repo->enable_log_filecount) { + if (ctx.repo->enable_log_filecount) html("Files"); - columns++; - } - if (ctx.repo->enable_log_linecount) { + if (ctx.repo->enable_log_linecount) html("Lines"); - columns++; - } - if (table_columns > columns) - filler = table_columns - columns; print_filler(filler); html("\n"); @@ -630,7 +630,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern counts_ready = 0; if (should_show(commit, &rev)) { i++; - print_commit(commit, &rev, filler); + print_commit(commit, &rev, columns + filler, filler); } release_commit_memory(the_repository->parsed_objects, commit); commit->parents = NULL; -- cgit