cgit

commit 7d6ee4ee8a2c79802a78bc09c0e1e96a7a82de78

Author: Lars Hjemli <hjemli@gmail.com>

Include querystring as part of cached filename for repo summary page

When adding support for the h parameter to the summary page (passing current
branch between pages), the builtin cache returned basically random results
for summary page since the cached filename didn't honour the querystring.

This fixes the issue for now, but someday it might be worthwhile to generate
'canonical' filenames in the cache for all pages, i.e. something a bit more
clever than just including the querystring.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>

 cgit.c | 10 ++++++----


diff --git a/cgit.c b/cgit.c
index 3fc90bf8750645931bd9f4da6dcd896082c6ab9c..b943fe5769ce56644d5b5ac54c43da0d15be8e7d 100644
--- a/cgit.c
+++ b/cgit.c
@@ -29,13 +29,15 @@ 		return 1;
 	}
 
 	if (!cgit_cmd) {
-		item->name = xstrdup(fmt("%s/%s/index.html", cgit_cache_root,
-			   cache_safe_filename(cgit_repo->url)));
+		item->name = xstrdup(fmt("%s/%s/index.%s.html", cgit_cache_root,
+					 cache_safe_filename(cgit_repo->url),
+					 cache_safe_filename(cgit_querystring)));
 		item->ttl = cgit_cache_repo_ttl;
 	} else {
 		item->name = xstrdup(fmt("%s/%s/%s/%s.html", cgit_cache_root,
-			   cache_safe_filename(cgit_repo->url), cgit_query_page,
-			   cache_safe_filename(cgit_querystring)));
+					 cache_safe_filename(cgit_repo->url),
+					 cgit_query_page,
+					 cache_safe_filename(cgit_querystring)));
 		if (cgit_query_has_symref)
 			item->ttl = cgit_cache_dynamic_ttl;
 		else if (cgit_query_has_sha1)