shithub: git9

Download patch

ref: 443776eb0e1cf247ad81c9ea6d8ae0298c93563b
parent: c0b4cc62169abf39584d80fa06cc02d06ffed3d4
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Sep 11 21:39:32 EDT 2020

protocol: default to ssh

When no protocol is provided, upstream git assumes
we want the ssh protocol. If we want to be able to
copy/paste repo urls, we may as well do the same in
git9.

May get reverted.

--- a/proto.c
+++ b/proto.c
@@ -94,11 +94,9 @@
 	print("uri: \"%s\"\n", uri);
 
 	p = strstr(uri, "://");
-	if(!p){
-		werrstr("missing protocol");
-		return -1;
-	}
-	if(strncmp(uri, "git+", 4) == 0)
+	if(p == nil)
+		snprint(proto, Nproto, "ssh");
+	else if(strncmp(uri, "git+", 4) == 0)
 		grab(proto, Nproto, uri + 4, p);
 	else
 		grab(proto, Nproto, uri, p);
@@ -114,7 +112,7 @@
 		snprint(port, Nport, "17021");
 	else
 		hasport = 0;
-	s = p + 3;
+	s = (p != nil) ? p + 3 : uri;
 	p = nil;
 	if(!hasport){
 		p = strstr(s, ":");