X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/6c14f5e457e17da9205588c273d7cb9f92a23b9f..78031f92b0ff064efa82065a3cf6020c1256a5fd:/ui-commit.c diff --git a/ui-commit.c b/ui-commit.c index 2d36015..dd36cc0 100644 --- a/ui-commit.c +++ b/ui-commit.c @@ -7,61 +7,207 @@ */ #include "cgit.h" +#include "html.h" +#include "ui-shared.h" +#include "ui-diff.h" -void cgit_print_commit(const char *hex) +static int files, slots; +static int total_adds, total_rems, max_changes; +static int lines_added, lines_removed; +static char *curr_rev; + +static struct fileinfo { + char status; + unsigned char old_sha1[20]; + unsigned char new_sha1[20]; + unsigned short old_mode; + unsigned short new_mode; + char *old_path; + char *new_path; + unsigned int added; + unsigned int removed; +} *items; + + +void print_fileinfo(struct fileinfo *info) +{ + char *class; + + switch (info->status) { + case DIFF_STATUS_ADDED: + class = "add"; + break; + case DIFF_STATUS_COPIED: + class = "cpy"; + break; + case DIFF_STATUS_DELETED: + class = "del"; + break; + case DIFF_STATUS_MODIFIED: + class = "upd"; + break; + case DIFF_STATUS_RENAMED: + class = "mov"; + break; + case DIFF_STATUS_TYPE_CHANGED: + class = "typ"; + break; + case DIFF_STATUS_UNKNOWN: + class = "unk"; + break; + case DIFF_STATUS_UNMERGED: + class = "stg"; + break; + default: + die("bug: unhandled diff status %c", info->status); + } + + html("
| ", + info->added * 100.0 / max_changes); + htmlf(" | ", + info->removed * 100.0 / max_changes); + htmlf(" | ", + (max_changes - info->removed - info->added) * 100.0 / max_changes); + html(" |
| author | ");
+ html("
");
@@ -70,8 +216,21 @@ void cgit_print_commit(const char *hex)
html(" ");
html_txt(info->msg);
html(" ");
- free(info->author);
- free(info->committer);
- free(info->subject);
- free(info);
+ if (!(commit->parents && commit->parents->next && commit->parents->next->next)) {
+ html("Diffstat ");
+ html(" | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|