From b28b105ec172b258ae5d629381a5890697c2f938 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Wed, 16 May 2007 00:14:51 +0200 Subject: 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 --- cgit.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'cgit.c') 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) char *title; int show_search; + if (!cgit_query_head) + cgit_query_head = cgit_repo->defbranch; + if (chdir(cgit_repo->path)) { title = fmt("%s - %s", cgit_root_title, "Bad request"); cgit_print_docstart(title, item); -- cgit v1.2.3-59-g8ed1b