mirror of
https://seed.radicle.dev/rad:z3qg5TKmN83afz2fj9z3fQjU8vaYE.git
synced 2026-11-21 18:40:47 +08:00
refactor: add helper function to git clone
Signed-off-by: Lars Wirzenius <liw@liw.fi>
This commit is contained in:
@@ -182,6 +182,22 @@ impl<'a> Runner<'a> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn git_clone(&mut self, repo_path: &Path) -> Result<(), NativeError> {
|
||||
debug!("cloning repository to {}", self.src.display());
|
||||
self.log_str("clone repository\n")?;
|
||||
runcmd(
|
||||
&mut self.run_log,
|
||||
&[
|
||||
"git",
|
||||
"clone",
|
||||
repo_path.to_str().unwrap(),
|
||||
self.src.to_str().unwrap(),
|
||||
],
|
||||
Path::new("."),
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Perform the CI run.
|
||||
fn run(&mut self) -> Result<(), NativeError> {
|
||||
self.log(format!("CI run on {}, {}\n", self.repo, self.commit))?;
|
||||
@@ -195,18 +211,7 @@ impl<'a> Runner<'a> {
|
||||
let repo_path = self.storage.join(self.repo.canonical());
|
||||
debug!("repo path: {}", repo_path.display());
|
||||
|
||||
debug!("cloning repository to {}", self.src.display());
|
||||
self.log_str("clone repository\n")?;
|
||||
runcmd(
|
||||
&mut self.run_log,
|
||||
&[
|
||||
"git",
|
||||
"clone",
|
||||
repo_path.to_str().unwrap(),
|
||||
self.src.to_str().unwrap(),
|
||||
],
|
||||
Path::new("."),
|
||||
)?;
|
||||
self.git_clone(&repo_path)?;
|
||||
|
||||
debug!("checking out commit {}", self.commit);
|
||||
self.log_str("check out commit\n")?;
|
||||
|
||||
Reference in New Issue
Block a user