List for cgit developers and users
 help / color / mirror / Atom feed
From: mailings at hupie.com (Ferry Huberts)
Subject: [PATCH] Fix colspan values
Date: Tue, 05 Mar 2013 21:50:33 +0100	[thread overview]
Message-ID: <51365A99.1070503@hupie.com> (raw)
In-Reply-To: <20130305202939.GB9131@blizzard>



On 05/03/13 21:29, Lukas Fleischer wrote:
> On Tue, Mar 05, 2013 at 05:47:50PM +0100, Ferry Huberts wrote:
>>
>>
>> On 05/03/13 15:42, Lukas Fleischer wrote:
>>> This fixes a couple of minor oversights in previous commits and adjusts
>>> all cells using colspan to use the correct width.
>>>
>>> Signed-off-by: Lukas Fleischer <cgit at cryptocrack.de>
>>> ---
>>>   ui-log.c     | 14 +++++++-------
>>>   ui-refs.c    |  4 ++--
>>>   ui-summary.c | 24 +++++++++++++++++++-----
>>>   3 files changed, 28 insertions(+), 14 deletions(-)
>>>
>>> diff --git a/ui-log.c b/ui-log.c
>>> index 857c05c..954d3e1 100644
>>> --- a/ui-log.c
>>> +++ b/ui-log.c
>>> @@ -98,14 +98,14 @@ next:
>>>   static void print_commit(struct commit *commit, struct rev_info *revs)
>>>   {
>>>   	struct commitinfo *info;
>>> -	int cols = revs->graph ? 3 : 2;
>>> +	int columns = revs->graph ? 4 : 3;
>>
>> please don't do a rename and a change in one patch, it's making the
>> patch bigger than it has to be.
>>
>> please resubmit without the rename
>
> We are already touching this line due to the erroneous initialization
> values and this rename makes the naming consistent with everything else
> we're touching in this patch. I'm all for making atomic commits but I
> really don't see any benefit in splitting this for the sake of having a
> +25/-11 instead of a +28/-14 diff.
>


think about your reviewers...
it's 'confusing' to have side-effects in a patch
if you want people to review your patches then you should make it as 
easy on them as possible.

a split would accomplish that in this case :-)


> Let's let Jason decide... :)
>
>>
>>>   	struct strbuf graphbuf = STRBUF_INIT;
>>>   	struct strbuf msgbuf = STRBUF_INIT;
>>>
>>>   	if (ctx.repo->enable_log_filecount)
>>> -		cols++;
>>> +		columns++;
>>>   	if (ctx.repo->enable_log_linecount)
>>> -		cols++;
>>> +		columns++;
>>>
>>>   	if (revs->graph) {
>>>   		/* Advance graph until current commit */
>>> @@ -113,7 +113,7 @@ static void print_commit(struct commit *commit, struct rev_info *revs)
>>>   			/* Print graph segment in otherwise empty table row */
>>>   			html("<tr class='nohover'><td class='commitgraph'>");
>>>   			html(graphbuf.buf);
>>> -			htmlf("</td><td colspan='%d' /></tr>\n", cols);
>>> +			htmlf("</td><td colspan='%d' /></tr>\n", columns);
>>>   			strbuf_setlen(&graphbuf, 0);
>>>   		}
>>>   		/* Current commit's graph segment is now ready in graphbuf */
>>> @@ -232,7 +232,7 @@ static void print_commit(struct commit *commit, struct rev_info *revs)
>>>   			html("<td/>"); /* Empty 'Age' column */
>>>
>>>   		/* Print msgbuf into remainder of table row */
>>> -		htmlf("<td colspan='%d'%s>\n", cols,
>>> +		htmlf("<td colspan='%d'%s>\n", columns - (revs->graph ? 1 : 0),
>>>   			ctx.qry.showmsg ? " class='logmsg'" : "");
>>>   		html_txt(msgbuf.buf);
>>>   		html("</td></tr>\n");
>>> @@ -283,7 +283,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
>>>   	struct rev_info rev;
>>>   	struct commit *commit;
>>>   	struct vector vec = VECTOR_INIT(char *);
>>> -	int i, columns = 3;
>>> +	int i, columns = commit_graph ? 4 : 3;
>>>   	char *arg;
>>>
>>>   	/* First argv is NULL */
>>> @@ -421,7 +421,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
>>>   		}
>>>   		html("</div>");
>>>   	} else if ((commit = get_revision(&rev)) != NULL) {
>>> -		html("<tr class='nohover'><td colspan='3'>");
>>> +		htmlf("<tr class='nohover'><td colspan='%d'>", columns);
>>>   		cgit_log_link("[...]", NULL, NULL, ctx.qry.head, NULL,
>>>   			      ctx.qry.vpath, 0, NULL, NULL, ctx.qry.showmsg);
>>>   		html("</td></tr>\n");
>>> diff --git a/ui-refs.c b/ui-refs.c
>>> index e89f836..45db2ac 100644
>>> --- a/ui-refs.c
>>> +++ b/ui-refs.c
>>> @@ -177,7 +177,7 @@ static int print_tag(struct refinfo *ref)
>>>
>>>   static void print_refs_link(char *path)
>>>   {
>>> -	html("<tr class='nohover'><td colspan='4'>");
>>> +	html("<tr class='nohover'><td colspan='5'>");
>>>   	cgit_refs_link("[...]", NULL, NULL, ctx.qry.head, NULL, path);
>>>   	html("</td></tr>");
>>>   }
>>> @@ -252,7 +252,7 @@ void cgit_print_refs()
>>>   		cgit_print_tags(0);
>>>   	else {
>>>   		cgit_print_branches(0);
>>> -		html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>");
>>> +		html("<tr class='nohover'><td colspan='5'>&nbsp;</td></tr>");
>>>   		cgit_print_tags(0);
>>>   	}
>>>   	html("</table>");
>>> diff --git a/ui-summary.c b/ui-summary.c
>>> index b4fdd57..38639ce 100644
>>> --- a/ui-summary.c
>>> +++ b/ui-summary.c
>>> @@ -17,15 +17,22 @@ int urls = 0;
>>>
>>>   static void print_url(char *base, char *suffix)
>>>   {
>>> +	int columns = 3;
>>> +
>>> +	if (ctx.repo->enable_log_filecount)
>>> +		columns++;
>>> +	if (ctx.repo->enable_log_linecount)
>>> +		columns++;
>>> +
>>>   	if (!base || !*base)
>>>   		return;
>>>   	if (urls++ == 0) {
>>> -		html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>");
>>> -		html("<tr><th class='left' colspan='4'>Clone</th></tr>\n");
>>> +		htmlf("<tr class='nohover'><td colspan='%d'>&nbsp;</td></tr>", columns);
>>> +		htmlf("<tr><th class='left' colspan='%d'>Clone</th></tr>\n", columns);
>>>   	}
>>>   	if (suffix && *suffix)
>>>   		base = fmt("%s/%s", base, suffix);
>>> -	html("<tr><td colspan='4'><a href='");
>>> +	htmlf("<tr><td colspan='%d'><a href='", columns);
>>>   	html_url_path(base);
>>>   	html("'>");
>>>   	html_txt(base);
>>> @@ -52,12 +59,19 @@ static void print_urls(char *txt, char *suffix)
>>>
>>>   void cgit_print_summary()
>>>   {
>>> +	int columns = 3;
>>> +
>>> +	if (ctx.repo->enable_log_filecount)
>>> +		columns++;
>>> +	if (ctx.repo->enable_log_linecount)
>>> +		columns++;
>>> +
>>>   	html("<table summary='repository info' class='list nowrap'>");
>>>   	cgit_print_branches(ctx.cfg.summary_branches);
>>> -	html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>");
>>> +	htmlf("<tr class='nohover'><td colspan='%d'>&nbsp;</td></tr>", columns);
>>>   	cgit_print_tags(ctx.cfg.summary_tags);
>>>   	if (ctx.cfg.summary_log > 0) {
>>> -		html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>");
>>> +		htmlf("<tr class='nohover'><td colspan='%d'>&nbsp;</td></tr>", columns);
>>>   		cgit_print_log(ctx.qry.head, 0, ctx.cfg.summary_log, NULL,
>>>   			       NULL, NULL, 0, 0, 0);
>>>   	}
>>>
>>
>> --
>> Ferry Huberts

-- 
Ferry Huberts




      reply	other threads:[~2013-03-05 20:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-05 14:42 cgit
2013-03-05 16:47 ` mailings
2013-03-05 20:29   ` cgit
2013-03-05 20:50     ` mailings [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51365A99.1070503@hupie.com \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).