aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Herland <johan@herland.net>2010-07-30 16:21:00 +0200
committerLars Hjemli <hjemli@gmail.com>2010-08-02 00:04:07 +0200
commit54d252a1c9dfc4f9531fad3bb0a14ee526f9bbe3 (patch)
tree98b0c9c62beebc23e787bda497495fa44b3064d9
parentui-summary: Disable commit graph in embedded log view (diff)
downloadcgit-origin/jh/graph.tar.gz
ui-log: Move 'Age' column back to the far left when commit graph is disabledorigin/jh/graph
Commit be0893b moved the 'Age' column from the far left in order to make room for the commit graph. When the commit graph is not used, the 'Age' column should move back to its original position on the far left. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r--ui-log.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/ui-log.c b/ui-log.c
index 9e8d241..de5cac6 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -91,9 +91,20 @@ void show_commit_decorations(struct commit *commit)
}
}
-static void print_commit_line(struct commit *commit, struct commitinfo *info)
+static void print_commit_line(struct commit *commit, struct commitinfo *info,
+ int age_first)
{
char *tmp;
+ tmp = fmt("id=%s", sha1_to_hex(commit->object.sha1));
+ tmp = cgit_fileurl(ctx.repo->url, "commit", ctx.qry.vpath, tmp);
+
+ if (age_first) {
+ html("<td>");
+ html_link_open(tmp, NULL, NULL);
+ cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE);
+ html_link_close();
+ html("</td>");
+ }
htmlf("<td%s>", ctx.qry.showmsg ? " class='logsubject'" : "");
if (ctx.qry.showmsg) {
@@ -143,12 +154,14 @@ static void print_commit_line(struct commit *commit, struct commitinfo *info)
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 (!age_first) {
+ html("</td><td>");
+ 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;
@@ -195,7 +208,7 @@ void print_commit(struct commit *commit, struct rev_info *revs)
else
htmlf("<tr%s>", ctx.qry.showmsg ? " class='logheader'" : "");
- print_commit_line(commit, info);
+ print_commit_line(commit, info, !revs->graph);
html("</tr>\n");
if (revs->graph) {
@@ -308,6 +321,8 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
html("<tr class='nohover'>");
if (commit_graph)
html("<th></th>");
+ else
+ html("<th class='left'>Age</th>");
html("<th class='left'>Commit message");
if (pager) {
html(" (");
@@ -317,7 +332,9 @@ 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><th class='left'>Age</th>");
+ html("</th><th class='left'>Author</th>");
+ if (commit_graph)
+ html("<th class='left'>Age</th>");
if (ctx.repo->enable_log_filecount) {
html("<th class='left'>Files</th>");
columns++;