mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-30 08:05:05 +00:00
repo: inline init_cycles() now that it's very short
The function used to be larger when we had more reference cycles between e.g. the `WorkingCopy` and `Repo`. Now there's only `Evolution` left, so let's inline the function.
This commit is contained in:
parent
7494a03081
commit
a3de39a35a
1 changed files with 2 additions and 7 deletions
|
@ -183,8 +183,8 @@ impl ReadonlyRepo {
|
||||||
IndexFile::init(repo_path.join("index"));
|
IndexFile::init(repo_path.join("index"));
|
||||||
|
|
||||||
let evolution = ReadonlyEvolution::new(static_lifetime_repo);
|
let evolution = ReadonlyEvolution::new(static_lifetime_repo);
|
||||||
|
Arc::get_mut(&mut repo).unwrap().evolution = Some(evolution);
|
||||||
|
|
||||||
ReadonlyRepo::init_cycles(&mut repo, evolution);
|
|
||||||
repo.working_copy_locked()
|
repo.working_copy_locked()
|
||||||
.check_out(checkout_commit)
|
.check_out(checkout_commit)
|
||||||
.expect("failed to check out root commit");
|
.expect("failed to check out root commit");
|
||||||
|
@ -237,15 +237,10 @@ impl ReadonlyRepo {
|
||||||
let repo_ref: &ReadonlyRepo = repo.as_ref();
|
let repo_ref: &ReadonlyRepo = repo.as_ref();
|
||||||
let static_lifetime_repo: &'static ReadonlyRepo = unsafe { std::mem::transmute(repo_ref) };
|
let static_lifetime_repo: &'static ReadonlyRepo = unsafe { std::mem::transmute(repo_ref) };
|
||||||
let evolution = ReadonlyEvolution::new(static_lifetime_repo);
|
let evolution = ReadonlyEvolution::new(static_lifetime_repo);
|
||||||
ReadonlyRepo::init_cycles(&mut repo, evolution);
|
Arc::get_mut(&mut repo).unwrap().evolution = Some(evolution);
|
||||||
Ok(repo)
|
Ok(repo)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn init_cycles(mut repo: &mut Arc<ReadonlyRepo>, evolution: ReadonlyEvolution<'static>) {
|
|
||||||
let mut repo_ref_mut = Arc::get_mut(&mut repo).unwrap();
|
|
||||||
repo_ref_mut.evolution = Some(evolution);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn repo_path(&self) -> &PathBuf {
|
pub fn repo_path(&self) -> &PathBuf {
|
||||||
&self.repo_path
|
&self.repo_path
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue