mirror of
https://git.zx2c4.com/cgit
synced 2024-11-26 10:28:42 +00:00
Change commit-view to expect h parameter, not id
The change makes the commit-page benefit from repo.defbranch. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
This commit is contained in:
parent
b28b105ec1
commit
a2ddc10479
2
cgit.c
2
cgit.c
@ -116,7 +116,7 @@ static void cgit_print_repo_page(struct cacheitem *item)
|
|||||||
} else if (!strcmp(cgit_query_page, "tree")) {
|
} else if (!strcmp(cgit_query_page, "tree")) {
|
||||||
cgit_print_tree(cgit_query_head, cgit_query_sha1, cgit_query_path);
|
cgit_print_tree(cgit_query_head, cgit_query_sha1, cgit_query_path);
|
||||||
} else if (!strcmp(cgit_query_page, "commit")) {
|
} else if (!strcmp(cgit_query_page, "commit")) {
|
||||||
cgit_print_commit(cgit_query_sha1);
|
cgit_print_commit(cgit_query_head);
|
||||||
} else if (!strcmp(cgit_query_page, "view")) {
|
} else if (!strcmp(cgit_query_page, "view")) {
|
||||||
cgit_print_view(cgit_query_sha1, cgit_query_path);
|
cgit_print_view(cgit_query_sha1, cgit_query_path);
|
||||||
} else if (!strcmp(cgit_query_page, "diff")) {
|
} else if (!strcmp(cgit_query_page, "diff")) {
|
||||||
|
@ -197,7 +197,7 @@ void cgit_print_commit(const char *hex)
|
|||||||
html("<tr><th>parent</th>"
|
html("<tr><th>parent</th>"
|
||||||
"<td colspan='2' class='sha1'>"
|
"<td colspan='2' class='sha1'>"
|
||||||
"<a href='");
|
"<a href='");
|
||||||
query = fmt("id=%s", sha1_to_hex(p->item->object.sha1));
|
query = fmt("h=%s", sha1_to_hex(p->item->object.sha1));
|
||||||
html_attr(cgit_pageurl(cgit_query_repo, "commit", query));
|
html_attr(cgit_pageurl(cgit_query_repo, "commit", query));
|
||||||
htmlf("'>%s</a> (<a href='",
|
htmlf("'>%s</a> (<a href='",
|
||||||
sha1_to_hex(p->item->object.sha1));
|
sha1_to_hex(p->item->object.sha1));
|
||||||
|
3
ui-log.c
3
ui-log.c
@ -34,7 +34,7 @@ void print_commit(struct commit *commit)
|
|||||||
strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M", time);
|
strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M", time);
|
||||||
html_txt(buf);
|
html_txt(buf);
|
||||||
html("</td><td>");
|
html("</td><td>");
|
||||||
char *qry = fmt("id=%s", sha1_to_hex(commit->object.sha1));
|
char *qry = fmt("h=%s", sha1_to_hex(commit->object.sha1));
|
||||||
char *url = cgit_pageurl(cgit_query_repo, "commit", qry);
|
char *url = cgit_pageurl(cgit_query_repo, "commit", qry);
|
||||||
html_link_open(url, NULL, NULL);
|
html_link_open(url, NULL, NULL);
|
||||||
html_ntxt(cgit_max_msg_len, info->subject);
|
html_ntxt(cgit_max_msg_len, info->subject);
|
||||||
@ -121,4 +121,3 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path)
|
|||||||
}
|
}
|
||||||
html("</div>");
|
html("</div>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
16
ui-summary.c
16
ui-summary.c
@ -33,7 +33,7 @@ static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1,
|
|||||||
html_txt(info->author);
|
html_txt(info->author);
|
||||||
html("</td><td>");
|
html("</td><td>");
|
||||||
url = cgit_pageurl(cgit_query_repo, "commit",
|
url = cgit_pageurl(cgit_query_repo, "commit",
|
||||||
fmt("id=%s", sha1_to_hex(sha1)));
|
fmt("h=%s", sha1_to_hex(sha1)));
|
||||||
html_link_open(url, NULL, NULL);
|
html_link_open(url, NULL, NULL);
|
||||||
html_ntxt(cgit_max_msg_len, info->subject);
|
html_ntxt(cgit_max_msg_len, info->subject);
|
||||||
html_link_close();
|
html_link_close();
|
||||||
@ -52,17 +52,21 @@ static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1,
|
|||||||
|
|
||||||
static void cgit_print_object_ref(struct object *obj)
|
static void cgit_print_object_ref(struct object *obj)
|
||||||
{
|
{
|
||||||
char *page, *url;
|
char *page, *arg, *url;
|
||||||
|
|
||||||
if (obj->type == OBJ_COMMIT)
|
if (obj->type == OBJ_COMMIT) {
|
||||||
page = "commit";
|
page = "commit";
|
||||||
else if (obj->type == OBJ_TREE)
|
arg = "h";
|
||||||
|
} else if (obj->type == OBJ_TREE) {
|
||||||
page = "tree";
|
page = "tree";
|
||||||
else
|
arg = "id";
|
||||||
|
} else {
|
||||||
page = "view";
|
page = "view";
|
||||||
|
arg = "id";
|
||||||
|
}
|
||||||
|
|
||||||
url = cgit_pageurl(cgit_query_repo, page,
|
url = cgit_pageurl(cgit_query_repo, page,
|
||||||
fmt("id=%s", sha1_to_hex(obj->sha1)));
|
fmt("%s=%s", arg, sha1_to_hex(obj->sha1)));
|
||||||
html_link_open(url, NULL, NULL);
|
html_link_open(url, NULL, NULL);
|
||||||
htmlf("%s %s", typename(obj->type),
|
htmlf("%s %s", typename(obj->type),
|
||||||
sha1_to_hex(obj->sha1));
|
sha1_to_hex(obj->sha1));
|
||||||
|
Loading…
Reference in New Issue
Block a user