Diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Label the age column of a followed log
Diffstat (limited to '')
-rw-r--r--source/ui-log.c40
1 file changed, 20 insertions, 20 deletions
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("<td></td>");
}
-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("<tbody class='log'>\n<tr class='nohover'>");
- if (commit_graph)
+ if (rev.graph)
html("<th scope='col' aria-label='Graph'></th>");
else
html("<th class='left' scope='col'>Age</th>");
@@ -601,16 +607,10 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
html("</th><th class='left col-author' scope='col'>Author</th>");
if (rev.graph)
html("<th class='left' scope='col'>Age</th>");
- if (ctx.repo->enable_log_filecount) {
+ if (ctx.repo->enable_log_filecount)
html("<th class='left col-count' scope='col'>Files</th>");
- columns++;
- }
- if (ctx.repo->enable_log_linecount) {
+ if (ctx.repo->enable_log_linecount)
html("<th class='left col-count' scope='col'>Lines</th>");
- columns++;
- }
- if (table_columns > columns)
- filler = table_columns - columns;
print_filler(filler);
html("</tr>\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;