Move git state to Project (#23208)
This restores its visibility outside of git_ui, which we'll need soon, while preserving its per-project character. Release Notes: - N/A
This commit is contained in:
parent
614eaec278
commit
b7726238ad
10 changed files with 363 additions and 317 deletions
|
@ -2583,6 +2583,17 @@ impl Snapshot {
|
|||
&self.repositories
|
||||
}
|
||||
|
||||
pub fn repositories_with_abs_paths(
|
||||
&self,
|
||||
) -> impl '_ + Iterator<Item = (&RepositoryEntry, PathBuf)> {
|
||||
let base = self.abs_path();
|
||||
self.repositories.iter().map(|repo| {
|
||||
let path = repo.work_directory.location_in_repo.as_deref();
|
||||
let path = path.unwrap_or(repo.work_directory.as_ref());
|
||||
(repo, base.join(path))
|
||||
})
|
||||
}
|
||||
|
||||
/// Get the repository whose work directory corresponds to the given path.
|
||||
pub(crate) fn repository(&self, work_directory: PathKey) -> Option<RepositoryEntry> {
|
||||
self.repositories.get(&work_directory, &()).cloned()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue