src/Pure/System/isabelle_system.scala
changeset 81824 ef849800cc97
parent 81732 60f21b6e4f57
child 81832 7c92343b5408
--- a/src/Pure/System/isabelle_system.scala	Tue Jan 14 11:34:17 2025 +0100
+++ b/src/Pure/System/isabelle_system.scala	Wed Jan 15 13:45:22 2025 +0100
@@ -503,6 +503,18 @@
     }
   }
 
+  def git_clone(url: String, target: Path,
+    checkout: String = "HEAD",
+    ssh: SSH.System = SSH.Local,
+    progress: Progress = new Progress
+  ): Unit = {
+    progress.echo("Cloning " + quote(url))
+    bash(
+      "git clone --quiet --no-checkout " + Bash.string(url) + " . && " +
+      "git checkout --quiet --detach " + Bash.string(checkout),
+      ssh = ssh, cwd = ssh.make_directory(target)).check
+  }
+
   def open(arg: String): Unit =
     bash("exec \"$ISABELLE_OPEN\" " + Bash.string(arg) + " >/dev/null 2>/dev/null &")