about summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--cgitrc.5.txt4
-rw-r--r--ui-summary.c7
2 files changed, 9 insertions, 2 deletions
diff --git a/cgitrc.5.txt b/cgitrc.5.txt
index 9b803b3..8a0a9c9 100644
--- a/cgitrc.5.txt
+++ b/cgitrc.5.txt
@@ -505,7 +505,9 @@ repo.readme::
 	A path (relative to <repo.path>) which specifies a file to include
 	verbatim as the "About" page for this repo. You may also specify a
 	git refspec by head or by hash by prepending the refspec followed by
-	a colon. For example, "master:docs/readme.mkd" Default value: <readme>.
+	a colon. For example, "master:docs/readme.mkd". If the value begins
+	with a colon, i.e. ":docs/readme.rst", the default branch of the
+	repository will be used. Default value: <readme>.
 
 repo.snapshots::
 	A mask of allowed snapshot-formats for this repo, restricted by the
diff --git a/ui-summary.c b/ui-summary.c
index f965b32..abf914e 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -108,7 +108,12 @@ void cgit_print_repo_readme(char *path)
 	colon = strchr(ctx.repo->readme, ':');
 	if (colon && strlen(colon) > 1) {
 		*colon = '\0';
-		ref = ctx.repo->readme;
+		/* If it starts with a colon, we want to use
+		 * the default branch */
+		if (colon == ctx.repo->readme && ctx.repo->defbranch)
+			ref = ctx.repo->defbranch;
+		else
+			ref = ctx.repo->readme;
 		ctx.repo->readme = colon + 1;
 		if (!(*ctx.repo->readme))
 			return;
1&id=14ae13f781d1ab30d648eaffbace67a9eec36c5b&follow=1'>Add C-t transposeJune McEnroe 2020-02-12Add C-v and M-vJune McEnroe 2020-02-12Allow for arguments to open/copy utilitiesJune McEnroe 2020-02-12Handle RPL_AWAYJune McEnroe 2020-02-11Support monochromatic terminalsJune McEnroe 2020-02-11Add .gz to chroot-man scriptJune McEnroe 2020-02-11Add -R restricted flagJune McEnroe 2020-02-11Add chroot targetJune McEnroe 2020-02-11Exit focus and paste modes on err exitJune McEnroe 2020-02-11Add startup GPLv3 note and URLJune McEnroe 2020-02-11Make sure -D_GNU_SOURCE ends up in CFLAGS on LinuxJune McEnroe 2020-02-11Add note about setting PKG_CONFIG_PATHJune McEnroe 2020-02-11Rename query ID on nick changeJune McEnroe 2020-02-11Call completeClear when closing a windowJune McEnroe 2020-02-11Don't insert color codes for non-mentionsJune McEnroe 2020-02-11Take first two words in colorMentionsJune McEnroe 2020-02-11Use time_t for save signatureJune McEnroe 2020-02-11Set self.nick to * initiallyJune McEnroe 2020-02-11Define ColorCap instead of hardcoding 100June McEnroe 2020-02-11Move hash to top of chat.hJune McEnroe 2020-02-11Move base64 out of chat.hJune McEnroe 2020-02-11Move XDG_SUBDIR out of chat.hJune McEnroe 2020-02-11Fix whois idle unit calculationJune McEnroe 2020-02-11Cast towupper to wchar_tJune McEnroe 2020-02-11Cast set but unused variables to voidJune McEnroe 2020-02-11Declare strlcatJune McEnroe 2020-02-11Check if VDSUSP existsJune McEnroe 2020-02-11Fix completeReplace iterationJune McEnroe 2020-02-11Use pkg(8) to configure on FreeBSDJune McEnroe 2020-02-11Remove legacy codeJune McEnroe 2020-02-11Add INSTALLING section to READMEJune McEnroe