Diff options
Diffstat (limited to '')
| -rw-r--r-- | source/ui-log.c | 17 | |
| -rw-r--r-- | source/ui-log.h | 7 | |
| -rw-r--r-- | source/ui-summary.c | 19 |
3 files changed, 21 insertions, 22 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; diff --git a/source/ui-log.h b/source/ui-log.h index cec0f7a..349489a 100644 --- a/source/ui-log.h +++ b/source/ui-log.h @@ -16,6 +16,13 @@ */ extern 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); + +/* + * The columns a log row spans: age, message and author, and one more each for + * the graph and for the file and line counts that are turned on. + */ +extern int cgit_log_columns(int graph); + extern void cgit_print_commit_decorations(struct commit *commit); #endif // CGIT_UI_LOG_H diff --git a/source/ui-summary.c b/source/ui-summary.c index ea31a9e..9972f76 100644 --- a/source/ui-summary.c +++ b/source/ui-summary.c @@ -17,23 +17,8 @@ #include "ui-shared.h" #include "ui-summary.h" -// Age, commit message and author, the three columns a log row always has. -// ui-log.c adds one more for each of the two optional counts. -#define LOG_BASE_COLUMNS 3 - static int clone_urls_printed; -static int log_columns(void) -{ - int columns = LOG_BASE_COLUMNS; - - if (ctx.repo->enable_log_filecount) - columns++; - if (ctx.repo->enable_log_linecount) - columns++; - return columns; -} - /* * The sections share one table, which is as wide as the widest of them, and * every row fills it, since a short row would end its stripe short of the @@ -41,8 +26,8 @@ static int log_columns(void) */ static int table_columns(void) { - if (ctx.cfg.summary_log > 0 && log_columns() > REF_COLUMNS) - return log_columns(); + if (ctx.cfg.summary_log > 0 && cgit_log_columns(0) > REF_COLUMNS) + return cgit_log_columns(0); return REF_COLUMNS; } |
