]> gitweb.ps.run Git - ps-cgit/blobdiff - ui-commit.c
git: update to v2.42.1
[ps-cgit] / ui-commit.c
index 65b4603979552667553493854852c368f2bdb243..30672d0130a03739fb6f81ff1f079009664c7a94 100644 (file)
@@ -26,12 +26,12 @@ void cgit_print_commit(char *hex, const char *prefix)
        if (!hex)
                hex = ctx.qry.head;
 
        if (!hex)
                hex = ctx.qry.head;
 
-       if (get_oid(hex, &oid)) {
+       if (repo_get_oid(the_repository, hex, &oid)) {
                cgit_print_error_page(400, "Bad request",
                                "Bad object id: %s", hex);
                return;
        }
                cgit_print_error_page(400, "Bad request",
                                "Bad object id: %s", hex);
                return;
        }
-       commit = lookup_commit_reference(&oid);
+       commit = lookup_commit_reference(the_repository, &oid);
        if (!commit) {
                cgit_print_error_page(404, "Not found",
                                "Bad commit reference: %s", hex);
        if (!commit) {
                cgit_print_error_page(404, "Not found",
                                "Bad commit reference: %s", hex);
@@ -39,10 +39,11 @@ void cgit_print_commit(char *hex, const char *prefix)
        }
        info = cgit_parse_commit(commit);
 
        }
        info = cgit_parse_commit(commit);
 
-       format_display_notes(&oid, &notes, PAGE_ENCODING, 0);
+       format_display_notes(&oid, &notes, PAGE_ENCODING, 1);
 
        load_ref_decorations(NULL, DECORATE_FULL_REFS);
 
 
        load_ref_decorations(NULL, DECORATE_FULL_REFS);
 
+       ctx.page.title = fmtalloc("%s - %s", info->subject, ctx.page.title);
        cgit_print_layout_start();
        cgit_print_diff_ctrls();
        html("<table summary='commit info' class='commit-info'>\n");
        cgit_print_layout_start();
        cgit_print_diff_ctrls();
        html("<table summary='commit info' class='commit-info'>\n");
@@ -70,15 +71,15 @@ void cgit_print_commit(char *hex, const char *prefix)
        html_txt(show_date(info->committer_date, info->committer_tz,
                                cgit_date_mode(DATE_ISO8601)));
        html("</td></tr>\n");
        html_txt(show_date(info->committer_date, info->committer_tz,
                                cgit_date_mode(DATE_ISO8601)));
        html("</td></tr>\n");
-       html("<tr><th>commit</th><td colspan='2' class='sha1'>");
+       html("<tr><th>commit</th><td colspan='2' class='oid'>");
        tmp = oid_to_hex(&commit->object.oid);
        cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp, prefix);
        html(" (");
        cgit_patch_link("patch", NULL, NULL, NULL, tmp, prefix);
        html(")</td></tr>\n");
        tmp = oid_to_hex(&commit->object.oid);
        cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp, prefix);
        html(" (");
        cgit_patch_link("patch", NULL, NULL, NULL, tmp, prefix);
        html(")</td></tr>\n");
-       html("<tr><th>tree</th><td colspan='2' class='sha1'>");
+       html("<tr><th>tree</th><td colspan='2' class='oid'>");
        tmp = xstrdup(hex);
        tmp = xstrdup(hex);
-       cgit_tree_link(oid_to_hex(&commit->tree->object.oid), NULL, NULL,
+       cgit_tree_link(oid_to_hex(get_commit_tree_oid(commit)), NULL, NULL,
                       ctx.qry.head, tmp, NULL);
        if (prefix) {
                html(" /");
                       ctx.qry.head, tmp, NULL);
        if (prefix) {
                html(" /");
@@ -87,7 +88,7 @@ void cgit_print_commit(char *hex, const char *prefix)
        free(tmp);
        html("</td></tr>\n");
        for (p = commit->parents; p; p = p->next) {
        free(tmp);
        html("</td></tr>\n");
        for (p = commit->parents; p; p = p->next) {
-               parent = lookup_commit_reference(&p->item->object.oid);
+               parent = lookup_commit_reference(the_repository, &p->item->object.oid);
                if (!parent) {
                        html("<tr><td colspan='3'>");
                        cgit_print_error("Error reading parent commit");
                if (!parent) {
                        html("<tr><td colspan='3'>");
                        cgit_print_error("Error reading parent commit");
@@ -95,7 +96,7 @@ void cgit_print_commit(char *hex, const char *prefix)
                        continue;
                }
                html("<tr><th>parent</th>"
                        continue;
                }
                html("<tr><th>parent</th>"
-                    "<td colspan='2' class='sha1'>");
+                    "<td colspan='2' class='oid'>");
                tmp = tmp2 = oid_to_hex(&p->item->object.oid);
                if (ctx.repo->enable_subject_links) {
                        parent_info = cgit_parse_commit(parent);
                tmp = tmp2 = oid_to_hex(&p->item->object.oid);
                if (ctx.repo->enable_subject_links) {
                        parent_info = cgit_parse_commit(parent);
@@ -109,7 +110,7 @@ void cgit_print_commit(char *hex, const char *prefix)
                parents++;
        }
        if (ctx.repo->snapshots) {
                parents++;
        }
        if (ctx.repo->snapshots) {
-               html("<tr><th>download</th><td colspan='2' class='sha1'>");
+               html("<tr><th>download</th><td colspan='2' class='oid'>");
                cgit_print_snapshot_links(ctx.repo, hex, "<br/>");
                html("</td></tr>");
        }
                cgit_print_snapshot_links(ctx.repo, hex, "<br/>");
                html("</td></tr>");
        }
@@ -139,7 +140,7 @@ void cgit_print_commit(char *hex, const char *prefix)
                        tmp = oid_to_hex(&commit->parents->item->object.oid);
                else
                        tmp = NULL;
                        tmp = oid_to_hex(&commit->parents->item->object.oid);
                else
                        tmp = NULL;
-               cgit_print_diff(ctx.qry.sha1, tmp, prefix, 0, 0);
+               cgit_print_diff(ctx.qry.oid, tmp, prefix, 0, 0);
        }
        strbuf_release(&notes);
        cgit_free_commitinfo(info);
        }
        strbuf_release(&notes);
        cgit_free_commitinfo(info);