summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.c2
-rw-r--r--ui-commit.c2
-rw-r--r--ui-log.c3
-rw-r--r--ui-summary.c16
4 files changed, 13 insertions, 10 deletions
diff --git a/cgit.c b/cgit.c
index b282a67..9b4815d 100644
--- a/cgit.c
+++ b/cgit.c
@@ -113,13 +113,13 @@ static void cgit_print_repo_page(struct cacheitem *item)
cgit_print_log(cgit_query_head, cgit_query_ofs,
cgit_max_commit_count, cgit_query_search,
cgit_query_path);
} else if (!strcmp(cgit_query_page, "tree")) {
cgit_print_tree(cgit_query_head, cgit_query_sha1, cgit_query_path);
} 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")) {
cgit_print_view(cgit_query_sha1, cgit_query_path);
} else if (!strcmp(cgit_query_page, "diff")) {
cgit_print_diff(cgit_query_sha1, cgit_query_sha2, cgit_query_path);
} else {
cgit_print_error("Invalid request");
diff --git a/ui-commit.c b/ui-commit.c
index 8011dfc..93eb8fd 100644
--- a/ui-commit.c
+++ b/ui-commit.c
@@ -194,13 +194,13 @@ void cgit_print_commit(const char *hex)
html("</td></tr>");
continue;
}
html("<tr><th>parent</th>"
"<td colspan='2' class='sha1'>"
"<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));
htmlf("'>%s</a> (<a href='",
sha1_to_hex(p->item->object.sha1));
query = fmt("id=%s&id2=%s", sha1_to_hex(parent->tree->object.sha1),
sha1_to_hex(commit->tree->object.sha1));
html_attr(cgit_pageurl(cgit_query_repo, "diff", query));
diff --git a/ui-log.c b/ui-log.c
index 6d5509b..9d0ec02 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -31,13 +31,13 @@ void print_commit(struct commit *commit)
info = cgit_parse_commit(commit);
time = gmtime(&commit->date);
html("<tr><td>");
strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M", time);
html_txt(buf);
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);
html_link_open(url, NULL, NULL);
html_ntxt(cgit_max_msg_len, info->subject);
html_link_close();
files = 0;
lines = 0;
@@ -118,7 +118,6 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path)
html(cgit_pageurl(cgit_query_repo, "log",
fmt("h=%s&ofs=%d", tip, ofs+cnt)));
html("'>[next]</a>&nbsp;");
}
html("</div>");
}
-
diff --git a/ui-summary.c b/ui-summary.c
index b99ea98..e7158cc 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -30,13 +30,13 @@ static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1,
html("</td><td>");
cgit_print_date(commit->date);
html("</td><td>");
html_txt(info->author);
html("</td><td>");
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_ntxt(cgit_max_msg_len, info->subject);
html_link_close();
html("</td></tr>\n");
cgit_free_commitinfo(info);
} else {
@@ -49,23 +49,27 @@ static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1,
return 0;
}
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";
- else if (obj->type == OBJ_TREE)
+ arg = "h";
+ } else if (obj->type == OBJ_TREE) {
page = "tree";
- else
+ arg = "id";
+ } else {
page = "view";
+ arg = "id";
+ }
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);
htmlf("%s %s", typename(obj->type),
sha1_to_hex(obj->sha1));
html_link_close();
}