From e51d1679c5549a5775bc8a6e185b2a7116c15978 Mon Sep 17 00:00:00 2001 From: Jeff Ciesielski Date: Thu, 25 Feb 2016 18:57:08 -0500 Subject: [PATCH 1/2] Fix for Issue 204 Github + https + trailing slash in URL causes failed checkouts / remote tag fetches. The issue appears to be indemic to github.com, not git itself --- src/nimble.nim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/nimble.nim b/src/nimble.nim index 968e958..6680f63 100644 --- a/src/nimble.nim +++ b/src/nimble.nim @@ -484,10 +484,17 @@ proc downloadPkg(url: string, verRange: VersionRange, ## which was downloaded. let downloadDir = (getNimbleTempDir() / getDownloadDirName(url, verRange)) createDir(downloadDir) - let modUrl = + var modUrl = if url.startsWith("git://") and options.config.cloneUsingHttps: "https://" & url[6 .. ^1] else: url + + # Fixes issue #204 + # github + https + trailing url slash causes a + # checkout/ls-remote to fail with Repository not found + if modUrl.contains("https://github.com") and modUrl.endswith("/"): + modUrl = modUrl[0 .. ^2] + echo("Downloading ", modUrl, " into ", downloadDir, " using ", downMethod, "...") result = ( From 8ed8b98c6104196683ee40559996cda431cb3e4b Mon Sep 17 00:00:00 2001 From: Jeff Ciesielski Date: Fri, 26 Feb 2016 13:57:47 -0500 Subject: [PATCH 2/2] Switch to only checking for 'github.com' in url Avoids dealing with http:// v https:// v git:// urls --- src/nimble.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nimble.nim b/src/nimble.nim index 6680f63..2e604ac 100644 --- a/src/nimble.nim +++ b/src/nimble.nim @@ -492,7 +492,7 @@ proc downloadPkg(url: string, verRange: VersionRange, # Fixes issue #204 # github + https + trailing url slash causes a # checkout/ls-remote to fail with Repository not found - if modUrl.contains("https://github.com") and modUrl.endswith("/"): + if modUrl.contains("github.com") and modUrl.endswith("/"): modUrl = modUrl[0 .. ^2] echo("Downloading ", modUrl, " into ", downloadDir, " using ",