shithub: git9

Download patch

ref: 8bd0182f46c5159341714af16cca43f7c579e199
parent: 4a91150765507009e4f07e8dfc8db90232ea5672
author: Ori Bernstein <[email protected]>
date: Tue Feb 9 00:13:29 EST 2021

proto parsing: handle relative paths in uri

It should be possible to clone a repository
that looks like:

	git+ssh://user@host:repo

This fixes the parsing of that form of uri.

--- a/proto.c
+++ b/proto.c
@@ -163,8 +163,9 @@
 	}
 	
 	snprint(path, Npath, "%s", p);
-	p = strrchr(p, '/') + 1;
-	if(!p || strlen(p) == 0){
+	if((q = strrchr(p, '/')) != nil)
+		p = q + 1;
+	if(strlen(p) == 0){
 		werrstr("missing repository in uri");
 		return -1;
 	}