aboutsummaryrefslogtreecommitdiffstats
path: root/cgit.c
diff options
context:
space:
mode:
authorLars Hjemli2007-05-16 00:14:51 +0200
committerLars Hjemli2007-05-16 00:16:00 +0200
commitb28b105ec172b258ae5d629381a5890697c2f938 (patch)
tree0673dc5ed94c8ce99c714d1204b6582f9ba96fc5 /cgit.c
parent47a81c77fdd017227632c4df9a0b7b135b8a738d (diff)
downloadcgit-b28b105ec172b258ae5d629381a5890697c2f938.tar.gz
cgit-b28b105ec172b258ae5d629381a5890697c2f938.tar.bz2
cgit-b28b105ec172b258ae5d629381a5890697c2f938.zip
Enable default value for head parameter
Pages which expect head to be specified in the querystring can now be given a default value, configurable per repository (via repo.defbranch, which defaults to "master"). Currently, only the log page actually works without parameters, but the defbranch is bound to be exploited. This also removes some dead code from shared.c Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'cgit.c')
-rw-r--r--cgit.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/cgit.c b/cgit.c
index 3c11ff0..b282a67 100644
--- a/cgit.c
+++ b/cgit.c
@@ -65,6 +65,9 @@ static void cgit_print_repo_page(struct cacheitem *item)
65 char *title; 65 char *title;
66 int show_search; 66 int show_search;
67 67
68 if (!cgit_query_head)
69 cgit_query_head = cgit_repo->defbranch;
70
68 if (chdir(cgit_repo->path)) { 71 if (chdir(cgit_repo->path)) {
69 title = fmt("%s - %s", cgit_root_title, "Bad request"); 72 title = fmt("%s - %s", cgit_root_title, "Bad request");
70 cgit_print_docstart(title, item); 73 cgit_print_docstart(title, item);