From 2e6721edbb3c94a70f4ef0ead5e55b9da19fb806 Mon Sep 17 00:00:00 2001 From: Julius Plenz Date: Thu, 10 Mar 2011 17:03:22 +0100 Subject: make enable-log-linecount independent of -filecount You should be able to independently switch file and line count on and off. This patch makes the code work like the documentation suggests: no dependency for line counts to be displayed only when file counts are. Signed-off-by: Julius Plenz Signed-off-by: Lars Hjemli --- ui-log.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'ui-log.c') diff --git a/ui-log.c b/ui-log.c index 8add66a..2e6e9d6 100644 --- a/ui-log.c +++ b/ui-log.c @@ -100,11 +100,10 @@ void print_commit(struct commit *commit, struct rev_info *revs) struct strbuf graphbuf = STRBUF_INIT; struct strbuf msgbuf = STRBUF_INIT; - if (ctx.repo->enable_log_filecount) { + if (ctx.repo->enable_log_filecount) + cols++; + if (ctx.repo->enable_log_linecount) cols++; - if (ctx.repo->enable_log_linecount) - cols++; - } if (revs->graph) { /* Advance graph until current commit */ @@ -179,18 +178,18 @@ void print_commit(struct commit *commit, struct rev_info *revs) html_link_close(); } - if (ctx.repo->enable_log_filecount) { + if (ctx.repo->enable_log_filecount || ctx.repo->enable_log_linecount) { files = 0; add_lines = 0; rem_lines = 0; cgit_diff_commit(commit, inspect_files, ctx.qry.vpath); - html(""); - htmlf("%d", files); - if (ctx.repo->enable_log_linecount) { - html(""); - htmlf("-%d/+%d", rem_lines, add_lines); - } } + + if (ctx.repo->enable_log_filecount) + htmlf("%d", files); + if (ctx.repo->enable_log_linecount) + htmlf("-%d/+%d", rem_lines, add_lines); + html("\n"); if (revs->graph || ctx.qry.showmsg) { /* Print a second table row */ @@ -379,10 +378,10 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern if (ctx.repo->enable_log_filecount) { html("Files"); columns++; - if (ctx.repo->enable_log_linecount) { - html("Lines"); - columns++; - } + } + if (ctx.repo->enable_log_linecount) { + html("Lines"); + columns++; } html("\n"); -- cgit v1.2.1