forked from mirrors/jj
repo: use local variable for WorkingCopy
in Repo::init()
No need to pass it into `Repo` and then get it back from there.
This commit is contained in:
parent
33b272f5fa
commit
b35086d4c9
1 changed files with 7 additions and 9 deletions
|
@ -188,7 +188,7 @@ impl ReadonlyRepo {
|
||||||
) -> Arc<ReadonlyRepo> {
|
) -> Arc<ReadonlyRepo> {
|
||||||
let repo_settings = user_settings.with_repo(&repo_path).unwrap();
|
let repo_settings = user_settings.with_repo(&repo_path).unwrap();
|
||||||
|
|
||||||
let working_copy = WorkingCopy::init(
|
let mut working_copy = WorkingCopy::init(
|
||||||
store.clone(),
|
store.clone(),
|
||||||
wc_path.clone(),
|
wc_path.clone(),
|
||||||
repo_path.join("working_copy"),
|
repo_path.join("working_copy"),
|
||||||
|
@ -222,7 +222,11 @@ impl ReadonlyRepo {
|
||||||
|
|
||||||
let view = View::new(root_view);
|
let view = View::new(root_view);
|
||||||
|
|
||||||
let repo = ReadonlyRepo {
|
working_copy
|
||||||
|
.check_out(checkout_commit)
|
||||||
|
.expect("failed to check out root commit");
|
||||||
|
|
||||||
|
Arc::new(ReadonlyRepo {
|
||||||
repo_path,
|
repo_path,
|
||||||
wc_path,
|
wc_path,
|
||||||
store,
|
store,
|
||||||
|
@ -234,13 +238,7 @@ impl ReadonlyRepo {
|
||||||
index: Mutex::new(None),
|
index: Mutex::new(None),
|
||||||
working_copy: Arc::new(Mutex::new(working_copy)),
|
working_copy: Arc::new(Mutex::new(working_copy)),
|
||||||
view,
|
view,
|
||||||
};
|
})
|
||||||
let repo = Arc::new(repo);
|
|
||||||
|
|
||||||
repo.working_copy_locked()
|
|
||||||
.check_out(checkout_commit)
|
|
||||||
.expect("failed to check out root commit");
|
|
||||||
repo
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn load(
|
pub fn load(
|
||||||
|
|
Loading…
Reference in a new issue