]> gitweb.ps.run Git - ps-cgit/commitdiff
Always check if README exists in choose_readme()
authorLukas Fleischer <cgit@cryptocrack.de>
Sun, 27 Jul 2014 18:50:59 +0000 (20:50 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Thu, 7 Aug 2014 12:38:02 +0000 (14:38 +0200)
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.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
cgit.c

diff --git a/cgit.c b/cgit.c
index 20f6e279e3be60653d70a3e0966064afcd8c6480..8c4517d8e70554e02ac3cdaf8a246f2dad9dbfe0 100644 (file)
--- a/cgit.c
+++ b/cgit.c
@@ -504,12 +504,6 @@ static void choose_readme(struct cgit_repo *repo)
                        free(ref);
                        continue;
                }
-               /* If there's only one item, we skip the possibly expensive
-                * selection process. */
-               if (repo->readme.nr == 1) {
-                       found = 1;
-                       break;
-               }
                if (ref) {
                        if (cgit_ref_path_exists(filename, ref, 1)) {
                                found = 1;