mirror of https://github.com/sbt/sbt.git
specify the "--depth" parameter for efficient when git clone
This commit is contained in:
parent
1952e25c41
commit
ad9e71178a
|
|
@ -67,17 +67,25 @@ object Resolvers {
|
|||
}
|
||||
}.toResolver
|
||||
|
||||
val git: Resolver = new DistributedVCS {
|
||||
override val scheme = "git"
|
||||
val git: Resolver = (info: ResolveInfo) => {
|
||||
val uri = info.uri.withoutMarkerScheme
|
||||
val localCopy = uniqueSubdirectoryFor(uri.copy(scheme = "git"), in = info.staging)
|
||||
val from = uri.withoutFragment.toASCIIString
|
||||
|
||||
override def clone(from: String, to: File) {
|
||||
run("git", "clone", from, to.getAbsolutePath)
|
||||
if (uri.hasFragment) {
|
||||
val branch = uri.getFragment
|
||||
Some { () =>
|
||||
creates(localCopy) {
|
||||
run("git", "clone", from, localCopy.getAbsolutePath)
|
||||
run(Some(localCopy), "git", "checkout", "-q", branch)
|
||||
}
|
||||
}
|
||||
} else Some { () =>
|
||||
creates(localCopy) {
|
||||
run("git", "clone", "--depth", "1", from, localCopy.getAbsolutePath)
|
||||
}
|
||||
}
|
||||
|
||||
override def checkout(branch: String, in: File) {
|
||||
run(Some(in), "git", "checkout", "-q", branch)
|
||||
}
|
||||
}.toResolver
|
||||
}
|
||||
|
||||
abstract class DistributedVCS {
|
||||
val scheme: String
|
||||
|
|
|
|||
Loading…
Reference in New Issue