diff options
author | Lars Hjemli <hjemli@gmail.com> | 2009-12-09 03:32:48 (JST) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2009-12-09 03:32:48 (JST) |
commit | f4f6210b4f9c214dc247567bbd06b1135c9ecd06 (patch) | |
tree | 432b3dc327e05220c6ac0aff9ca81cf38a47524c /ui-shared.c | |
parent | 57bb4fdb8419d7c250d4c6146910df3263943951 (diff) | |
parent | 735e15e38a484bf0daa98776fa7cde270a271cda (diff) | |
download | cgit-f4f6210b4f9c214dc247567bbd06b1135c9ecd06.zip cgit-f4f6210b4f9c214dc247567bbd06b1135c9ecd06.tar.gz |
Merge branch 'ro/ssdiff'
Diffstat (limited to 'ui-shared.c')
-rw-r--r-- | ui-shared.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/ui-shared.c b/ui-shared.c index 3a9e67b..08ea003 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -317,7 +317,7 @@ void cgit_log_link(char *name, char *title, char *class, char *head, | |||
317 | } | 317 | } |
318 | 318 | ||
319 | void cgit_commit_link(char *name, char *title, char *class, char *head, | 319 | void cgit_commit_link(char *name, char *title, char *class, char *head, |
320 | char *rev) | 320 | char *rev, int toggle_ssdiff) |
321 | { | 321 | { |
322 | if (strlen(name) > ctx.cfg.max_msg_len && ctx.cfg.max_msg_len >= 15) { | 322 | if (strlen(name) > ctx.cfg.max_msg_len && ctx.cfg.max_msg_len >= 15) { |
323 | name[ctx.cfg.max_msg_len] = '\0'; | 323 | name[ctx.cfg.max_msg_len] = '\0'; |
@@ -325,7 +325,23 @@ void cgit_commit_link(char *name, char *title, char *class, char *head, | |||
325 | name[ctx.cfg.max_msg_len - 2] = '.'; | 325 | name[ctx.cfg.max_msg_len - 2] = '.'; |
326 | name[ctx.cfg.max_msg_len - 3] = '.'; | 326 | name[ctx.cfg.max_msg_len - 3] = '.'; |
327 | } | 327 | } |
328 | reporevlink("commit", name, title, class, head, rev, NULL); | 328 | |
329 | char *delim; | ||
330 | |||
331 | delim = repolink(title, class, "commit", head, NULL); | ||
332 | if (rev && strcmp(rev, ctx.qry.head)) { | ||
333 | html(delim); | ||
334 | html("id="); | ||
335 | html_url_arg(rev); | ||
336 | delim = "&"; | ||
337 | } | ||
338 | if ((ctx.qry.ssdiff && !toggle_ssdiff) || (!ctx.qry.ssdiff && toggle_ssdiff)) { | ||
339 | html(delim); | ||
340 | html("ss=1"); | ||
341 | } | ||
342 | html("'>"); | ||
343 | html_txt(name); | ||
344 | html("</a>"); | ||
329 | } | 345 | } |
330 | 346 | ||
331 | void cgit_refs_link(char *name, char *title, char *class, char *head, | 347 | void cgit_refs_link(char *name, char *title, char *class, char *head, |
@@ -341,7 +357,8 @@ void cgit_snapshot_link(char *name, char *title, char *class, char *head, | |||
341 | } | 357 | } |
342 | 358 | ||
343 | void cgit_diff_link(char *name, char *title, char *class, char *head, | 359 | void cgit_diff_link(char *name, char *title, char *class, char *head, |
344 | char *new_rev, char *old_rev, char *path) | 360 | char *new_rev, char *old_rev, char *path, |
361 | int toggle_ssdiff) | ||
345 | { | 362 | { |
346 | char *delim; | 363 | char *delim; |
347 | 364 | ||
@@ -356,6 +373,11 @@ void cgit_diff_link(char *name, char *title, char *class, char *head, | |||
356 | html(delim); | 373 | html(delim); |
357 | html("id2="); | 374 | html("id2="); |
358 | html_url_arg(old_rev); | 375 | html_url_arg(old_rev); |
376 | delim = "&"; | ||
377 | } | ||
378 | if ((ctx.qry.ssdiff && !toggle_ssdiff) || (!ctx.qry.ssdiff && toggle_ssdiff)) { | ||
379 | html(delim); | ||
380 | html("ss=1"); | ||
359 | } | 381 | } |
360 | html("'>"); | 382 | html("'>"); |
361 | html_txt(name); | 383 | html_txt(name); |
@@ -383,7 +405,7 @@ void cgit_object_link(struct object *obj) | |||
383 | shortrev[10] = '\0'; | 405 | shortrev[10] = '\0'; |
384 | if (obj->type == OBJ_COMMIT) { | 406 | if (obj->type == OBJ_COMMIT) { |
385 | cgit_commit_link(fmt("commit %s...", shortrev), NULL, NULL, | 407 | cgit_commit_link(fmt("commit %s...", shortrev), NULL, NULL, |
386 | ctx.qry.head, fullrev); | 408 | ctx.qry.head, fullrev, 0); |
387 | return; | 409 | return; |
388 | } else if (obj->type == OBJ_TREE) | 410 | } else if (obj->type == OBJ_TREE) |
389 | page = "tree"; | 411 | page = "tree"; |
@@ -695,9 +717,9 @@ void cgit_print_pageheader(struct cgit_context *ctx) | |||
695 | cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head, | 717 | cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head, |
696 | ctx->qry.sha1, NULL); | 718 | ctx->qry.sha1, NULL); |
697 | cgit_commit_link("commit", NULL, hc(cmd, "commit"), | 719 | cgit_commit_link("commit", NULL, hc(cmd, "commit"), |
698 | ctx->qry.head, ctx->qry.sha1); | 720 | ctx->qry.head, ctx->qry.sha1, 0); |
699 | cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head, | 721 | cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head, |
700 | ctx->qry.sha1, ctx->qry.sha2, NULL); | 722 | ctx->qry.sha1, ctx->qry.sha2, NULL, 0); |
701 | if (ctx->repo->max_stats) | 723 | if (ctx->repo->max_stats) |
702 | cgit_stats_link("stats", NULL, hc(cmd, "stats"), | 724 | cgit_stats_link("stats", NULL, hc(cmd, "stats"), |
703 | ctx->qry.head, NULL); | 725 | ctx->qry.head, NULL); |