summary refs log tree commit diff stats
path: root/koch.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2017-01-03 22:15:59 +0100
committerAraq <rumpf_a@web.de>2017-01-03 22:15:59 +0100
commitb3b2203aba27f7af5ba6af5c09cc8580c6777036 (patch)
tree3e99160b5a9cdbcadb5c56c8d84cf73be684496b /koch.nim
parentef6029d3a9d72fa1a5631fc49f5f93832c63e3d5 (diff)
downloadNim-b3b2203aba27f7af5ba6af5c09cc8580c6777036.tar.gz
koch.nim: don't use --git-dir; produces weird results
Diffstat (limited to 'koch.nim')
-rw-r--r--koch.nim18
1 files changed, 10 insertions, 8 deletions
diff --git a/koch.nim b/koch.nim
index d06f7d809..2451a597e 100644
--- a/koch.nim
+++ b/koch.nim
@@ -76,7 +76,7 @@ proc exe(f: string): string =
     result = result.replace('/','\\')
 
 template withDir(dir, body) =
-  let old = getCurrentDir(dir)
+  let old = getCurrentDir()
   try:
     setCurrentDir(dir)
     body
@@ -172,8 +172,9 @@ proc bundleNimbleSrc() =
   ## always bundle the latest official release.
   if not dirExists("dist/nimble/.git"):
     exec("git clone https://github.com/nim-lang/nimble.git dist/nimble")
-  exec("git --git-dir dist/nimble/.git checkout -f stable")
-  exec("git --git-dir dist/nimble/.git pull")
+  withDir("dist/nimble"):
+    exec("git checkout -f stable")
+    exec("git pull")
 
 proc bundleNimbleExe() =
   bundleNimbleSrc()
@@ -192,11 +193,12 @@ proc buildNimble(latest: bool) =
         inc id
       installDir = "dist/nimble" & $id
     exec("git clone https://github.com/nim-lang/nimble.git " & installDir)
-  if latest:
-    exec("git --git-dir " & installDir & "/.git checkout -f master")
-  else:
-    exec("git --git-dir " & installDir & ".git checkout -f stable")
-  exec("git --git-dir " & installDir & "/.git pull")
+  withDir(installDir):
+    if latest:
+      exec("git checkout -f master")
+    else:
+      exec("git checkout -f stable")
+    exec("git pull")
   nimexec("c --noNimblePath -p:compiler " & installDir / "src/nimble.nim")
   copyExe(installDir / "src/nimble".exe, "bin/nimble".exe)