about summary refs log tree commit diff
path: root/web/cgit-taz/cgit_depot_url.patch
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-12-21T23·36+0000
committerVincent Ambo <tazjin@google.com>2019-12-21T23·36+0000
commit9ad47965387c63e287afac86c498566e37265248 (patch)
treef263eb41f0e403a271983ae7067f05251e8b3c4a /web/cgit-taz/cgit_depot_url.patch
parent03acae2f85a1cda6057ab17549941c2ce16464ed (diff)
feat(cgit-taz): Add patches for subtree about/ handling r/289
1. Generate links to subtree about pages.
2. Render README files in subtrees, too.
Diffstat (limited to 'web/cgit-taz/cgit_depot_url.patch')
-rw-r--r--web/cgit-taz/cgit_depot_url.patch97
1 files changed, 0 insertions, 97 deletions
diff --git a/web/cgit-taz/cgit_depot_url.patch b/web/cgit-taz/cgit_depot_url.patch
deleted file mode 100644
index cb81a2a49ab9..000000000000
--- a/web/cgit-taz/cgit_depot_url.patch
+++ /dev/null
@@ -1,97 +0,0 @@
-diff --git a/cmd.c b/cmd.c
-index 63f0ae5..b37b79d 100644
---- a/cmd.c
-+++ b/cmd.c
-@@ -39,29 +39,7 @@ static void atom_fn(void)
- 
- static void about_fn(void)
- {
--	if (ctx.repo) {
--		size_t path_info_len = ctx.env.path_info ? strlen(ctx.env.path_info) : 0;
--		if (!ctx.qry.path &&
--		    ctx.qry.url[strlen(ctx.qry.url) - 1] != '/' &&
--		    (!path_info_len || ctx.env.path_info[path_info_len - 1] != '/')) {
--			char *currenturl = cgit_currenturl();
--			char *redirect = fmtalloc("%s/", currenturl);
--			cgit_redirect(redirect, true);
--			free(currenturl);
--			free(redirect);
--		} else if (ctx.repo->readme.nr)
--			cgit_print_repo_readme(ctx.qry.path);
--		else if (ctx.repo->homepage)
--			cgit_redirect(ctx.repo->homepage, false);
--		else {
--			char *currenturl = cgit_currenturl();
--			char *redirect = fmtalloc("%s../", currenturl);
--			cgit_redirect(redirect, false);
--			free(currenturl);
--			free(redirect);
--		}
--	} else
--		cgit_print_site_readme();
-+	cgit_print_repo_readme(ctx.qry.path);
- }
- 
- static void blame_fn(void)
-diff --git a/ui-shared.c b/ui-shared.c
-index 739505a..c7c3754 100644
---- a/ui-shared.c
-+++ b/ui-shared.c
-@@ -95,29 +95,23 @@ const char *cgit_loginurl(void)
- 
- char *cgit_repourl(const char *reponame)
- {
--	if (ctx.cfg.virtual_root)
--		return fmtalloc("%s%s/", ctx.cfg.virtual_root, reponame);
--	else
--		return fmtalloc("?r=%s", reponame);
-+	// my cgit instance *only* serves the depot, hence that's the only value ever
-+	// needed.
-+	return fmtalloc("/");
- }
- 
- char *cgit_fileurl(const char *reponame, const char *pagename,
- 		   const char *filename, const char *query)
- {
- 	struct strbuf sb = STRBUF_INIT;
--	char *delim;
- 
--	if (ctx.cfg.virtual_root) {
--		strbuf_addf(&sb, "%s%s/%s/%s", ctx.cfg.virtual_root, reponame,
--			    pagename, (filename ? filename:""));
--		delim = "?";
--	} else {
--		strbuf_addf(&sb, "?url=%s/%s/%s", reponame, pagename,
--			    (filename ? filename : ""));
--		delim = "&amp;";
-+	strbuf_addf(&sb, "%s%s/%s", ctx.cfg.virtual_root,
-+		pagename, (filename ? filename:""));
-+
-+	if (query) {
-+		strbuf_addf(&sb, "%s%s", "?", query);
- 	}
--	if (query)
--		strbuf_addf(&sb, "%s%s", delim, query);
-+
- 	return strbuf_detach(&sb, NULL);
- }
- 
-@@ -245,9 +239,6 @@ static char *repolink(const char *title, const char *class, const char *page,
- 	html(" href='");
- 	if (ctx.cfg.virtual_root) {
- 		html_url_path(ctx.cfg.virtual_root);
--		html_url_path(ctx.repo->url);
--		if (ctx.repo->url[strlen(ctx.repo->url) - 1] != '/')
--			html("/");
- 		if (page) {
- 			html_url_path(page);
- 			html("/");
-@@ -957,8 +948,6 @@ static void print_header(void)
- 
- 	html("<td class='main'>");
- 	if (ctx.repo) {
--		cgit_index_link("index", NULL, NULL, NULL, NULL, 0, 1);
--		html(" : ");
- 		cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL);
- 		if (ctx.env.authenticated) {
- 			html("</td><td class='form'>");