diff options
| -rw-r--r-- | cgit.css | 27 | ||||
| -rw-r--r-- | cmd.c | 2 | ||||
| -rw-r--r-- | html.c | 8 | ||||
| -rw-r--r-- | html.h | 1 | ||||
| -rw-r--r-- | ui-commit.c | 10 | ||||
| -rw-r--r-- | ui-diff.c | 83 | ||||
| -rw-r--r-- | ui-diff.h | 4 | ||||
| -rw-r--r-- | ui-stats.c | 51 |
8 files changed, 124 insertions, 62 deletions
| @@ -331,6 +331,33 @@ table.commit-info { | |||
| 331 | margin-top: 1.5em; | 331 | margin-top: 1.5em; |
| 332 | } | 332 | } |
| 333 | 333 | ||
| 334 | div.cgit-panel { | ||
| 335 | float: right; | ||
| 336 | margin-top: 1.5em; | ||
| 337 | } | ||
| 338 | |||
| 339 | div.cgit-panel table { | ||
| 340 | border-collapse: collapse; | ||
| 341 | border: solid 1px #aaa; | ||
| 342 | background-color: #eee; | ||
| 343 | } | ||
| 344 | |||
| 345 | div.cgit-panel th { | ||
| 346 | text-align: center; | ||
| 347 | } | ||
| 348 | |||
| 349 | div.cgit-panel td { | ||
| 350 | padding: 0.25em 0.5em; | ||
| 351 | } | ||
| 352 | |||
| 353 | div.cgit-panel td.label { | ||
| 354 | padding-right: 0.5em; | ||
| 355 | } | ||
| 356 | |||
| 357 | div.cgit-panel td.ctrl { | ||
| 358 | padding-left: 0.5em; | ||
| 359 | } | ||
| 360 | |||
| 334 | table.commit-info th { | 361 | table.commit-info th { |
| 335 | text-align: left; | 362 | text-align: left; |
| 336 | font-weight: normal; | 363 | font-weight: normal; |
| @@ -56,7 +56,7 @@ static void commit_fn(struct cgit_context *ctx) | |||
| 56 | 56 | ||
| 57 | static void diff_fn(struct cgit_context *ctx) | 57 | static void diff_fn(struct cgit_context *ctx) |
| 58 | { | 58 | { |
| 59 | cgit_print_diff(ctx->qry.sha1, ctx->qry.sha2, ctx->qry.path); | 59 | cgit_print_diff(ctx->qry.sha1, ctx->qry.sha2, ctx->qry.path, 1); |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | static void info_fn(struct cgit_context *ctx) | 62 | static void info_fn(struct cgit_context *ctx) |
| @@ -213,6 +213,14 @@ void html_option(const char *value, const char *text, const char *selected_value | |||
| 213 | html("</option>\n"); | 213 | html("</option>\n"); |
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | void html_intoption(int value, const char *text, int selected_value) | ||
| 217 | { | ||
| 218 | htmlf("<option value='%d'%s>", value, | ||
| 219 | value == selected_value ? " selected='selected'" : ""); | ||
| 220 | html_txt(text); | ||
| 221 | html("</option>"); | ||
| 222 | } | ||
| 223 | |||
| 216 | void html_link_open(const char *url, const char *title, const char *class) | 224 | void html_link_open(const char *url, const char *title, const char *class) |
| 217 | { | 225 | { |
| 218 | html("<a href='"); | 226 | html("<a href='"); |
| @@ -17,6 +17,7 @@ extern void html_url_path(const char *txt); | |||
| 17 | extern void html_url_arg(const char *txt); | 17 | extern void html_url_arg(const char *txt); |
| 18 | extern void html_hidden(const char *name, const char *value); | 18 | extern void html_hidden(const char *name, const char *value); |
| 19 | extern void html_option(const char *value, const char *text, const char *selected_value); | 19 | extern void html_option(const char *value, const char *text, const char *selected_value); |
| 20 | extern void html_intoption(int value, const char *text, int selected_value); | ||
| 20 | extern void html_link_open(const char *url, const char *title, const char *class); | 21 | extern void html_link_open(const char *url, const char *title, const char *class); |
| 21 | extern void html_link_close(void); | 22 | extern void html_link_close(void); |
| 22 | extern void html_fileperm(unsigned short mode); | 23 | extern void html_fileperm(unsigned short mode); |
diff --git a/ui-commit.c b/ui-commit.c index 2da9fcf..a69dec6 100644 --- a/ui-commit.c +++ b/ui-commit.c | |||
| @@ -39,7 +39,8 @@ void cgit_print_commit(char *hex, const char *prefix) | |||
| 39 | format_note(NULL, sha1, ¬es, PAGE_ENCODING, 0); | 39 | format_note(NULL, sha1, ¬es, PAGE_ENCODING, 0); |
| 40 | 40 | ||
| 41 | load_ref_decorations(DECORATE_FULL_REFS); | 41 | load_ref_decorations(DECORATE_FULL_REFS); |
| 42 | 42 | ||
| 43 | cgit_print_diff_ctrls(); | ||
| 43 | html("<table summary='commit info' class='commit-info'>\n"); | 44 | html("<table summary='commit info' class='commit-info'>\n"); |
| 44 | html("<tr><th>author</th><td>"); | 45 | html("<tr><th>author</th><td>"); |
| 45 | html_txt(info->author); | 46 | html_txt(info->author); |
| @@ -64,11 +65,6 @@ void cgit_print_commit(char *hex, const char *prefix) | |||
| 64 | cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp, prefix, 0); | 65 | cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp, prefix, 0); |
| 65 | html(" ("); | 66 | html(" ("); |
| 66 | cgit_patch_link("patch", NULL, NULL, NULL, tmp, prefix); | 67 | cgit_patch_link("patch", NULL, NULL, NULL, tmp, prefix); |
| 67 | html(") ("); | ||
| 68 | if ((ctx.qry.ssdiff && !ctx.cfg.ssdiff) || (!ctx.qry.ssdiff && ctx.cfg.ssdiff)) | ||
| 69 | cgit_commit_link("unidiff", NULL, NULL, ctx.qry.head, tmp, prefix, 1); | ||
| 70 | else | ||
| 71 | cgit_commit_link("side-by-side diff", NULL, NULL, ctx.qry.head, tmp, prefix, 1); | ||
| 72 | html(")</td></tr>\n"); | 68 | html(")</td></tr>\n"); |
| 73 | html("<tr><th>tree</th><td colspan='2' class='sha1'>"); | 69 | html("<tr><th>tree</th><td colspan='2' class='sha1'>"); |
| 74 | tmp = xstrdup(hex); | 70 | tmp = xstrdup(hex); |
| @@ -139,7 +135,7 @@ void cgit_print_commit(char *hex, const char *prefix) | |||
| 139 | tmp = sha1_to_hex(commit->parents->item->object.sha1); | 135 | tmp = sha1_to_hex(commit->parents->item->object.sha1); |
| 140 | else | 136 | else |
| 141 | tmp = NULL; | 137 | tmp = NULL; |
| 142 | cgit_print_diff(ctx.qry.sha1, tmp, prefix); | 138 | cgit_print_diff(ctx.qry.sha1, tmp, prefix, 0); |
| 143 | } | 139 | } |
| 144 | strbuf_release(¬es); | 140 | strbuf_release(¬es); |
| 145 | cgit_free_commitinfo(info); | 141 | cgit_free_commitinfo(info); |
| @@ -167,7 +167,7 @@ static void inspect_filepair(struct diff_filepair *pair) | |||
| 167 | void cgit_print_diffstat(const unsigned char *old_sha1, | 167 | void cgit_print_diffstat(const unsigned char *old_sha1, |
| 168 | const unsigned char *new_sha1, const char *prefix) | 168 | const unsigned char *new_sha1, const char *prefix) |
| 169 | { | 169 | { |
| 170 | int i, save_context = ctx.qry.context; | 170 | int i; |
| 171 | 171 | ||
| 172 | html("<div class='diffstat-header'>"); | 172 | html("<div class='diffstat-header'>"); |
| 173 | cgit_diff_link("Diffstat", NULL, NULL, ctx.qry.head, ctx.qry.sha1, | 173 | cgit_diff_link("Diffstat", NULL, NULL, ctx.qry.head, ctx.qry.sha1, |
| @@ -177,19 +177,6 @@ void cgit_print_diffstat(const unsigned char *old_sha1, | |||
| 177 | html_txt(prefix); | 177 | html_txt(prefix); |
| 178 | html("')"); | 178 | html("')"); |
| 179 | } | 179 | } |
| 180 | html(" ("); | ||
| 181 | ctx.qry.context = (save_context > 0 ? save_context : 3) << 1; | ||
| 182 | cgit_self_link("more", NULL, NULL, &ctx); | ||
| 183 | html("/"); | ||
| 184 | ctx.qry.context = (save_context > 3 ? save_context : 3) >> 1; | ||
| 185 | cgit_self_link("less", NULL, NULL, &ctx); | ||
| 186 | ctx.qry.context = save_context; | ||
| 187 | html(" context)"); | ||
| 188 | html(" ("); | ||
| 189 | ctx.qry.ignorews = (ctx.qry.ignorews + 1) % 2; | ||
| 190 | cgit_self_link(ctx.qry.ignorews ? "ignore" : "show", NULL, NULL, &ctx); | ||
| 191 | ctx.qry.ignorews = (ctx.qry.ignorews + 1) % 2; | ||
| 192 | html(" whitespace changes)"); | ||
| 193 | html("</div>"); | 180 | html("</div>"); |
| 194 | html("<table summary='diffstat' class='diffstat'>"); | 181 | html("<table summary='diffstat' class='diffstat'>"); |
| 195 | max_changes = 0; | 182 | max_changes = 0; |
| @@ -278,19 +265,6 @@ static void header(unsigned char *sha1, char *path1, int mode1, | |||
| 278 | html("</div>"); | 265 | html("</div>"); |
| 279 | } | 266 | } |
| 280 | 267 | ||
| 281 | static void print_ssdiff_link() | ||
| 282 | { | ||
| 283 | if (!strcmp(ctx.qry.page, "diff")) { | ||
| 284 | if (use_ssdiff) | ||
| 285 | cgit_diff_link("Unidiff", NULL, NULL, ctx.qry.head, | ||
