diff options
author | Cameron Katri <me@cameronkatri.com> | 2021-06-14 19:38:46 -0400 |
---|---|---|
committer | Cameron Katri <me@cameronkatri.com> | 2021-06-15 11:45:44 -0400 |
commit | 09631f5ed55f51b686814a31340c2fa80ac48b3d (patch) | |
tree | ceabc9840c327a95b90c74b8239ab2e8cf2df84f /ui-summary.c | |
parent | 5258c297ba6fb604ae1415fbc19a3fe42457e49e (diff) | |
download | cgit-09631f5ed55f51b686814a31340c2fa80ac48b3d.tar.gz cgit-09631f5ed55f51b686814a31340c2fa80ac48b3d.tar.zst cgit-09631f5ed55f51b686814a31340c2fa80ac48b3d.zip |
Add a license tabck/license
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.
Diffstat (limited to 'ui-summary.c')
-rw-r--r-- | ui-summary.c | 17 |
1 files changed, 8 insertions, 9 deletions
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("<div id='summary'>"); |