diff options
author | Christian Hesse <mail@eworm.de> | 2022-01-10 10:15:33 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2022-01-10 10:26:37 +0100 |
commit | 6e56427e0e5e23bfc9fa4964d34ef5f4eccffb7d (patch) | |
tree | b176682fc996157745e4bd7b7e94028256bf1eb2 /cgit.c | |
parent | 5258c297ba6fb604ae1415fbc19a3fe42457e49e (diff) | |
download | cgit-6e56427e0e5e23bfc9fa4964d34ef5f4eccffb7d.tar.gz cgit-6e56427e0e5e23bfc9fa4964d34ef5f4eccffb7d.zip |
about: allow to give head from querych/about-head
Reading the README from repository used to be limited to default
branch or a branch given in configuration. Let's allow a branch
from query if not specified explicitly.
Signed-off-by: Christian Hesse <mail@eworm.de>
Diffstat (limited to 'cgit.c')
-rw-r--r-- | cgit.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -507,9 +507,11 @@ static inline void parse_readme(const char *readme, char **filename, char **ref, /* Check if the readme is tracked in the git repo. */ colon = strchr(readme, ':'); if (colon && strlen(colon) > 1) { - /* If it starts with a colon, we want to use - * the default branch */ - if (colon == readme && repo->defbranch) + /* If it starts with a colon, we want to use head given + * from query or the default branch */ + if (colon == readme && ctx.qry.head) + *ref = xstrdup(ctx.qry.head); + else if (colon == readme && repo->defbranch) *ref = xstrdup(repo->defbranch); else *ref = xstrndup(readme, colon - readme); |