Diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Count the log's columns in ui-log.c alone
Diffstat (limited to 'source/ui-log.c')
-rw-r--r--source/ui-log.c17
1 file changed, 12 insertions, 5 deletions
diff --git a/source/ui-log.c b/source/ui-log.c
index 1864d6f..f0ec203 100644
--- a/source/ui-log.c
+++ b/source/ui-log.c
@@ -442,6 +442,17 @@ void cgit_print_commit_decorations(struct commit *commit)
html("</span>");
}
+int cgit_log_columns(int graph)
+{
+ int columns = graph ? 4 : 3;
+
+ if (ctx.repo->enable_log_filecount)
+ columns++;
+ if (ctx.repo->enable_log_linecount)
+ columns++;
+ return columns;
+}
+
void cgit_print_log(const char *tip, int ofs, int cnt, const char *grep, const char *pattern,
const char *path, int pager, int commit_graph, int commit_sort, int table_columns)
{
@@ -531,11 +542,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, const char *grep, const c
// 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++;
+ columns = cgit_log_columns(rev.graph != NULL);
if (table_columns > columns)
filler = table_columns - columns;