-rw-r--r-- | ui-shared.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/ui-shared.c b/ui-shared.c index 76cd00d..fba1ba6 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -278,13 +278,14 @@ void cgit_plain_link(char *name, char *title, char *class, char *head, | |||
278 | char *rev, char *path) | 278 | char *rev, char *path) |
279 | { | 279 | { |
280 | reporevlink("plain", name, title, class, head, rev, path); | 280 | reporevlink("plain", name, title, class, head, rev, path); |
281 | } | 281 | } |
282 | 282 | ||
283 | void cgit_log_link(char *name, char *title, char *class, char *head, | 283 | void cgit_log_link(char *name, char *title, char *class, char *head, |
284 | char *rev, char *path, int ofs, char *grep, char *pattern) | 284 | char *rev, char *path, int ofs, char *grep, char *pattern, |
285 | int showmsg) | ||
285 | { | 286 | { |
286 | char *delim; | 287 | char *delim; |
287 | 288 | ||
288 | delim = repolink(title, class, "log", head, path); | 289 | delim = repolink(title, class, "log", head, path); |
289 | if (rev && strcmp(rev, ctx.qry.head)) { | 290 | if (rev && strcmp(rev, ctx.qry.head)) { |
290 | html(delim); | 291 | html(delim); |
@@ -302,12 +303,17 @@ void cgit_log_link(char *name, char *title, char *class, char *head, | |||
302 | html_url_arg(pattern); | 303 | html_url_arg(pattern); |
303 | } | 304 | } |
304 | if (ofs > 0) { | 305 | if (ofs > 0) { |
305 | html(delim); | 306 | html(delim); |
306 | html("ofs="); | 307 | html("ofs="); |
307 | htmlf("%d", ofs); | 308 | htmlf("%d", ofs); |
309 | delim = "&"; | ||
310 | } | ||
311 | if (showmsg) { | ||
312 | html(delim); | ||
313 | html("showmsg=1"); | ||
308 | } | 314 | } |
309 | html("'>"); | 315 | html("'>"); |
310 | html_txt(name); | 316 | html_txt(name); |
311 | html("</a>"); | 317 | html("</a>"); |
312 | } | 318 | } |
313 | 319 | ||
@@ -362,27 +368,29 @@ void cgit_patch_link(char *name, char *title, char *class, char *head, | |||
362 | { | 368 | { |
363 | reporevlink("patch", name, title, class, head, rev, NULL); | 369 | reporevlink("patch", name, title, class, head, rev, NULL); |
364 | } | 370 | } |
365 | 371 | ||
366 | void cgit_object_link(struct object *obj) | 372 | void cgit_object_link(struct object *obj) |
367 | { | 373 | { |
368 | char *page, *rev, *name; | 374 | char *page, *shortrev, *fullrev, *name; |
369 | 375 | ||
376 | fullrev = sha1_to_hex(obj->sha1); | ||
377 | shortrev = xstrdup(fullrev); | ||
378 | shortrev[10] = '\0'; | ||
370 | if (obj->type == OBJ_COMMIT) { | 379 | if (obj->type == OBJ_COMMIT) { |
371 | cgit_commit_link(fmt("commit %s", sha1_to_hex(obj->sha1)), NULL, NULL, | 380 | cgit_commit_link(fmt("commit %s...", shortrev), NULL, NULL, |
372 | ctx.qry.head, sha1_to_hex(obj->sha1)); | 381 | ctx.qry.head, fullrev); |
373 | return; | 382 | return; |
374 | } else if (obj->type == OBJ_TREE) | 383 | } else if (obj->type == OBJ_TREE) |
375 | page = "tree"; | 384 | page = "tree"; |
376 | else if (obj->type == OBJ_TAG) | 385 | else if (obj->type == OBJ_TAG) |
377 | page = "tag"; | 386 | page = "tag"; |
378 | else | 387 | else |
379 | page = "blob"; | 388 | page = "blob"; |
380 | rev = sha1_to_hex(obj->sha1); | 389 | name = fmt("%s %s...", typename(obj->type), shortrev); |
381 | name = fmt("%s %s", typename(obj->type), rev); | 390 | reporevlink(page, name, NULL, NULL, ctx.qry.head, fullrev, NULL); |
382 | reporevlink(page, name, NULL, NULL, ctx.qry.head, rev, NULL); | ||
383 | } | 391 | } |
384 | 392 | ||
385 | void cgit_print_date(time_t secs, char *format, int local_time) | 393 | void cgit_print_date(time_t secs, char *format, int local_time) |
386 | { | 394 | { |
387 | char buf[64]; | 395 | char buf[64]; |
388 | struct tm *time; | 396 | struct tm *time; |
@@ -565,12 +573,14 @@ void add_hidden_formfields(int incl_head, int incl_search, char *page) | |||
565 | html_hidden("h", ctx.qry.head); | 573 | html_hidden("h", ctx.qry.head); |
566 | 574 | ||
567 | if (ctx.qry.sha1) | 575 | if (ctx.qry.sha1) |
568 | html_hidden("id", ctx.qry.sha1); | 576 | html_hidden("id", ctx.qry.sha1); |
569 | if (ctx.qry.sha2) | 577 | if (ctx.qry.sha2) |
570 | html_hidden("id2", ctx.qry.sha2); | 578 | html_hidden("id2", ctx.qry.sha2); |
579 | if (ctx.qry.showmsg) | ||
580 | html_hidden("showmsg", "1"); | ||
571 | 581 | ||
572 | if (incl_search) { | 582 | if (incl_search) { |
573 | if (ctx.qry.grep) | 583 | if (ctx.qry.grep) |
574 | html_hidden("qt", ctx.qry.grep); | 584 | html_hidden("qt", ctx.qry.grep); |
575 | if (ctx.qry.search) | 585 | if (ctx.qry.search) |
576 | html_hidden("q", ctx.qry.search); | 586 | html_hidden("q", ctx.qry.search); |
@@ -636,13 +646,13 @@ void cgit_print_pageheader(struct cgit_context *ctx) | |||
636 | if (ctx->repo) { | 646 | if (ctx->repo) { |
637 | cgit_summary_link("summary", NULL, hc(cmd, "summary"), | 647 | cgit_summary_link("summary", NULL, hc(cmd, "summary"), |
638 | ctx->qry.head); | 648 | ctx->qry.head); |
639 | cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head, | 649 | cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head, |
640 | ctx->qry.sha1, NULL); | 650 | ctx->qry.sha1, NULL); |
641 | cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head, | 651 | cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head, |
642 | NULL, NULL, 0, NULL, NULL); | 652 | NULL, NULL, 0, NULL, NULL, ctx->qry.showmsg); |
643 | cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head, | 653 | cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head, |
644 | ctx->qry.sha1, NULL); | 654 | ctx->qry.sha1, NULL); |
645 | cgit_commit_link("commit", NULL, hc(cmd, "commit"), | 655 | cgit_commit_link("commit", NULL, hc(cmd, "commit"), |
646 | ctx->qry.head, ctx->qry.sha1); | 656 | ctx->qry.head, ctx->qry.sha1); |
647 | cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head, | 657 | cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head, |
648 | ctx->qry.sha1, ctx->qry.sha2, NULL); | 658 | ctx->qry.sha1, ctx->qry.sha2, NULL); |
@@ -709,11 +719,10 @@ void cgit_print_snapshot_links(const char *repo, const char *head, | |||
709 | 719 | ||
710 | for (f = cgit_snapshot_formats; f->suffix; f++) { | 720 | for (f = cgit_snapshot_formats; f->suffix; f++) { |
711 | if (!(snapshots & f->bit)) | 721 | if (!(snapshots & f->bit)) |
712 | continue; | 722 | continue; |
713 | filename = fmt("%s-%s%s", cgit_repobasename(repo), hex, | 723 | filename = fmt("%s-%s%s", cgit_repobasename(repo), hex, |
714 | f->suffix); | 724 | f->suffix); |
715 | cgit_snapshot_link(filename, NULL, NULL, (char *)head, | 725 | cgit_snapshot_link(filename, NULL, NULL, NULL, NULL, filename); |
716 | (char *)hex, filename); | ||
717 | html("<br/>"); | 726 | html("<br/>"); |
718 | } | 727 | } |
719 | } | 728 | } |