On Mon, Jun 18, 2018 at 10:58:10AM +0800, Andy Green wrote:
> This allows the user to choose to override any global
> inline-readme list for a specific repo, using the
> same kind of semantics as the other repo overrides.
> 
> Signed-off-by: Andy Green <[email protected]>

One small style nit below, but other than that this looks good.

Reviewed-by: John Keeping <[email protected]>

> ---
>  cgit.c       |    6 ++++++
>  cgit.h       |    1 +
>  cgitrc.5.txt |   10 ++++++++++
>  shared.c     |    2 ++
>  4 files changed, 19 insertions(+)
> 
> diff --git a/cgit.c b/cgit.c
> index 4ffd61f..7c13327 100644
> --- a/cgit.c
> +++ b/cgit.c
> @@ -103,6 +103,12 @@ static void repo_config(struct cgit_repo *repo, const 
> char *name, const char *va
>               repo->hide = atoi(value);
>       else if (!strcmp(name, "ignore"))
>               repo->ignore = atoi(value);
> +     else if (!strcmp(name, "inline-readme")) {
> +             if (repo->inline_readme.items == ctx.cfg.inline_readme.items)
> +                     string_list_init(&repo->inline_readme, 1);
> +
> +             string_list_append(&repo->inline_readme, value);
> +     }
>       else if (ctx.cfg.enable_filter_overrides) {

The else if should be on the same line as the closing } here.

>               if (!strcmp(name, "about-filter"))
>                       repo->about_filter = cgit_new_filter(value, ABOUT);
> diff --git a/cgit.h b/cgit.h
> index 664f003..0aebeba 100644
> --- a/cgit.h
> +++ b/cgit.h
> @@ -84,6 +84,7 @@ struct cgit_repo {
>       char *defbranch;
>       char *module_link;
>       struct string_list readme;
> +     struct string_list inline_readme;
>       char *section;
>       char *clone_url;
>       char *logo;
> diff --git a/cgitrc.5.txt b/cgitrc.5.txt
> index 37858af..3f493cb 100644
> --- a/cgitrc.5.txt
> +++ b/cgitrc.5.txt
> @@ -561,6 +561,16 @@ repo.ignore::
>       is not shown in the index and cannot be accessed by providing a direct
>       path. Default value: "0". See also: "repo.hide".
>  
> +repo.inline-readme::
> +     Append given filename to the list of filenames to be rendered after the
> +     tree navigation in tree view, if present in the directory being viewed. 
>  Eg,
> +     'repo.inline-readme=README.md'.  You may also want a corresponding 
> render.
> +     entry for the readme suffix, eg,
> +     'render.md=/usr/libexec/cgit/filters/html-converters/md2html'.
> +     If not given, the repo will use any global 'inline-readme=' 
> configuration;
> +     if any 'repo.inline-readme' are given only they are used for that repo,
> +     and the global 'inline-readme=' list is ignored for that repo.
> +
>  repo.logo::
>       Url which specifies the source of an image which will be used as a logo
>       on this repo's pages. Default value: global logo.
> diff --git a/shared.c b/shared.c
> index 26a9266..8fe5c1b 100644
> --- a/shared.c
> +++ b/shared.c
> @@ -77,6 +77,8 @@ struct cgit_repo *cgit_add_repo(const char *url)
>       ret->clone_url = ctx.cfg.clone_url;
>       ret->submodules.strdup_strings = 1;
>       ret->hide = ret->ignore = 0;
> +     ret->inline_readme = ctx.cfg.inline_readme;
> +
>       return ret;
>  }
>  
_______________________________________________
CGit mailing list
[email protected]
https://lists.zx2c4.com/mailman/listinfo/cgit

Reply via email to