shithub: riscv

Download patch

ref: 4dd461e4400b20fbb218304e53a84d3704ae8304
parent: db5ca0017c648c3c2bb5047e61d27ab584171dd7
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri Jun 4 13:44:29 EDT 2021

git/serve: remove undocumented -n namespace option and -r /usr/git default

This makes it easier to serve local repositories where the sandboxing
gets in the way.

--- a/sys/src/cmd/git/serve.c
+++ b/sys/src/cmd/git/serve.c
@@ -5,8 +5,7 @@
 
 #include "git.h"
 
-char	*pathpfx = "/usr/git";
-char	*namespace = nil;
+char	*pathpfx = nil;
 int	allowwrite;
 
 int
@@ -498,7 +497,6 @@
 main(int argc, char **argv)
 {
 	char *repo, cmd[32], buf[512];
-	char *user;
 	Conn c;
 
 	ARGBEGIN{
@@ -510,9 +508,6 @@
 		if(*pathpfx != '/')
 			sysfatal("path prefix must begin with '/'");
 		break;
-	case 'n':
-		namespace=EARGF(usage());
-		break;
 	case 'w':
 		allowwrite++;
 		break;
@@ -522,14 +517,13 @@
 	}ARGEND;
 
 	gitinit();
-	user = "none";
 	interactive = 0;
-	if(allowwrite)
-		user = getuser();
-	if(newns(user, namespace) == -1)
-		sysfatal("addns: %r");
-	if(bind(pathpfx, "/", MREPL) == -1)
-		sysfatal("bind: %r");
+	if(rfork(RFNAMEG) == -1)
+		sysfatal("rfork: %r");
+	if(pathpfx != nil){
+		if(bind(pathpfx, "/", MREPL) == -1)
+			sysfatal("bind: %r");
+	}
 	if(rfork(RFNOMNT) == -1)
 		sysfatal("rfork: %r");