about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-12-20T18·30+0000
committerVincent Ambo <tazjin@google.com>2019-12-20T18·30+0000
commit1c9e3c652df88df3b285ab85c49264d212c24c09 (patch)
treed7ff4da3497f85be62a18fa98e348bbcc8b9c5cb
parentde309848eb49a13018a0f62195f9dc74801ef0ec (diff)
fix(cgit-taz): Patch other bits of cgit that handle URLs r/225
Turns out there were a few more things. About page handling also did
something weird, which I've swiftly removed.
-rw-r--r--services/cgit-taz/cgit_depot_url.patch49
1 files changed, 47 insertions, 2 deletions
diff --git a/services/cgit-taz/cgit_depot_url.patch b/services/cgit-taz/cgit_depot_url.patch
index 5ca2857371..7d22ddf418 100644
--- a/services/cgit-taz/cgit_depot_url.patch
+++ b/services/cgit-taz/cgit_depot_url.patch
@@ -1,5 +1,40 @@
+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..5c3e7bc 100644
+index 739505a..6840c86 100644
 --- a/ui-shared.c
 +++ b/ui-shared.c
 @@ -95,29 +95,23 @@ const char *cgit_loginurl(void)
@@ -12,7 +47,7 @@ index 739505a..5c3e7bc 100644
 -		return fmtalloc("?r=%s", reponame);
 +	// my cgit instance *only* serves the depot, hence that's the only value ever
 +	// needed.
-+	return "/";
++	return fmtalloc("/");
  }
  
  char *cgit_fileurl(const char *reponame, const char *pagename,
@@ -41,3 +76,13 @@ index 739505a..5c3e7bc 100644
  	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("/");