diff options
author | Christian Hesse | 2022-01-10 10:15:33 +0100 |
---|---|---|
committer | Yigit Sever | 2023-07-21 03:03:50 +0300 |
commit | ea9f614e02559f0166c9e74441f3edf4fe897fe2 (patch) | |
tree | 549755f36eb6fee66c40c6a9b5f66adeee820056 /cgit.c | |
parent | 9701f8e61129865cad35483eb4b6271ba048d0ad (diff) | |
download | cgit-ea9f614e02559f0166c9e74441f3edf4fe897fe2.tar.gz cgit-ea9f614e02559f0166c9e74441f3edf4fe897fe2.tar.bz2 cgit-ea9f614e02559f0166c9e74441f3edf4fe897fe2.zip |
about: allow to give head from query
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, | |||
507 | /* Check if the readme is tracked in the git repo. */ | 507 | /* Check if the readme is tracked in the git repo. */ |
508 | colon = strchr(readme, ':'); | 508 | colon = strchr(readme, ':'); |
509 | if (colon && strlen(colon) > 1) { | 509 | if (colon && strlen(colon) > 1) { |
510 | /* If it starts with a colon, we want to use | 510 | /* If it starts with a colon, we want to use head given |
511 | * the default branch */ | 511 | * from query or the default branch */ |
512 | if (colon == readme && repo->defbranch) | 512 | if (colon == readme && ctx.qry.head) |
513 | *ref = xstrdup(ctx.qry.head); | ||
514 | else if (colon == readme && repo->defbranch) | ||
513 | *ref = xstrdup(repo->defbranch); | 515 | *ref = xstrdup(repo->defbranch); |
514 | else | 516 | else |
515 | *ref = xstrndup(readme, colon - readme); | 517 | *ref = xstrndup(readme, colon - readme); |