def work()

in logstash/buildSrc/src/main/groovy/GitCloneTask.groovy [9:22]


	def work() {
		def (org, repo) = uri.split("/")[-2..-1]
		repo = repo.replaceAll(/\.git$/, "")
		def outputDir = new File("${project.buildDir}/${org}/${repo}")

		outputDir.getParentFile().mkdirs()
		if (outputDir.exists()) {
			// XXX: Make this an update task? Optional?
			def git = Grgit.open(dir: outputDir)
			git.fetch()
		} else {
			Grgit.clone(dir: outputDir, uri: uri)
		}
	}