fix: clone from correct branch

Co-authored-by: zaaarf <me@zaaarf.foo>
This commit is contained in:
əlemi 2024-05-10 03:12:31 +02:00
parent 92ea79333e
commit 4b8c1a6476
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -30,7 +30,6 @@ impl Tci {
match self.cfg.branch.as_deref() { match self.cfg.branch.as_deref() {
None => self.repo.updated("tci"), None => self.repo.updated("tci"),
Some("") => true,
Some(b) => self.repo.updated(b), Some(b) => self.repo.updated(b),
} }
} }
@ -66,10 +65,13 @@ impl Tci {
&format!("tci-{}", self.repo.name.replace('/', "_")) &format!("tci-{}", self.repo.name.replace('/', "_"))
)?; )?;
let clone_branch = self.repo.ci_branch.as_deref()
.unwrap_or_else(|| self.cfg.branch.as_deref().unwrap_or("tci"));
// TODO recursive clone? automatically clone all submodules after? // TODO recursive clone? automatically clone all submodules after?
git2::build::RepoBuilder::new() git2::build::RepoBuilder::new()
.bare(false) .bare(false)
.branch("tci") .branch(clone_branch)
.clone( .clone(
self.repo.path.to_str() self.repo.path.to_str()
.ok_or(TciErr::FsError("repo path is not a valid string"))?, .ok_or(TciErr::FsError("repo path is not a valid string"))?,