git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[CGit RFC/PATCH 2/5] ui-log: Move 'Age' column to the right of 'Author', like in gitk

From
Johan Herland <johan@herland.net>
Date
Jul 13, 2010, 21:40 UTC
Message-ID
<1279057221-28036-3-git-send-email-johan@herland.net>
In-Reply-To
<1279056219-27096-1-git-send-email-johan@herland.net>

This is in preparation for putting the commit graph to the left of the commit message. IMHO, it looks better when the commit message is right next to the graph, than if the age is wedged in between.

Signed-off-by: Johan Herland <johan@herland.net>
---
 ui-log.c |   26 ++++++++++++--------------
 1 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/ui-log.c b/ui-log.c
index 33ec8a9..390c38b 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -79,23 +79,22 @@ void print_commit(struct commit *commit)
 {
 	struct commitinfo *info;
 	char *tmp;
-	int cols = 2;
+	int cols = 3;
 
 	info = cgit_parse_commit(commit);
-	htmlf("<tr%s><td>",
-		ctx.qry.showmsg ? " class='logheader'" : "");
-	tmp = fmt("id=%s", sha1_to_hex(commit->object.sha1));
-	tmp = cgit_fileurl(ctx.repo->url, "commit", ctx.qry.vpath, tmp);
-	html_link_open(tmp, NULL, NULL);
-	cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE);
-	html_link_close();
-	htmlf("</td><td%s>",
-		ctx.qry.showmsg ? " class='logsubject'" : "");
+	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);
 	show_commit_decorations(commit);
 	html("</td><td>");
 	html_txt(info->author);
+	html("</td><td>");
+	tmp = fmt("id=%s", sha1_to_hex(commit->object.sha1));
+	tmp = cgit_fileurl(ctx.repo->url, "commit", ctx.qry.vpath, tmp);
+	html_link_open(tmp, NULL, NULL);
+	cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE);
+	html_link_close();
 	if (ctx.repo->enable_log_filecount) {
 		files = 0;
 		add_lines = 0;
@@ -115,7 +114,7 @@ void print_commit(struct commit *commit)
 			if (ctx.repo->enable_log_linecount)
 				cols++;
 		}
-		htmlf("<tr class='nohover'><td/><td colspan='%d' class='logmsg'>",
+		htmlf("<tr class='nohover'><td colspan='%d' class='logmsg'>",
 			cols);
 		html_txt(info->msg);
 		html("</td></tr>\n");
@@ -176,8 +175,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
 	if (pager)
 		html("<table class='list nowrap'>");
 
-	html("<tr class='nohover'><th class='left'>Age</th>"
-	      "<th class='left'>Commit message");
+	html("<tr class='nohover'><th class='left'>Commit message");
 	if (pager) {
 		html(" (");
 		cgit_log_link(ctx.qry.showmsg ? "Collapse" : "Expand", NULL,
@@ -186,7 +184,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
 			      ctx.qry.search, ctx.qry.showmsg ? 0 : 1);
 		html(")");
 	}
-	html("</th><th class='left'>Author</th>");
+	html("</th><th class='left'>Author</th><th class='left'>Age</th>");
 	if (ctx.repo->enable_log_filecount) {
 		html("<th class='left'>Files</th>");
 		columns++;
-- 
1.7.0.4
Previous: Johan HerlandNext: Johan Herland
Message 9 of 12 in “Preparing the graph API for external users”
  1. 0/2 Preparing the graph API for external usersJohan Herland, Jul 13, 2010
  2. 1/2 Make graph_next_line() available in the graph.h APIJohan Herland, Jul 13, 2010
  3. 2/2 Enable custom schemes for column colors in the graph APIJohan Herland, Jul 13, 2010
  4. 0/5 Commit graph on CGit's 'log' viewJohan Herland, Jul 13, 2010
  5. Lars HjemliJul 13, 2010
  6. Johan HerlandJul 14, 2010
  7. Lars HjemliJul 18, 2010
  8. 1/5 ui-stats: Remove unnecessary #includeJohan Herland, Jul 13, 2010
  9. 2/5 ui-log: Move 'Age' column to the right of 'Author', like in gitkJohan Herland, Jul 13, 2010
  10. 3/5 ui-log: Refactor display of commit messagesJohan Herland, Jul 13, 2010
  11. 4/5 ui-log: Implement support for commit graphsJohan Herland, Jul 13, 2010
  12. 5/5 ui-log: Colorize commit graphJohan Herland, Jul 13, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.