diff options
author | Melody Horn <melody@boringcactus.com> | 2021-04-23 00:14:45 -0600 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2021-04-23 00:14:45 -0600 |
commit | 60e05b91d812fea839f9acc949d98f12039af765 (patch) | |
tree | 4dbf573f5da803169e1eca239d61c68217a1263c /src/state.rs | |
parent | 518025bee1982bad954e3640b693f1a0a747adc0 (diff) | |
download | gityeet-60e05b91d812fea839f9acc949d98f12039af765.tar.gz gityeet-60e05b91d812fea839f9acc949d98f12039af765.zip |
it would be smart to not keep the Vec<Repository> around, but nobody's ever accused me of smart
Diffstat (limited to 'src/state.rs')
-rw-r--r-- | src/state.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/state.rs b/src/state.rs index 004d3e2..deb7c9c 100644 --- a/src/state.rs +++ b/src/state.rs @@ -60,4 +60,9 @@ impl State { pub fn relative_path<'a>(&'a self, subdir: &'a Path) -> &'a Path { subdir.strip_prefix(&self.root).unwrap_or(subdir) } + + pub fn open(&self, path: impl AsRef<Path>) -> Result<Repository> { + let path = self.root.join(path); + Ok(Repository::open_bare(path)?) + } } |