History

Always check if README exists in choose_readme()

Specifying a nonexistent README file via the readme option is sometimes useful, e.g. when using scan-path and setting a global default. Currently, we check whether there is only one option in the readme option and, if so, we choose that file without checking whether it exists. As a consequence, all repositories are equipped with an about link in the aforementioned scenario, even if there is no about file. Remove the early check for the number of keys and always check whether the file exists instead.

Lukas Fleischer committed 12 years ago

Commit 9dd67271 parent efa28791 file · +0 −6Browse files

Unified · Split

cgit.c+0−6
@@ -504,12 +504,6 @@ static void choose_readme(struct cgit_repo *repo) · 503 unmodified lines
504504 free(ref);
505505 continue;
506506 }
507− /* If there's only one item, we skip the possibly expensive
508− * selection process. */
509− if (repo->readme.nr == 1) {
510− found = 1;
511− break;
512− }
513507 if (ref) {
514508 if (cgit_ref_path_exists(filename, ref, 1)) {
515509 found = 1;