1717
1818proc updateSubmodules (dir: string ) =
1919 discard tryDoCmdEx (
20- & " git -C { dir} submodule update --init --recursive --depth 1 " )
20+ & " git -C { dir.quoteShell } submodule update --init --recursive --depth 1 " )
2121
2222proc doCheckout * (meth: DownloadMethod , downloadDir, branch: string , options: Options ) =
2323 case meth
2424 of DownloadMethod .git:
2525 # Force is used here because local changes may appear straight after a clone
2626 # has happened. Like in the case of git on Windows where it messes up the
2727 # damn line endings.
28- discard tryDoCmdEx (& " git -C { downloadDir} checkout --force { branch} " )
28+ discard tryDoCmdEx (& " git -C { downloadDir.quoteShell } checkout --force { branch} " )
2929 if not options.ignoreSubmodules:
3030 downloadDir.updateSubmodules
3131 of DownloadMethod .hg:
32- discard tryDoCmdEx (& " hg --cwd { downloadDir} checkout { branch} " )
32+ discard tryDoCmdEx (& " hg --cwd { downloadDir.quoteShell } checkout { branch} " )
3333
3434proc doClone (meth: DownloadMethod , url, downloadDir: string , branch = " " ,
3535 onlyTip = true , options: Options ) =
@@ -41,14 +41,14 @@ proc doClone(meth: DownloadMethod, url, downloadDir: string, branch = "",
4141 branchArg = if branch == " " : " " else : & " -b { branch} "
4242 discard tryDoCmdEx (
4343 " git clone --config core.autocrlf=false --config core.eol=lf " &
44- & " { submoduleFlag} { depthArg} { branchArg} { url} { downloadDir} " )
44+ & " { submoduleFlag} { depthArg} { branchArg} { url} { downloadDir.quoteShell } " )
4545 if not options.ignoreSubmodules:
4646 downloadDir.updateSubmodules
4747 of DownloadMethod .hg:
4848 let
4949 tipArg = if onlyTip: " -r tip " else : " "
5050 branchArg = if branch == " " : " " else : & " -b { branch} "
51- discard tryDoCmdEx (& " hg clone { tipArg} { branchArg} { url} { downloadDir} " )
51+ discard tryDoCmdEx (& " hg clone { tipArg} { branchArg} { url} { downloadDir.quoteShell } " )
5252
5353proc gitFetchTags * (repoDir: string , downloadMethod: DownloadMethod , options: Options ) =
5454 case downloadMethod:
@@ -157,12 +157,12 @@ proc cloneSpecificRevision(downloadMethod: DownloadMethod,
157157 of DownloadMethod .git:
158158 let downloadDir = downloadDir.quoteShell
159159 createDir (downloadDir)
160- discard tryDoCmdEx (& " git -C { downloadDir} init " )
161- discard tryDoCmdEx (& " git -C { downloadDir} config core.autocrlf false " )
162- discard tryDoCmdEx (& " git -C { downloadDir} remote add origin { url} " )
160+ discard tryDoCmdEx (& " git -C { downloadDir.quoteShell } init " )
161+ discard tryDoCmdEx (& " git -C { downloadDir.quoteShell } config core.autocrlf false " )
162+ discard tryDoCmdEx (& " git -C { downloadDir.quoteShell } remote add origin { url} " )
163163 discard tryDoCmdEx (
164- & " git -C { downloadDir} fetch --depth 1 origin { vcsRevision} " )
165- discard tryDoCmdEx (& " git -C { downloadDir} reset --hard FETCH_HEAD " )
164+ & " git -C { downloadDir.quoteShell } fetch --depth 1 origin { vcsRevision} " )
165+ discard tryDoCmdEx (& " git -C { downloadDir.quoteShell } reset --hard FETCH_HEAD " )
166166 if not options.ignoreSubmodules:
167167 downloadDir.updateSubmodules
168168 of DownloadMethod .hg:
@@ -296,10 +296,10 @@ proc getTarCmdLine(downloadDir, filePath: string): string =
296296 when defined (Windows ):
297297 let downloadDir = downloadDir.replace ('\\ ' , '/' )
298298 let filePath = filePath.replace ('\\ ' , '/' )
299- & " { getTarExePath ()} -C { downloadDir} -xf { filePath} --strip-components 1 " &
299+ & " { getTarExePath ()} -C { downloadDir.quoteShell } -xf { filePath} --strip-components 1 " &
300300 " --force-local"
301301 else :
302- & " tar -C { downloadDir} -xf { filePath} --strip-components 1 "
302+ & " tar -C { downloadDir.quoteShell } -xf { filePath} --strip-components 1 "
303303
304304proc doDownloadTarball (url, downloadDir, version: string , queryRevision: bool ):
305305 Sha1Hash =
0 commit comments