From c5e31645a362bb552c826fc81d3b1a32f70b2b39 Mon Sep 17 00:00:00 2001 From: Josh Suereth Date: Thu, 3 Nov 2011 14:30:10 -0400 Subject: [PATCH] Attempting to fix git forking in windows --- main/Build.scala | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/main/Build.scala b/main/Build.scala index e276c7e14..217dbe813 100644 --- a/main/Build.scala +++ b/main/Build.scala @@ -87,10 +87,23 @@ object RetrieveUnit } } def dropFragment(base: URI): URI = if(base.getFragment eq null) base else new URI(base.getScheme, base.getSchemeSpecificPart, null) + + lazy val isWindowsShell = + ((!System.getenv("SHELL").contains("cygwin")) && + (System.getProperty("os.name").toLowerCase().indexOf("windows") >= 0)) + def gitClone(base: URI, tempDir: File): Unit = - run("git" :: "clone" :: dropFragment(base).toASCIIString :: tempDir.getAbsolutePath :: Nil, tempDir) ; + if(isWindowsShell) { + run("cmd" :: "/c" :: "git" :: "clone" :: dropFragment(base).toASCIIString :: tempDir.getAbsolutePath :: Nil, tempDir) ; + } else { + run("git" :: "clone" :: dropFragment(base).toASCIIString :: tempDir.getAbsolutePath :: Nil, tempDir) ; + } def gitCheckout(tempDir: File, branch: String): Unit = - run("git" :: "checkout" :: "-q" :: branch :: Nil, tempDir) ; + if(isWindowsShell) { + run("cmd" :: "/c" :: "git" :: "checkout" :: "-q" :: branch :: Nil, tempDir) ; + } else { + run("git" :: "checkout" :: "-q" :: branch :: Nil, tempDir) ; + } def run(command: List[String], cwd: File): Unit = { val result = Process(command, cwd) ! ;