diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Cache every branch page under cache-dynamic-ttl
The dynamic ttl only applied when the url named a branch with h=, so the log, tree and refs of the default branch, which never carry one, fell back to cache-summary-ttl. The manual already gives each ttl the scope the code now uses.
Diffstat (limited to '')
-rw-r--r--source/cgit.c9
-rw-r--r--source/cgit.h1
2 files changed, 2 insertions, 8 deletions
diff --git a/source/cgit.c b/source/cgit.c
index 82c496e..b26a528 100644
--- a/source/cgit.c
+++ b/source/cgit.c
@@ -319,7 +319,6 @@ static void parse_args(int argc, const char **argv)
ctx.qry.page = xstrdup(arg);
} else if (skip_prefix(argv[i], "--head=", &arg)) {
ctx.qry.head = xstrdup(arg);
- ctx.qry.has_symref = 1;
} else if (skip_prefix(argv[i], "--oid=", &arg)) {
ctx.qry.oid = xstrdup(arg);
ctx.qry.has_oid = 1;
@@ -760,7 +759,6 @@ static void apply_query_param(const char *name, const char *value)
ctx.qry.search = xstrdup(value);
} else if (!strcmp(name, "h")) {
ctx.qry.head = xstrdup(value);
- ctx.qry.has_symref = 1;
} else if (!strcmp(name, "id")) {
ctx.qry.oid = xstrdup(value);
ctx.qry.has_oid = 1;
@@ -918,7 +916,7 @@ static int calc_ttl(void)
if (!ctx.repo)
return ctx.cfg.cache_index_ttl;
- if (!ctx.qry.page)
+ if (!ctx.qry.page || !strcmp(ctx.qry.page, "summary"))
return ctx.cfg.cache_summary_ttl;
// The dumb transport serves files that already sit on the disk, so a
@@ -944,10 +942,7 @@ static int calc_ttl(void)
if (!strcmp(ctx.qry.page, "snapshot"))
return ctx.cfg.cache_snapshot_ttl;
- if (ctx.qry.has_symref)
- return ctx.cfg.cache_dynamic_ttl;
-
- return ctx.cfg.cache_summary_ttl;
+ return ctx.cfg.cache_dynamic_ttl;
}
/*
diff --git a/source/cgit.h b/source/cgit.h
index b863e7b..a632fed 100644
--- a/source/cgit.h
+++ b/source/cgit.h
@@ -162,7 +162,6 @@ struct reflist {
};
struct cgit_query {
- int has_symref;
int has_oid;
int has_difftype;
char *raw;