summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ui-commit.c9
-rw-r--r--ui-log.c4
-rw-r--r--ui-refs.c2
-rw-r--r--ui-shared.c9
-rw-r--r--ui-shared.h3
5 files changed, 15 insertions, 12 deletions
diff --git a/ui-commit.c b/ui-commit.c
index 1793921..2d98ed9 100644
--- a/ui-commit.c
+++ b/ui-commit.c
@@ -55,20 +55,20 @@ void cgit_print_commit(char *hex, const char *prefix)
55 } 55 }
56 html("</td><td class='right'>"); 56 html("</td><td class='right'>");
57 cgit_print_date(info->committer_date, FMT_LONGDATE, ctx.cfg.local_time); 57 cgit_print_date(info->committer_date, FMT_LONGDATE, ctx.cfg.local_time);
58 html("</td></tr>\n"); 58 html("</td></tr>\n");
59 html("<tr><th>commit</th><td colspan='2' class='sha1'>"); 59 html("<tr><th>commit</th><td colspan='2' class='sha1'>");
60 tmp = sha1_to_hex(commit->object.sha1); 60 tmp = sha1_to_hex(commit->object.sha1);
61 cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp, 0); 61 cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp, prefix, 0);
62 html(" ("); 62 html(" (");
63 cgit_patch_link("patch", NULL, NULL, NULL, tmp, prefix); 63 cgit_patch_link("patch", NULL, NULL, NULL, tmp, prefix);
64 html(") ("); 64 html(") (");
65 if ((ctx.qry.ssdiff && !ctx.cfg.ssdiff) || (!ctx.qry.ssdiff && ctx.cfg.ssdiff)) 65 if ((ctx.qry.ssdiff && !ctx.cfg.ssdiff) || (!ctx.qry.ssdiff && ctx.cfg.ssdiff))
66 cgit_commit_link("unidiff", NULL, NULL, ctx.qry.head, tmp, 1); 66 cgit_commit_link("unidiff", NULL, NULL, ctx.qry.head, tmp, prefix, 1);
67 else 67 else
68 cgit_commit_link("side-by-side diff", NULL, NULL, ctx.qry.head, tmp, 1); 68 cgit_commit_link("side-by-side diff", NULL, NULL, ctx.qry.head, tmp, prefix, 1);
69 html(")</td></tr>\n"); 69 html(")</td></tr>\n");
70 html("<tr><th>tree</th><td colspan='2' class='sha1'>"); 70 html("<tr><th>tree</th><td colspan='2' class='sha1'>");
71 tmp = xstrdup(hex); 71 tmp = xstrdup(hex);
72 cgit_tree_link(sha1_to_hex(commit->tree->object.sha1), NULL, NULL, 72 cgit_tree_link(sha1_to_hex(commit->tree->object.sha1), NULL, NULL,
73 ctx.qry.head, tmp, NULL); 73 ctx.qry.head, tmp, NULL);
74 if (prefix) { 74 if (prefix) {
@@ -84,13 +84,14 @@ void cgit_print_commit(char *hex, const char *prefix)
84 html("</td></tr>"); 84 html("</td></tr>");
85 continue; 85 continue;
86 } 86 }
87 html("<tr><th>parent</th>" 87 html("<tr><th>parent</th>"
88 "<td colspan='2' class='sha1'>"); 88 "<td colspan='2' class='sha1'>");
89 cgit_commit_link(sha1_to_hex(p->item->object.sha1), NULL, NULL, 89 cgit_commit_link(sha1_to_hex(p->item->object.sha1), NULL, NULL,
90 ctx.qry.head, sha1_to_hex(p->item->object.sha1), 0); 90 ctx.qry.head,
91 sha1_to_hex(p->item->object.sha1), prefix, 0);
91 html(" ("); 92 html(" (");
92 cgit_diff_link("diff", NULL, NULL, ctx.qry.head, hex, 93 cgit_diff_link("diff", NULL, NULL, ctx.qry.head, hex,
93 sha1_to_hex(p->item->object.sha1), prefix, 0); 94 sha1_to_hex(p->item->object.sha1), prefix, 0);
94 html(")</td></tr>"); 95 html(")</td></tr>");
95 parents++; 96 parents++;
96 } 97 }
diff --git a/ui-log.c b/ui-log.c
index 0947604..282eca3 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -63,13 +63,13 @@ void show_commit_decorations(struct commit *commit)
63 sha1_to_hex(commit->object.sha1), NULL, 63 sha1_to_hex(commit->object.sha1), NULL,
64 0, NULL, NULL, ctx.qry.showmsg); 64 0, NULL, NULL, ctx.qry.showmsg);
65 } 65 }
66 else { 66 else {
67 strncpy(buf, deco->name, sizeof(buf) - 1); 67 strncpy(buf, deco->name, sizeof(buf) - 1);
68 cgit_commit_link(buf, NULL, "deco", ctx.qry.head, 68 cgit_commit_link(buf, NULL, "deco", ctx.qry.head,
69 sha1_to_hex(commit->object.sha1), 0); 69 sha1_to_hex(commit->object.sha1), NULL, 0);
70 } 70 }
71 deco = deco->next; 71 deco = deco->next;
72 } 72 }
73} 73}
74 74
75void print_commit(struct commit *commit) 75void print_commit(struct commit *commit)
@@ -86,13 +86,13 @@ void print_commit(struct commit *commit)
86 html_link_open(tmp, NULL, NULL); 86 html_link_open(tmp, NULL, NULL);
87 cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE); 87 cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE);
88 html_link_close(); 88 html_link_close();
89 htmlf("</td><td%s>", 89 htmlf("</td><td%s>",
90 ctx.qry.showmsg ? " class='logsubject'" : ""); 90 ctx.qry.showmsg ? " class='logsubject'" : "");
91 cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, 91 cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head,
92 sha1_to_hex(commit->object.sha1), 0); 92 sha1_to_hex(commit->object.sha1), NULL, 0);
93 show_commit_decorations(commit); 93 show_commit_decorations(commit);
94 html("</td><td>"); 94 html("</td><td>");
95 html_txt(info->author); 95 html_txt(info->author);
96 if (ctx.repo->enable_log_filecount) { 96 if (ctx.repo->enable_log_filecount) {
97 files = 0; 97 files = 0;
98 add_lines = 0; 98 add_lines = 0;
diff --git a/ui-refs.c b/ui-refs.c
index 98738db..94ff6be 100644
--- a/ui-refs.c
+++ b/ui-refs.c
@@ -71,13 +71,13 @@ static int print_branch(struct refinfo *ref)
71 html("<tr><td>"); 71 html("<tr><td>");
72 cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0, NULL, NULL, 72 cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0, NULL, NULL,
73 ctx.qry.showmsg); 73 ctx.qry.showmsg);
74 html("</td><td>"); 74 html("</td><td>");
75 75
76 if (ref->object->type == OBJ_COMMIT) { 76 if (ref->object->type == OBJ_COMMIT) {
77 cgit_commit_link(info->subject, NULL, NULL, name, NULL, 0); 77 cgit_commit_link(info->subject, NULL, NULL, name, NULL, NULL, 0);
78 html("</td><td>"); 78 html("</td><td>");
79 html_txt(info->author); 79 html_txt(info->author);
80 html("</td><td colspan='2'>"); 80 html("</td><td colspan='2'>");
81 cgit_print_age(info->commit->date, -1, NULL); 81 cgit_print_age(info->commit->date, -1, NULL);
82 } else { 82 } else {
83 html("</td><td></td><td>"); 83 html("</td><td></td><td>");
diff --git a/ui-shared.c b/ui-shared.c
index d5c4c10..372b9e7 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -316,24 +316,25 @@ void cgit_log_link(const char *name, const char *title, const char *class,
316 html("'>"); 316 html("'>");
317 html_txt(name); 317 html_txt(name);
318 html("</a>"); 318 html("</a>");
319} 319}
320 320
321void cgit_commit_link(char *name, const char *title, const char *class, 321void cgit_commit_link(char *name, const char *title, const char *class,
322 const char *head, const char *rev, int toggle_ssdiff) 322 const char *head, const char *rev, const char *path,
323 int toggle_ssdiff)
323{ 324{
324 if (strlen(name) > ctx.cfg.max_msg_len && ctx.cfg.max_msg_len >= 15) { 325 if (strlen(name) > ctx.cfg.max_msg_len && ctx.cfg.max_msg_len >= 15) {
325 name[ctx.cfg.max_msg_len] = '\0'; 326 name[ctx.cfg.max_msg_len] = '\0';
326 name[ctx.cfg.max_msg_len - 1] = '.'; 327 name[ctx.cfg.max_msg_len - 1] = '.';
327 name[ctx.cfg.max_msg_len - 2] = '.'; 328 name[ctx.cfg.max_msg_len - 2] = '.';
328 name[ctx.cfg.max_msg_len - 3] = '.'; 329 name[ctx.cfg.max_msg_len - 3] = '.';
329 } 330 }
330 331
331 char *delim; 332 char *delim;
332 333
333 delim = repolink(title, class, "commit", head, NULL); 334 delim = repolink(title, class, "commit", head, path);
334 if (rev && strcmp(rev, ctx.qry.head)) { 335 if (rev && strcmp(rev, ctx.qry.head)) {
335 html(delim); 336 html(delim);
336 html("id="); 337 html("id=");
337 html_url_arg(rev); 338 html_url_arg(rev);
338 delim = "&amp;"; 339 delim = "&amp;";
339 } 340 }
@@ -463,13 +464,13 @@ void cgit_object_link(struct object *obj)
463 464
464 fullrev = sha1_to_hex(obj->sha1); 465 fullrev = sha1_to_hex(obj->sha1);
465 shortrev = xstrdup(fullrev); 466 shortrev = xstrdup(fullrev);
466 shortrev[10] = '\0'; 467 shortrev[10] = '\0';
467 if (obj->type == OBJ_COMMIT) { 468 if (obj->type == OBJ_COMMIT) {
468 cgit_commit_link(fmt("commit %s...", shortrev), NULL, NULL, 469 cgit_commit_link(fmt("commit %s...", shortrev), NULL, NULL,
469 ctx.qry.head, fullrev, 0); 470 ctx.qry.head, fullrev, NULL, 0);
470 return; 471 return;
471 } else if (obj->type == OBJ_TREE) 472 } else if (obj->type == OBJ_TREE)
472 page = "tree"; 473 page = "tree";
473 else if (obj->type == OBJ_TAG) 474 else if (obj->type == OBJ_TAG)
474 page = "tag"; 475 page = "tag";
475 else 476 else
@@ -790,13 +791,13 @@ void cgit_print_pageheader(struct cgit_context *ctx)
790 ctx->qry.sha1, NULL); 791 ctx->qry.sha1, NULL);
791 cgit_log_link("log", NULL, hc(ctx, "log"), ctx->qry.head, 792 cgit_log_link("log", NULL, hc(ctx, "log"), ctx->qry.head,
792 NULL, NULL, 0, NULL, NULL, ctx->qry.showmsg); 793 NULL, NULL, 0, NULL, NULL, ctx->qry.showmsg);
793 cgit_tree_link("tree", NULL, hc(ctx, "tree"), ctx->qry.head, 794 cgit_tree_link("tree", NULL, hc(ctx, "tree"), ctx->qry.head,
794 ctx->qry.sha1, NULL); 795 ctx->qry.sha1, NULL);
795 cgit_commit_link("commit", NULL, hc(ctx, "commit"), 796 cgit_commit_link("commit", NULL, hc(ctx, "commit"),
796 ctx->qry.head, ctx->qry.sha1, 0); 797 ctx->qry.head, ctx->qry.sha1, NULL, 0);
797 cgit_diff_link("diff", NULL, hc(ctx, "diff"), ctx->qry.head, 798 cgit_diff_link("diff", NULL, hc(ctx, "diff"), ctx->qry.head,
798 ctx->qry.sha1, ctx->qry.sha2, NULL, 0); 799 ctx->qry.sha1, ctx->qry.sha2, NULL, 0);
799 if (ctx->repo->max_stats) 800 if (ctx->repo->max_stats)
800 cgit_stats_link("stats", NULL, hc(ctx, "stats"), 801 cgit_stats_link("stats", NULL, hc(ctx, "stats"),
801 ctx->qry.head, NULL); 802 ctx->qry.head, NULL);
802 if (ctx->repo->readme) 803 if (ctx->repo->readme)
diff --git a/ui-shared.h b/ui-shared.h
index c0e5c55..3cc1258 100644
--- a/ui-shared.h
+++ b/ui-shared.h
@@ -26,13 +26,14 @@ extern void cgit_plain_link(const char *name, const char *title,
26extern void cgit_log_link(const char *name, const char *title, 26extern void cgit_log_link(const char *name, const char *title,
27 const char *class, const char *head, const char *rev, 27 const char *class, const char *head, const char *rev,
28 const char *path, int ofs, const char *grep, 28 const char *path, int ofs, const char *grep,
29 const char *pattern, int showmsg); 29 const char *pattern, int showmsg);
30extern void cgit_commit_link(char *name, const char *title, 30extern void cgit_commit_link(char *name, const char *title,
31 const char *class, const char *head, 31 const char *class, const char *head,
32 const char *rev, int toggle_ssdiff); 32 const char *rev, const char *path,
33 int toggle_ssdiff);
33extern void cgit_patch_link(const char *name, const char *title, 34extern void cgit_patch_link(const char *name, const char *title,
34 const char *class, const char *head, 35 const char *class, const char *head,
35 const char *rev, const char *path); 36 const char *rev, const char *path);
36extern void cgit_refs_link(const char *name, const char *title, 37extern void cgit_refs_link(const char *name, const char *title,
37 const char *class, const char *head, 38 const char *class, const char *head,
38 const char *rev, const char *path); 39 const char *rev, const char *path);