From: Johan Herland <johan@herland.net>
To: Lars Hjemli <hjemli@gmail.com>
Cc: git@vger.kernel.org, johan@herland.net
Subject: [CGit RFC/PATCH 3/5] ui-log: Refactor display of commit messages
Date: Tue, 13 Jul 2010 23:40:19 +0200 [thread overview]
Message-ID: <1279057221-28036-4-git-send-email-johan@herland.net> (raw)
In-Reply-To: <1279056219-27096-1-git-send-email-johan@herland.net>
Split new function print_commit_line() out of print_commit(). The new
function only prints the initial table cells containing commit metadata,
i.e. the commit subject, author and date (and file/line-count if enabled).
The printing of the rest of the commit message (when showmsg is enabled)
is still performed in print_commit(), but is slightly changed to use
additional newlines to achieve the vertical margins that were previously
implemented with CSS. This is in preparation for the commit graph which
will be printed to the left of the commit message as part of the same
table row, and therefore needs to minimize margins that would otherwise
cause ugly gaps in the graph.
Signed-off-by: Johan Herland <johan@herland.net>
---
cgit.css | 2 +-
ui-log.c | 38 +++++++++++++++++++++++++-------------
2 files changed, 26 insertions(+), 14 deletions(-)
diff --git a/cgit.css b/cgit.css
index 6e47eb3..78f654e 100644
--- a/cgit.css
+++ b/cgit.css
@@ -161,7 +161,7 @@ table.list td.logsubject {
table.list td.logmsg {
font-family: monospace;
white-space: pre;
- padding: 1em 0.5em 2em 0.5em;
+ padding: 0 0.5em;
}
table.list td a {
diff --git a/ui-log.c b/ui-log.c
index 390c38b..2cd0f19 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -75,14 +75,10 @@ void show_commit_decorations(struct commit *commit)
}
}
-void print_commit(struct commit *commit)
+static void print_commit_line(struct commit *commit, struct commitinfo *info)
{
- struct commitinfo *info;
char *tmp;
- int cols = 3;
- info = cgit_parse_commit(commit);
- htmlf("<tr%s>", ctx.qry.showmsg ? " class='logheader'" : "");
htmlf("<td%s>", ctx.qry.showmsg ? " class='logsubject'" : "");
cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head,
sha1_to_hex(commit->object.sha1), ctx.qry.vpath, 0);
@@ -107,18 +103,34 @@ void print_commit(struct commit *commit)
htmlf("-%d/+%d", rem_lines, add_lines);
}
}
- html("</td></tr>\n");
- if (ctx.qry.showmsg) {
- if (ctx.repo->enable_log_filecount) {
+ html("</td>");
+}
+
+void print_commit(struct commit *commit)
+{
+ struct commitinfo *info = cgit_parse_commit(commit);
+ int cols = 3;
+
+ if (ctx.repo->enable_log_filecount) {
+ cols++;
+ if (ctx.repo->enable_log_linecount)
cols++;
- if (ctx.repo->enable_log_linecount)
- cols++;
+ }
+
+ htmlf("<tr%s>", ctx.qry.showmsg ? " class='logheader'" : "");
+ print_commit_line(commit, info);
+ html("</tr>\n");
+
+ if (ctx.qry.showmsg) {
+ html("<tr class='nohover'>");
+ htmlf("<td colspan='%d' class='logmsg'>\n", cols);
+ if (*(info->msg)) {
+ html_txt(info->msg);
+ html("\n\n");
}
- htmlf("<tr class='nohover'><td colspan='%d' class='logmsg'>",
- cols);
- html_txt(info->msg);
html("</td></tr>\n");
}
+
cgit_free_commitinfo(info);
}
--
1.7.0.4
next prev parent reply other threads:[~2010-07-13 21:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-13 21:23 [PATCH 0/2] Preparing the graph API for external users Johan Herland
2010-07-13 21:23 ` [PATCH 1/2] Make graph_next_line() available in the graph.h API Johan Herland
2010-07-13 21:23 ` [PATCH 2/2] Enable custom schemes for column colors in the graph API Johan Herland
2010-07-13 21:40 ` [CGit RFC/PATCH 0/5] Commit graph on CGit's 'log' view Johan Herland
2010-07-13 22:57 ` Lars Hjemli
2010-07-14 5:59 ` Johan Herland
2010-07-18 13:26 ` Lars Hjemli
2010-07-13 21:40 ` [CGit RFC/PATCH 1/5] ui-stats: Remove unnecessary #include Johan Herland
2010-07-13 21:40 ` [CGit RFC/PATCH 2/5] ui-log: Move 'Age' column to the right of 'Author', like in gitk Johan Herland
2010-07-13 21:40 ` Johan Herland [this message]
2010-07-13 21:40 ` [CGit RFC/PATCH 4/5] ui-log: Implement support for commit graphs Johan Herland
2010-07-13 21:40 ` [CGit RFC/PATCH 5/5] ui-log: Colorize commit graph Johan Herland
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=1279057221-28036-4-git-send-email-johan@herland.net \
--to=johan@herland.net \
--cc=git@vger.kernel.org \
--cc=hjemli@gmail.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).