diff options
-rw-r--r-- | cgit.c | 8 | ||||
-rw-r--r-- | cgitrc.5.txt | 10 |
2 files changed, 10 insertions, 8 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); |
diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 33a6a8c..d9eb3b0 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt | |||
@@ -579,11 +579,11 @@ repo.readme:: | |||
579 | verbatim as the "About" page for this repo. You may also specify a | 579 | verbatim as the "About" page for this repo. You may also specify a |
580 | git refspec by head or by hash by prepending the refspec followed by | 580 | git refspec by head or by hash by prepending the refspec followed by |
581 | a colon. For example, "master:docs/readme.mkd". If the value begins | 581 | a colon. For example, "master:docs/readme.mkd". If the value begins |
582 | with a colon, i.e. ":docs/readme.rst", the default branch of the | 582 | with a colon, i.e. ":docs/readme.rst", the head giving in query or |
583 | repository will be used. Sharing any file will expose that entire | 583 | the default branch of the repository will be used. Sharing any file |
584 | directory tree to the "/about/PATH" endpoints, so be sure that there | 584 | will expose that entire directory tree to the "/about/PATH" endpoints, |
585 | are no non-public files located in the same directory as the readme | 585 | so be sure that there are no non-public files located in the same |
586 | file. Default value: <readme>. | 586 | directory as the readme file. Default value: <readme>. |
587 | 587 | ||
588 | repo.section:: | 588 | repo.section:: |
589 | Override the current section name for this repository. Default value: | 589 | Override the current section name for this repository. Default value: |