[RFCv2 PATCH 1/7] ui-blame: create enable-blame config item

John Keeping john at keeping.me.uk
Sat Sep 23 17:46:56 CEST 2017


On Fri, Sep 22, 2017 at 10:38:42PM -0500, Jeff Smith wrote:
> Signed-off-by: Jeff Smith <whydoubt at gmail.com>
> ---
>  cgit.c       | 3 +++
>  cgit.h       | 1 +
>  cgitrc.5.txt | 5 +++++
>  3 files changed, 9 insertions(+)
> 
> diff --git a/cgit.c b/cgit.c
> index 1dae4b8..c03f69c 100644
> --- a/cgit.c
> +++ b/cgit.c
> @@ -183,6 +183,8 @@ static void config_cb(const char *name, const char *value)
>  		ctx.cfg.enable_tree_linenumbers = atoi(value);
>  	else if (!strcmp(name, "enable-git-config"))
>  		ctx.cfg.enable_git_config = atoi(value);
> +	else if (!strcmp(name, "enable-blame"))
> +		ctx.cfg.enable_blame = atoi(value);
>  	else if (!strcmp(name, "max-stats"))
>  		ctx.cfg.max_stats = cgit_find_stats_period(value, NULL);
>  	else if (!strcmp(name, "cache-size"))
> @@ -373,6 +375,7 @@ static void prepare_context(void)
>  	ctx.cfg.enable_index_owner = 1;
>  	ctx.cfg.enable_tree_linenumbers = 1;
>  	ctx.cfg.enable_git_config = 0;
> +	ctx.cfg.enable_blame = 1;

Should this default to false?  Either way, I think the commit message
should have some discussion of what the default is any why it has been
chosen.

>  	ctx.cfg.max_repo_count = 50;
>  	ctx.cfg.max_commit_count = 50;
>  	ctx.cfg.max_lock_attempts = 5;
> diff --git a/cgit.h b/cgit.h
> index fbc6c6a..a48e622 100644
> --- a/cgit.h
> +++ b/cgit.h
> @@ -236,6 +236,7 @@ struct cgit_config {
>  	int enable_html_serving;
>  	int enable_tree_linenumbers;
>  	int enable_git_config;
> +	int enable_blame;
>  	int local_time;
>  	int max_atom_items;
>  	int max_repo_count;
> diff --git a/cgitrc.5.txt b/cgitrc.5.txt
> index 9fcf445..b236bf2 100644
> --- a/cgitrc.5.txt
> +++ b/cgitrc.5.txt
> @@ -211,6 +211,11 @@ enable-git-config::
>  	with "cgit." will be mapped to the corresponding "repo." key in cgit.
>  	Default value: "0". See also: scan-path, section-from-path.
>  
> +enable-blame::
> +	Flag which, when set to "1", will allow cgit to provide a "blame" page
> +	for files, and will make it generate links to that page in appropriate
> +	places. Default value: "1".
> +

Although the handful of enable-* options above this are not well sorted,
most of this file is, so this should move to above enable-commit-graph.

>  favicon::
>  	Url used as link to a shortcut icon for cgit. It is suggested to use
>  	the value "/favicon.ico" since certain browsers will ignore other


More information about the CGit mailing list