forked from mirrors/jj
git_backend: open just-initialized repo with canonicalized path
Otherwise, the initialized repo could have a different work-dir path than the load()-ed one. libgit2 appears to do some normalization somewhere, but gix won't.
This commit is contained in:
parent
fd187d266f
commit
f5a61dc2b7
1 changed files with 7 additions and 1 deletions
|
@ -163,7 +163,13 @@ impl GitBackend {
|
||||||
.context(&target_path)
|
.context(&target_path)
|
||||||
.map_err(GitBackendInitError::Path)?;
|
.map_err(GitBackendInitError::Path)?;
|
||||||
};
|
};
|
||||||
let repo = git2::Repository::open(store_path.join(git_repo_path))
|
let canonical_git_repo_path = {
|
||||||
|
let path = store_path.join(git_repo_path);
|
||||||
|
path.canonicalize()
|
||||||
|
.context(&path)
|
||||||
|
.map_err(GitBackendInitError::Path)?
|
||||||
|
};
|
||||||
|
let repo = git2::Repository::open(canonical_git_repo_path)
|
||||||
.map_err(GitBackendInitError::OpenRepository)?;
|
.map_err(GitBackendInitError::OpenRepository)?;
|
||||||
let extra_metadata_store = TableStore::init(extra_path, HASH_LENGTH);
|
let extra_metadata_store = TableStore::init(extra_path, HASH_LENGTH);
|
||||||
Ok(GitBackend::new(repo, extra_metadata_store))
|
Ok(GitBackend::new(repo, extra_metadata_store))
|
||||||
|
|
Loading…
Reference in a new issue