[PATCH] Add "default-tab" and "root-default-tab" configuration options

John Keeping john at keeping.me.uk
Sun Feb 13 15:20:41 UTC 2022


On Sun, Jan 30, 2022 at 06:04:10PM +0000, equa wrote:
> These options allow the user to specify a page to display at the root
> repository/index location instead of the default summary or repository list.
> 
> Signed-off-by: equa <equaa at protonmail.com>

We need a real name for the author and sign-off here.

> diff --git a/ui-shared.c b/ui-shared.c
> index acd8ab5..17b1e49 100644
> --- a/ui-shared.c
> +++ b/ui-shared.c
> @@ -203,6 +203,9 @@ static void site_url(const char *page, const char *search, const char *sort, int
>  {
>  	char *delim = "?";
> 
> +	if (!strcmp(page ? page : "", ctx.cfg.root_default_tab))
> +		page = NULL;
> +

Why is this necessary?  Is there any requirement to shorten the URL here
or does it just make it shorter?

>  	if (always_root || page)
>  		html_attr(cgit_rooturl());
>  	else {
> @@ -317,6 +320,12 @@ static void reporevlink(const char *page, const char *name, const char *title,
>  {
>  	char *delim;
> 
> +	if (page
> +	    && !rev
> +	    && !path
> +	    && !strcmp(page, ctx.repo->default_tab))
> +		page = NULL;
> +

Same as above, I don't see what advantage this gives.


More information about the CGit mailing list