List for cgit developers and users
 help / color / mirror / Atom feed
* [PATCH] Always check if README exists in choose_readme()
@ 2014-07-27 18:50 cgit
  2014-08-07 12:36 ` Jason
  0 siblings, 1 reply; 2+ messages in thread
From: cgit @ 2014-07-27 18:50 UTC (permalink / raw)


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 at cryptocrack.de>
---
 cgit.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/cgit.c b/cgit.c
index 20f6e27..8c4517d 100644
--- 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;
-- 
2.0.3



^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] Always check if README exists in choose_readme()
  2014-07-27 18:50 [PATCH] Always check if README exists in choose_readme() cgit
@ 2014-08-07 12:36 ` Jason
  0 siblings, 0 replies; 2+ messages in thread
From: Jason @ 2014-08-07 12:36 UTC (permalink / raw)


Merged. Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20140807/a3a81aa5/attachment.html>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-08-07 12:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-27 18:50 [PATCH] Always check if README exists in choose_readme() cgit
2014-08-07 12:36 ` Jason

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).