summaryrefslogtreecommitdiffabout
authorLars Hjemli <hjemli@gmail.com>2007-05-15 22:26:23 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2007-05-15 22:26:23 (UTC)
commita2ddc10479ec463708e422ca5ce7ec02c22a7d02 (patch) (side-by-side diff)
treee099ad98a79d61eb6e368a7e7972700f0e65b9ae
parentb28b105ec172b258ae5d629381a5890697c2f938 (diff)
downloadcgit-a2ddc10479ec463708e422ca5ce7ec02c22a7d02.zip
cgit-a2ddc10479ec463708e422ca5ce7ec02c22a7d02.tar.gz
cgit-a2ddc10479ec463708e422ca5ce7ec02c22a7d02.tar.bz2
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>
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
@@ -118,3 +118,3 @@ static void cgit_print_repo_page(struct cacheitem *item)
} 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")) {
diff --git a/ui-commit.c b/ui-commit.c
index 8011dfc..93eb8fd 100644
--- a/ui-commit.c
+++ b/ui-commit.c
@@ -199,3 +199,3 @@ void cgit_print_commit(const char *hex)
"<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));
diff --git a/ui-log.c b/ui-log.c
index 6d5509b..9d0ec02 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -36,3 +36,3 @@ void print_commit(struct commit *commit)
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);
@@ -123,2 +123 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path)
}
-
diff --git a/ui-summary.c b/ui-summary.c
index b99ea98..e7158cc 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -35,3 +35,3 @@ static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1,
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);
@@ -54,13 +54,17 @@ 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);