shithub: git9

Download patch

ref: dc802c499dc7164aa208b919a07c5bd18701b0e1
parent: 747e9e80f710c0b8bbd928080745915ad2493322
author: Ori Bernstein <ori@eigenstate.org>
date: Mon Sep 7 17:49:16 EDT 2020

git/{send,fetch}: encrypted git:// protocol

Just tlsclient without '-a'.

--- a/proto.c
+++ b/proto.c
@@ -270,7 +270,7 @@
 }
 
 static int
-dialhjgit(Conn *c, char *host, char *port, char *path, char *direction)
+dialhjgit(Conn *c, char *host, char *port, char *path, char *direction, int auth)
 {
 	char *ds, *p, *e, cmd[512];
 	int pid, pfd[2];
@@ -288,7 +288,10 @@
 		dup(pfd[0], 1);
 		if(chattygit)
 			fprint(2, "exec tlsclient -a %s\n", ds);
-		execl("/bin/tlsclient", "tlsclient", "-a", ds, nil);
+		if(auth)
+			execl("/bin/tlsclient", "tlsclient", "-a", ds, nil);
+		else
+			execl("/bin/tlsclient", "tlsclient", ds, nil);
 		sysfatal("exec: %r");
 	}else{
 		close(pfd[0]);
@@ -363,7 +366,9 @@
 	else if(strcmp(proto, "git") == 0)
 		return dialgit(c, host, port, path, direction);
 	else if(strcmp(proto, "hjgit") == 0)
-		return dialhjgit(c, host, port, path, direction);
+		return dialhjgit(c, host, port, path, direction, 1);
+	else if(strcmp(proto, "gits") == 0)
+		return dialhjgit(c, host, port, path, direction, 0);
 	else if(strcmp(proto, "http") == 0 || strcmp(proto, "https") == 0)
 		return dialhttp(c, host, port, path, direction);
 	werrstr("unknown protocol %s", proto);