mirror of
https://github.com/martinvonz/jj.git
synced 2024-09-21 10:50:22 +03:00
repo: fix crash on upgrade of repo backed by external Git repo
If the repo is backed by Git repo that's not inside `.jj/`, then there's no `.jj/git/` directory to move into `.jj/store/`.
This commit is contained in:
parent
97b48635f6
commit
6722a79e27
@ -399,7 +399,9 @@ impl RepoLoader {
|
||||
let git_backend_path_str = contents[5..].to_string();
|
||||
fs::remove_file(&store_path).unwrap();
|
||||
fs::create_dir(&store_path).unwrap();
|
||||
fs::rename(repo_path.join("git"), store_path.join("git")).unwrap();
|
||||
if repo_path.join("git").is_dir() {
|
||||
fs::rename(repo_path.join("git"), store_path.join("git")).unwrap();
|
||||
}
|
||||
fs::write(store_path.join("git_target"), &git_backend_path_str).unwrap();
|
||||
println!("Done. .jj/git is now .jj/store/git");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user