mirror of https://github.com/sbt/sbt.git
Attempting to fix git forking in windows
This commit is contained in:
parent
0436b721be
commit
c5e31645a3
|
|
@ -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)
|
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 =
|
def gitClone(base: URI, tempDir: File): Unit =
|
||||||
|
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) ;
|
run("git" :: "clone" :: dropFragment(base).toASCIIString :: tempDir.getAbsolutePath :: Nil, tempDir) ;
|
||||||
|
}
|
||||||
def gitCheckout(tempDir: File, branch: String): Unit =
|
def gitCheckout(tempDir: File, branch: String): Unit =
|
||||||
|
if(isWindowsShell) {
|
||||||
|
run("cmd" :: "/c" :: "git" :: "checkout" :: "-q" :: branch :: Nil, tempDir) ;
|
||||||
|
} else {
|
||||||
run("git" :: "checkout" :: "-q" :: branch :: Nil, tempDir) ;
|
run("git" :: "checkout" :: "-q" :: branch :: Nil, tempDir) ;
|
||||||
|
}
|
||||||
def run(command: List[String], cwd: File): Unit =
|
def run(command: List[String], cwd: File): Unit =
|
||||||
{
|
{
|
||||||
val result = Process(command, cwd) ! ;
|
val result = Process(command, cwd) ! ;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue