From 09631f5ed55f51b686814a31340c2fa80ac48b3d Mon Sep 17 00:00:00 2001 From: Cameron Katri Date: Mon, 14 Jun 2021 19:38:46 -0400 Subject: Add a license tab This tab is nearly identical to the about tab, use the license field in cgitrc to set a list of files to check for or use repo.license or cgit.license as a git-config key. --- ui-summary.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'ui-summary.c') diff --git a/ui-summary.c b/ui-summary.c index 947812a..dc4d0a6 100644 --- a/ui-summary.c +++ b/ui-summary.c @@ -66,11 +66,11 @@ void cgit_print_summary(void) } /* The caller must free the return value. */ -static char* append_readme_path(const char *filename, const char *ref, const char *path) +static char* append_file_path(const char *filename, const char *ref, const char *path) { char *file, *base_dir, *full_path, *resolved_base = NULL, *resolved_full = NULL; /* If a subpath is specified for the about page, make it relative - * to the directory containing the configured readme. */ + * to the directory containing the configured file. */ file = xstrdup(filename); base_dir = dirname(file); @@ -98,8 +98,7 @@ static char* append_readme_path(const char *filename, const char *ref, const cha return full_path; } - -void cgit_print_repo_readme(const char *path) +void cgit_print_repo_info_file(struct string_list file, const char *path) { char *filename, *ref, *mimetype; int free_filename = 0; @@ -115,20 +114,20 @@ void cgit_print_repo_readme(const char *path) free(mimetype); cgit_print_layout_start(); - if (ctx.repo->readme.nr == 0) + if (file.nr == 0) goto done; - filename = ctx.repo->readme.items[0].string; - ref = ctx.repo->readme.items[0].util; + filename = file.items[0].string; + ref = file.items[0].util; if (path) { free_filename = 1; - filename = append_readme_path(filename, ref, path); + filename = append_file_path(filename, ref, path); if (!filename) goto done; } - /* Print the calculated readme, either from the git repo or from the + /* Print the calculated file, either from the git repo or from the * filesystem, while applying the about-filter. */ html("
"); -- cgit v1.2.3-56-ge451